Fix: Add configurable model support for Jina embedding#2433
Fix: Add configurable model support for Jina embedding#2433danielaskdd merged 4 commits intoHKUDS:mainfrom
Conversation
- Add model parameter to jina_embed - Pass model from API server - Default to jina-embeddings-v4 - Update function documentation - Make model selection flexible
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Set EMBEDDING_MODEL default to None - Pass model param only when provided - Let providers use their own defaults - Fix lollms embed function params - Add ollama embed_model default param
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
LightRAG/lightrag/api/lightrag_server.py
Lines 720 to 723 in ea8d55a
When a user sets EMBEDDING_BINDING=jina with EMBEDDING_MODEL=jina-embeddings-v3 (as advertised in the commit message), args.embedding_dim now defaults to None, so final_embedding_dim remains the provider default 2048. The Jina binding forces send_dimensions=True, so the optimized wrapper injects 2048 into jina_embed, but the v3 API returns 1024-length vectors. EmbeddingFunc then raises a dimension-mismatch ValueError, making the new model selector unusable unless users manually override EMBEDDING_DIM. The dimension should be derived from the chosen model or validated so the configuration example works without runtime failure.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fix: Add configurable model support for Jina embedding
Summary
This PR adds the ability to configure the Jina embedding model via the
EMBEDDING_MODELenvironment variable. Previously, the Jina embedding model was hardcoded tojina-embeddings-v4, which prevented users from using other Jina models likejina-embeddings-v3.Fix: #2431
Changes
lightrag/llm/jina.pymodelparameter tojina_embedfunction with default valuejina-embeddings-v4modelparameterlightrag/api/lightrag_server.pycreate_optimized_embedding_functionto passmodelparameter when calling Jina embeddingConfiguration Example
EMBEDDING_BINDING=jina EMBEDDING_MODEL=jina-embeddings-v3 # or jina-embeddings-v4 (default) JINA_API_KEY=your-api-keyBreaking Changes
None. Default behavior remains unchanged (
jina-embeddings-v4).Testing
EMBEDDING_MODEL=jina-embeddings-v3EMBEDDING_MODEL(should use default v4)