feat(support-google-openai-compat-embedding): Add support for Google and OpenAI compatible endpoints for embeddings#112
Open
joaofauvel wants to merge 14 commits intogannonh:mainfrom
Conversation
This change introduces an option to the OpenAIEmbeddingService, enabling users to connect to any OpenAI-compatible API, such as Azure OpenAI. This provides greater flexibility for users who rely on alternative or self-hosted embedding providers. Refs gannonh#107
This commit updates the test suite to validate the new `apiEndpoint` functionality. It ensures that the custom endpoint is correctly passed to the OpenAI client and that the embedding service behaves as expected when an alternative endpoint is provided. Refs gannonh#107
This commit plumbs the `OPENAI_API_ENDPOINT` configuration from the environment variables through the application setup and into the `EmbeddingServiceFactory`. This makes the new functionality available to the server handlers. Refs gannonh#107
This commit updates the project documentation to include instructions on how to configure and use the new custom embedding endpoint feature. It clarifies the purpose of the `OPENAI_API_ENDPOINT` environment variable. Refs gannonh#107
This commit updates the `example.env` file with the new `OPENAI_API_ENDPOINT` variable to guide users in setting up their environment. Refs gannonh#107
…m dimension support for OpenAI This commit refactors the OpenAI embedding service to use standardized environment variables and introduces support for custom embedding dimensions. Key changes: - Renamed `OPENAI_EMBEDDING_MODEL` to `EMBEDDING_MODEL` for consistency across providers. - Renamed `OPENAI_API_ENDPOINT` to `EMBEDDING_ENDPOINT` to allow for generic endpoint configuration. - Added support for the `EMBEDDING_DIMENSIONS` environment variable. - The `dimensions` parameter is now conditionally passed to the OpenAI API when `ENABLE_CUSTOM_DIMENSIONS` is set to 'true', allowing for greater flexibility with different embedding models. Refs gannonh#107 gannonh#69
This commit introduces a new embedding service for Google's Gemini models. Key features: - Integrates with the Google Generative Language API to generate embeddings. - Supports custom vector dimensions via the `output_dimensionality` parameter, controlled by the `ENABLE_CUSTOM_DIMENSIONS` environment variable. - Includes L2 normalization of embeddings to ensure consistency with other services. - Automatically selects the Google provider based on the `EMBEDDING_MODEL` environment variable (e.g., `gemini-embedding-001`). Refs gannonh#103 gannonh#69
This commit fixes the EmbeddingServiceFactory to correctly pass the 'dimensions' parameter to the GoogleEmbeddingService provider. This ensures that custom dimensions are properly configured when creating a Google embedding service through the factory.
This commit adds a comprehensive test suite to validate the custom dimensions feature for both Google and OpenAI embedding services.
- Adds a new integration test file ('DimensionPassing.integration.test.ts') to verify end-to-end functionality.
- Updates unit tests for GoogleEmbeddingService and OpenAIEmbeddingService to cover the conditional passing of dimension parameters.
- Includes tests for both environment variable configuration and explicit provider configuration.
- Mocks API calls to inspect the payload and ensure the correct parameters are being sent.
This commit updates the main server entrypoint and the callToolHandler to integrate the new embedding service capabilities. - Ensures that the server correctly initializes the EmbeddingServiceFactory with the new providers. - Updates the diagnostic test for the callToolHandler to reflect the changes in the embedding services.
This commit updates the DefaultEmbeddingService and the smithery.yaml file to align with the new embedding feature. - The DefaultEmbeddingService is updated to handle the new environment variable. - The smithery.yaml file is updated to reflect the new version and dependencies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces support for Google's Gemini embedding models and openai compatible custom endpoints and allows users to specify custom vector dimensions for both Google and OpenAI services. It also includes the changes from the
feature/openai-compat-embeddingbranch #108.Integrates #108
Closes #69
Closes #107