feat: Add support for VoyageAI embeddings API #1442
+337
−120
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.
Risks
A bug or change in behavior of embedding provider selection could cause an unexpected switch. This could cause pre-existing embeddings and new embeddings to be incompatible.
I removed
isOllama
flag from the config. It seemed to only be used when we already knew the provider is ollama so was redundant. It is technically a change in behavior because using ollama with a url override will no longer strip the trailing v1/.Background
What does this PR do?
Added support for environment variables:
Some minor clean-up of the embedding.ts file.
Added unit tests around embedding configuration.
What kind of change is this?
Feature
Why are we doing this? Any context or related work?
Anthropic does not support an embedding API, but recommends Voyage. Various model sizes and domains are supported.
Documentation changes needed?
.env.example
to include new settings.getEmbeddingType
. I see there are some API docs including this. Is there a doc generation step?Testing
Detailed testing steps
Using Voyage AI
Logs:
Using Local Model
Logs:
Discord username
firbydude