Skip to content

Conversation

@jairad26
Copy link
Contributor

@jairad26 jairad26 commented Oct 29, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • This PR allows users to set env vars without the CHROMA_ prefix on embedding functions in python, while still supporting the default env var as fallback
  • New functionality
    • ...
image image image image image

for cloudflare, jina -> used the same naming convention as JS client

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor Author

jairad26 commented Oct 29, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jairad26 jairad26 changed the title [CHORE] Add fallback for python ef env vars that are not prefixed with CHROMA_ [CHORE] Add support for non-prefixed ef env vars in python Oct 29, 2025
@jairad26 jairad26 marked this pull request as ready for review October 29, 2025 17:04
@propel-code-bot
Copy link
Contributor

Accept vendor-standard *_API_KEY env vars for all Python embedding functions

Adds fallback logic to every Python embedding function so that the SDK will look for the vendor-specific environment variable (e.g. OPENAI_API_KEY) before falling back to the existing CHROMA_* prefixed variable. The change is implemented individually in each embedding function’s __init__, updating the key-selection, error messages, and stored api_key_env_var value.

Key Changes

• For each embedding function (openai, google_*, huggingface, cohere, jina, together_ai, baseten, cloudflare_workers_ai, voyageai, roboflow) added check: if os.getenv(VENDOR_KEY) is not None: self.api_key_env_var = VENDOR_KEY else: self.api_key_env_var = api_key_env_var
• All subsequent references to api_key now use self.api_key_env_var, and error messages reflect the selected key name
• Removed redundant assignments to self.api_key_env_var where replaced
• Updated validation paths to raise when neither key variant is present

Affected Areas

chromadb/utils/embedding_functions/*_embedding_function.py constructors
• Error-handling logic for missing API keys

This summary was automatically generated by @propel-code-bot

Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

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

Can we make sure to only do this for API keys where the provider has some first party name for the key?

@jairad26 jairad26 merged commit 91da387 into main Nov 7, 2025
120 of 129 checks passed
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.

3 participants