Skip to content

Commit

Permalink
Bring back client attribute on ElasticsearchStore (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjakob authored May 16, 2024
1 parent fd84e71 commit 87b82f5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions libs/elasticsearch/langchain_elasticsearch/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ def __init__(
)

self.embedding = embedding
self.client = self._store.client
self._embedding_service = embedding_service
self.query_field = query_field
self.vector_query_field = vector_query_field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def assert_query(
)

# 2. check query result is okay
es_output = docsearch._store.client.search(
es_output = docsearch.client.search(
index=index_name,
query={
"bool": {
Expand Down
2 changes: 1 addition & 1 deletion libs/elasticsearch/tests/unit_tests/test_vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def dummy_custom_query(query_body: dict, query: Optional[str]) -> Dict[str, Any]
return {"dummy": "query"}

def test_agent_header(self, store: ElasticsearchStore) -> None:
agent = store._store.client._headers["User-Agent"]
agent = store.client._headers["User-Agent"]
assert (
re.match(r"^langchain-py-vs/\d+\.\d+\.\d+(?:rc\d+)?$", agent) is not None
), f"The string '{agent}' does not match the expected pattern."
Expand Down

0 comments on commit 87b82f5

Please sign in to comment.