Skip to content

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
joaofauvel:feature/google-gemini-embedding
Open

feat(support-google-openai-compat-embedding): Add support for Google and OpenAI compatible endpoints for embeddings#112
joaofauvel wants to merge 14 commits intogannonh:mainfrom
joaofauvel:feature/google-gemini-embedding

Conversation

@joaofauvel
Copy link

@joaofauvel joaofauvel commented Oct 28, 2025

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-embedding branch #108.

Integrates #108
Closes #69
Closes #107

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.
@joaofauvel joaofauvel marked this pull request as ready for review October 28, 2025 04:26
@joaofauvel joaofauvel changed the title feat(embeddings): Add Google Gemini support and custom dimensions feat(embeddings): Add support for Google and OpenAI compatible endpoints for embeddings Oct 28, 2025
@joaofauvel joaofauvel changed the title feat(embeddings): Add support for Google and OpenAI compatible endpoints for embeddings feat(support-google-openai-compat-embedding): Add support for Google and OpenAI compatible endpoints for embeddings Oct 28, 2025
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.

Add support for custom openai compatible endpoints Local embedding service option?

1 participant