Skip to content

Commit

Permalink
fix: set http_compress=False default for
Browse files Browse the repository at this point in the history
  • Loading branch information
bearjobsniper committed May 13, 2024
1 parent d740b83 commit caaea4f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/vanna/opensearch/opensearch_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,19 @@ def __init__(self, config=None):
else:
max_retries = 10

if config is not None and "es_http_compress" in config:
es_http_compress = config["es_http_compress"]
else:
es_http_compress = False

print("OpenSearch_VectorStore initialized with es_urls: ", es_urls,
" host: ", host, " port: ", port, " ssl: ", ssl, " verify_certs: ",
verify_certs, " timeout: ", timeout, " max_retries: ", max_retries)
if es_urls is not None:
# Initialize the OpenSearch client by passing a list of URLs
self.client = OpenSearch(
hosts=[es_urls],
http_compress=True,
http_compress=es_http_compress,
use_ssl=ssl,
verify_certs=verify_certs,
timeout=timeout,
Expand All @@ -175,7 +180,7 @@ def __init__(self, config=None):
# Initialize the OpenSearch client by passing a host and port
self.client = OpenSearch(
hosts=[{'host': host, 'port': port}],
http_compress=True,
http_compress=es_http_compress,
use_ssl=ssl,
verify_certs=verify_certs,
timeout=timeout,
Expand Down Expand Up @@ -267,6 +272,7 @@ def get_related_ddl(self, question: str, **kwargs) -> List[str]:
}
}
}
print(query)
response = self.client.search(index=self.ddl_index, body=query,
**kwargs)
return [hit['_source']['ddl'] for hit in response['hits']['hits']]
Expand All @@ -279,6 +285,7 @@ def get_related_documentation(self, question: str, **kwargs) -> List[str]:
}
}
}
print(query)
response = self.client.search(index=self.document_index,
body=query,
**kwargs)
Expand All @@ -292,6 +299,7 @@ def get_similar_question_sql(self, question: str, **kwargs) -> List[str]:
}
}
}
print(query)
response = self.client.search(index=self.question_sql_index,
body=query,
**kwargs)
Expand All @@ -307,6 +315,7 @@ def get_training_data(self, **kwargs) -> pd.DataFrame:
body={"query": {"match_all": {}}},
size=1000
)
print(query)
# records = [hit['_source'] for hit in response['hits']['hits']]
for hit in response['hits']['hits']:
data.append(
Expand Down

0 comments on commit caaea4f

Please sign in to comment.