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

Include sourceTag in PineconeConfigurationSchema #215

Merged
merged 2 commits into from
May 10, 2024

Conversation

austin-denoble
Copy link
Contributor

@austin-denoble austin-denoble commented May 10, 2024

Problem

When sourceTag was added to PineconeConfiguration as an argument it was not included in the PineconeConfigurationSchema object. This object is used by typebox at runtime to validate the arguments passed to the constructor. Since sourceTag is not included, and PineconeConfigurationSchema has additionalProperties: false configured, users will see an error when trying to pass sourceTag:

PineconeArgumentError: The client configuration had validation errors: argument must NOT have additional properties.

This can be disabled with the PINECONE_DISABLE_RUNTIME_VALIDATIONS environment variable, but that should not be required.

Solution

Add sourceTag to PineconeConfigurationSchema. Update the unit test that validates passing the additional parameters to the Pinecone constructor.

We probably need some better integration / unit test coverage for some of the headers and config values that we're expecting to be sent on request. I can follow up with that. For now I tested locally with PINECONE_DEBUG and PINECONE_DEBUG_CURL to verify the request:

Screenshot 2024-05-10 at 3 14 22 PM

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

You can pull this branch down and run the repl locally. Basically, just confirm you can pass sourceTag as an argument to Pinecone and then make some network calls to check it shows up as you'd expect (see example screenshot above):

$ export PINECONE_DEBUG=true
$ export PINECONE_DEBUG_CURL=true
$ npm run repl
$ await init()

const newClient = new Pinecone({ apiKey: "my-key", sourceTag: "my-tag" })
await newClient.listIndexes()

// Validate the request has the expected user-agent shape

@austin-denoble austin-denoble requested a review from ssmith-pc May 10, 2024 19:30
Copy link

@ssmith-pc ssmith-pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting this out so fast!

@austin-denoble austin-denoble merged commit fba7032 into main May 10, 2024
25 checks passed
@austin-denoble austin-denoble deleted the adenoble/fix-source-tag-validation branch May 10, 2024 19:43
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

Successfully merging this pull request may close these issues.

2 participants