Fix embedding tokenizer mismatch with custom embedding server
Disable tiktoken pre-encoding for custom embedding servers. LangChain was encoding text into OpenAI token IDs then sending them to llama-server which has a different vocabulary, causing "invalid tokens" errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ if _embedding_server_url:
|
|||||||
model=_embedding_model,
|
model=_embedding_model,
|
||||||
base_url=_embedding_server_url,
|
base_url=_embedding_server_url,
|
||||||
api_key="not-needed",
|
api_key="not-needed",
|
||||||
|
check_embedding_ctx_length=False,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
embeddings = OpenAIEmbeddings(model=_embedding_model)
|
embeddings = OpenAIEmbeddings(model=_embedding_model)
|
||||||
|
|||||||
Reference in New Issue
Block a user