Skip to content

The agent engineering platform.

"source" argument in constructor of Vectara (#11454)

Ofer Mendelevitch3c7653bf0f68
diff --git a/libs/langchain/langchain/vectorstores/vectara.py b/libs/langchain/langchain/vectorstores/vectara.py
index cb390780a7..ed3ffedf66 100644
--- a/libs/langchain/langchain/vectorstores/vectara.py
+++ b/libs/langchain/langchain/vectorstores/vectara.py
@@ -39,6 +39,7 @@ class Vectara(VectorStore):
vectara_corpus_id: Optional[str] = None,
vectara_api_key: Optional[str] = None,
vectara_api_timeout: int = 60,
+ source: Optional[str] = "langchain",
):
"""Initialize with Vectara API."""
self._vectara_customer_id = vectara_customer_id or os.environ.get(
@@ -59,6 +60,8 @@ class Vectara(VectorStore):
)
else:
logger.debug(f"Using corpus id {self._vectara_corpus_id}")
+ self._source = source
+
self._session = requests.Session() # to reuse connections
adapter = requests.adapters.HTTPAdapter(max_retries=3)
self._session.mount("http://", adapter)
@@ -74,7 +77,7 @@ class Vectara(VectorStore):
"x-api-key": self._vectara_api_key,
"customer-id": self._vectara_customer_id,
"Content-Type": "application/json",
- "X-Source": "langchain",
+ "X-Source": self._source,
}
def _delete_doc(self, doc_id: str) -> bool: