Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$vectorize: Misleading error when authentication.providerKey not set #1124

Closed
vkarpov15 opened this issue May 29, 2024 · 5 comments
Closed
Assignees

Comments

@vkarpov15
Copy link
Collaborator

Suppose you create a collection without an authentication.providerKey:

{
    vector: {
      dimension: 1536,
      metric: 'cosine',
      service: {
        provider: 'openai',
        modelName: 'text-embedding-ada-002'
      }
    }
  }

If you try to use $vectorize with this new collection:

{
  "insertOne": {
    "document": {
      "title": "foo",
      "$vectorize": "taco tuesday"
    }
  }
}

You get an NPE: [{"message":"java.lang.NullPointerException: Param was null","errorCode":"SERVER_UNHANDLED_ERROR"}] similar to #1116.

The error message should be better. Ideally throw an error when calling createCollection(), but ideally a more helpful error that there's missing credentials like VECTORIZE_CREDENTIAL_INVALID would be good

@Yuqi-Du
Copy link
Contributor

Yuqi-Du commented May 29, 2024

Thanks, Val
New error will be like this when you do insertOne, but collection does not have the authentication.providerKey

{
    "errors": [
        {
            "message": "Embedding Gateway failed to process request: getCredential error, integration credential is null",
            "errorCode": "EMBEDDING_GATEWAY_PROCESSING_ERROR"
        }
    ]
}

@Yuqi-Du
Copy link
Contributor

Yuqi-Du commented May 29, 2024

@Hazel-Datastax
Correct me if I am wrong.

{
    vector: {
      dimension: 1536,
      metric: 'cosine',
      service: {
        provider: 'openai',
        modelName: 'text-embedding-ada-002'
      }
    }
  }

This basically says this collection will use header-based vectorize authentication. Correct?
So we should not error out for createCollection.

@Hazel-Datastax
Copy link
Contributor

@Hazel-Datastax Correct me if I am wrong.

{
    vector: {
      dimension: 1536,
      metric: 'cosine',
      service: {
        provider: 'openai',
        modelName: 'text-embedding-ada-002'
      }
    }
  }

This basically says this collection will use header-based vectorize authentication. Correct? So we should not error out for createCollection.

Correct. It expects either "header-based" or "none"

@vkarpov15
Copy link
Collaborator Author

I think "Embedding Gateway failed to process request: getCredential error, integration credential is null" error on insertOne() is sufficient for this case. The NPE was very confusing, this error message is much better.

@vkarpov15
Copy link
Collaborator Author

Just one small follow-up question: is there a way to get $vectorize to work correctly if you've created a collection using the following?

{
    vector: {
      dimension: 1536,
      metric: 'cosine',
      service: {
        provider: 'openai',
        modelName: 'text-embedding-ada-002'
      }
    }
  }

If not, we should consider making createCollection() fail in this case, maybe just based on the provider?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants