chore: format

This commit is contained in:
Timothy Jaeryang Baek
2025-02-09 22:20:47 -08:00
parent 426f8f29ad
commit 60095598ec
57 changed files with 387 additions and 42 deletions

View File

@@ -120,18 +120,12 @@ class OpenSearchClient:
return None
query_body = {
"query": {
"bool": {
"filter": []
}
},
"query": {"bool": {"filter": []}},
"_source": ["text", "metadata"],
}
for field, value in filter.items():
query_body["query"]["bool"]["filter"].append({
"term": {field: value}
})
query_body["query"]["bool"]["filter"].append({"term": {field: value}})
size = limit if limit else 10
@@ -139,7 +133,7 @@ class OpenSearchClient:
result = self.client.search(
index=f"{self.index_prefix}_{collection_name}",
body=query_body,
size=size
size=size,
)
return self._result_to_get_result(result)

View File

@@ -25,13 +25,10 @@ def search_jina(api_key: str, query: str, count: int) -> list[SearchResult]:
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": api_key,
"X-Retain-Images": "none"
"X-Retain-Images": "none",
}
payload = {
"q": query,
"count": count if count <= 10 else 10
}
payload = {"q": query, "count": count if count <= 10 else 10}
url = str(URL(jina_search_endpoint))
response = requests.post(url, headers=headers, json=payload)