mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-19 21:33:51 +00:00
"source" argument in constructor of Vectara (#11454)
Replace this entire comment with: - **Description:** minor update to constructor to allow for specification of "source" - **Tag maintainer:** @baskaryan - **Twitter handle:** @ofermend
This commit is contained in:
parent
d9018ae5f1
commit
3c7653bf0f
@ -39,6 +39,7 @@ class Vectara(VectorStore):
|
|||||||
vectara_corpus_id: Optional[str] = None,
|
vectara_corpus_id: Optional[str] = None,
|
||||||
vectara_api_key: Optional[str] = None,
|
vectara_api_key: Optional[str] = None,
|
||||||
vectara_api_timeout: int = 60,
|
vectara_api_timeout: int = 60,
|
||||||
|
source: Optional[str] = "langchain",
|
||||||
):
|
):
|
||||||
"""Initialize with Vectara API."""
|
"""Initialize with Vectara API."""
|
||||||
self._vectara_customer_id = vectara_customer_id or os.environ.get(
|
self._vectara_customer_id = vectara_customer_id or os.environ.get(
|
||||||
@ -59,6 +60,8 @@ class Vectara(VectorStore):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
logger.debug(f"Using corpus id {self._vectara_corpus_id}")
|
logger.debug(f"Using corpus id {self._vectara_corpus_id}")
|
||||||
|
self._source = source
|
||||||
|
|
||||||
self._session = requests.Session() # to reuse connections
|
self._session = requests.Session() # to reuse connections
|
||||||
adapter = requests.adapters.HTTPAdapter(max_retries=3)
|
adapter = requests.adapters.HTTPAdapter(max_retries=3)
|
||||||
self._session.mount("http://", adapter)
|
self._session.mount("http://", adapter)
|
||||||
@ -74,7 +77,7 @@ class Vectara(VectorStore):
|
|||||||
"x-api-key": self._vectara_api_key,
|
"x-api-key": self._vectara_api_key,
|
||||||
"customer-id": self._vectara_customer_id,
|
"customer-id": self._vectara_customer_id,
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"X-Source": "langchain",
|
"X-Source": self._source,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _delete_doc(self, doc_id: str) -> bool:
|
def _delete_doc(self, doc_id: str) -> bool:
|
||||||
|
Loading…
Reference in New Issue
Block a user