making constant specific to health

This commit is contained in:
Sumit Jaiswal 2025-06-18 20:50:54 +05:30
parent be6ef8bc17
commit 2cf563769d
No known key found for this signature in database
GPG key ID: A4604B39D64D6AEC

View file

@ -45,7 +45,6 @@ VERSION = "v3"
VECTOR_DBS_PREFIX = f"vector_dbs:{VERSION}::" VECTOR_DBS_PREFIX = f"vector_dbs:{VERSION}::"
FAISS_INDEX_PREFIX = f"faiss_index:{VERSION}::" FAISS_INDEX_PREFIX = f"faiss_index:{VERSION}::"
OPENAI_VECTOR_STORES_PREFIX = f"openai_vector_stores:{VERSION}::" OPENAI_VECTOR_STORES_PREFIX = f"openai_vector_stores:{VERSION}::"
VECTOR_DIMENSION = 128 # sample dimension
class FaissIndex(EmbeddingIndex): class FaissIndex(EmbeddingIndex):
@ -190,7 +189,8 @@ class FaissVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtocolPr
HealthResponse: A dictionary containing the health status. HealthResponse: A dictionary containing the health status.
""" """
try: try:
faiss.IndexFlatL2(VECTOR_DIMENSION) vector_dimension = 128 # sample dimension
faiss.IndexFlatL2(vector_dimension)
return HealthResponse(status=HealthStatus.OK) return HealthResponse(status=HealthStatus.OK)
except Exception as e: except Exception as e:
return HealthResponse(status=HealthStatus.ERROR, message=f"Health check failed: {str(e)}") return HealthResponse(status=HealthStatus.ERROR, message=f"Health check failed: {str(e)}")