From c6d6d1a01e3bd69efe53462d6614cccceb171715 Mon Sep 17 00:00:00 2001 From: Matt Blye Date: Mon, 14 Oct 2024 18:58:12 -0400 Subject: [PATCH 1/2] fixed langchain embedding call for azure: https://github.com/langchain-ai/langchain/issues/4575 --- config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config.py b/config.py index 00fb6ab..022113a 100644 --- a/config.py +++ b/config.py @@ -171,6 +171,7 @@ async def dispatch(self, request, call_next): RAG_AZURE_OPENAI_ENDPOINT = get_env_variable( "RAG_AZURE_OPENAI_ENDPOINT", AZURE_OPENAI_ENDPOINT ).rstrip("/") +RAG_AZURE_CHUNK_SIZE = int(get_env_variable("RAG_AZURE_CHUNK_SIZE", "1")) HF_TOKEN = get_env_variable("HF_TOKEN", "") OLLAMA_BASE_URL = get_env_variable("OLLAMA_BASE_URL", "http://ollama:11434") AWS_ACCESS_KEY_ID = get_env_variable("AWS_ACCESS_KEY_ID", "") @@ -197,6 +198,7 @@ def init_embeddings(provider, model): api_key=RAG_AZURE_OPENAI_API_KEY, azure_endpoint=RAG_AZURE_OPENAI_ENDPOINT, api_version=RAG_AZURE_OPENAI_API_VERSION, + chunk_size=RAG_AZURE_CHUNK_SIZE ) elif provider == EmbeddingsProvider.HUGGINGFACE: from langchain_huggingface import HuggingFaceEmbeddings From b77ccaa3e8db4c331045d29046297cb4f2c709cf Mon Sep 17 00:00:00 2001 From: mblye Date: Mon, 14 Oct 2024 18:21:49 -0400 Subject: [PATCH 2/2] Fixing issue w/ Azure embeddings --- config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config.py b/config.py index 022113a..9f51882 100644 --- a/config.py +++ b/config.py @@ -176,6 +176,7 @@ async def dispatch(self, request, call_next): OLLAMA_BASE_URL = get_env_variable("OLLAMA_BASE_URL", "http://ollama:11434") AWS_ACCESS_KEY_ID = get_env_variable("AWS_ACCESS_KEY_ID", "") AWS_SECRET_ACCESS_KEY = get_env_variable("AWS_SECRET_ACCESS_KEY", "") +RAG_AZURE_CHUNK_SIZE = int(get_env_variable("RAG_AZURE_CHUNK_SIZE", "1")) ## Embeddings