diff --git a/jaseci_ai_kit/jac_misc/jac_misc/elastic_retrieval/elastic_retrieval.py b/jaseci_ai_kit/jac_misc/jac_misc/elastic_retrieval/elastic_retrieval.py index a4e580f0a6..16620f1e33 100644 --- a/jaseci_ai_kit/jac_misc/jac_misc/elastic_retrieval/elastic_retrieval.py +++ b/jaseci_ai_kit/jac_misc/jac_misc/elastic_retrieval/elastic_retrieval.py @@ -10,7 +10,7 @@ OAI_CLIENT = None ES_CLIENT = None -MAX_DIMENSIONS = int(getenv("ELASTICSEARCH_VECTOR_SIZE", "2048")) +MAX_DIMENSIONS = getenv("ELASTICSEARCH_VECTOR_SIZE", "2048") CONFIG = { "elastic": { "url": getenv("ELASTICSEARCH_URL", "http://localhost:9200"), @@ -34,7 +34,7 @@ "id": {"type": "keyword"}, "embedding": { "type": "dense_vector", - "dims": MAX_DIMENSIONS, + "dims": int(MAX_DIMENSIONS), "index": True, "similarity": getenv("ELASTICSEARCH_SIMILARITY", "cosine"), }, @@ -47,7 +47,9 @@ "openai": {"api_key": getenv("OPENAI_API_KEY")}, "openai_embedding": { "model": getenv("OPENAI_EMBEDDING_MODEL", "text-embedding-3-large"), - "dimensions": getenv("OPENAI_EMBEDDING_DIMENSIONS", MAX_DIMENSIONS), + "extra_body": { + "dimensions": int(getenv("OPENAI_EMBEDDING_DIMENSIONS", MAX_DIMENSIONS)) + }, }, "chunk_config": { "chunk_size": int(getenv("CHUNK_SIZE", "200")),