Skip to content

Conversation

@nilpotent7
Copy link

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • ...
  • New functionality
    • Ability to change API Base URL endpoint for OpenAI Embedding Function in Typescript.
    • Updated docs to specify apiBase paramater.

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?
No need. This change is backwards compatible.

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?
Documentation has been updated to reflect the changes.

Added ability to change API's Base URL in OpenAI Embedding Function.
Added documentation for apiBase parameter to OpenAI Embedding Function docs
@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)

@nilpotent7 nilpotent7 marked this pull request as ready for review October 19, 2025 13:56
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Oct 19, 2025

Add Custom API Endpoint Support for OpenAI Embedding Function in TypeScript

This PR introduces the ability to specify a custom API base URL (apiBase) for the OpenAIEmbeddingFunction in the TypeScript/Javascript client. This enhancement allows users to point embedding function calls to alternative OpenAI-compatible endpoints, such as those provided by third parties (e.g., GitHub AI Models), in addition to OpenAI's default endpoint. The implementation includes updates to both the configuration and constructor logic, and modifies the project's documentation to show how to use the new apiBase parameter in practice.

Key Changes

• Added apiBase (or api_base) property to OpenAIArgs and OpenAIConfig interfaces in clients/new-js/packages/ai-embeddings/openai/src/index.ts
• Updated OpenAIEmbeddingFunction constructor to conditionally set baseURL for the OpenAI client using the apiBase value
• Persisted apiBase through the configuration lifecycle in getConfig() and buildFromConfig() methods
• Improved type safety for client options using ClientOptions from the OpenAI SDK
• Updated documentation in docs/docs.trychroma.com/markdoc/content/integrations/embedding-models/openai.md to demonstrate use of the apiBase parameter with an example

Affected Areas

clients/new-js/packages/ai-embeddings/openai/src/index.ts (OpenAI embedding function implementation and configuration)
docs/docs.trychroma.com/markdoc/content/integrations/embedding-models/openai.md (integration model documentation)

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

@nilpotent7
Copy link
Author

@kylediaz Please review the PR, thanks!

Addressed the issue where undefined paramater could be mishandled by OpenAI SDK
Added apiBase to OpenAIConfig so it can properly be used/saved
Changed if statement to follow Typescript conventions
Changed variable name from a reserved name to avoid runtime issues
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