mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-26 06:16:09 +00:00
fix: chroma ruff lint
This commit is contained in:
@@ -79,7 +79,9 @@ class ChromaVectorDatabase(VectorDatabase):
|
|||||||
if filter:
|
if filter:
|
||||||
query_kwargs['where'] = filter
|
query_kwargs['where'] = filter
|
||||||
results = await asyncio.to_thread(col.query, **query_kwargs)
|
results = await asyncio.to_thread(col.query, **query_kwargs)
|
||||||
self.ap.logger.info(f"Chroma vector search in '{collection}' returned {len(results.get('ids', [[]])[0])} results.")
|
self.ap.logger.info(
|
||||||
|
f"Chroma vector search in '{collection}' returned {len(results.get('ids', [[]])[0])} results."
|
||||||
|
)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
async def _full_text_search(
|
async def _full_text_search(
|
||||||
@@ -149,9 +151,7 @@ class ChromaVectorDatabase(VectorDatabase):
|
|||||||
fused_ids = [doc_id for doc_id, _ in fused]
|
fused_ids = [doc_id for doc_id, _ in fused]
|
||||||
|
|
||||||
# Fetch full metadata and documents for fused results
|
# Fetch full metadata and documents for fused results
|
||||||
fetched = await asyncio.to_thread(
|
fetched = await asyncio.to_thread(col.get, ids=fused_ids, include=['metadatas', 'documents'])
|
||||||
col.get, ids=fused_ids, include=['metadatas', 'documents']
|
|
||||||
)
|
|
||||||
|
|
||||||
# col.get returns results in arbitrary order; re-order to match fused ranking
|
# col.get returns results in arbitrary order; re-order to match fused ranking
|
||||||
fetched_map: dict[str, tuple] = {}
|
fetched_map: dict[str, tuple] = {}
|
||||||
@@ -187,7 +187,7 @@ class ChromaVectorDatabase(VectorDatabase):
|
|||||||
|
|
||||||
self.ap.logger.info(
|
self.ap.logger.info(
|
||||||
f"Chroma hybrid search in '{collection}' returned {len(ordered_ids)} results "
|
f"Chroma hybrid search in '{collection}' returned {len(ordered_ids)} results "
|
||||||
f"(vector={len(vector_ids)}, text={len(text_ids)})."
|
f'(vector={len(vector_ids)}, text={len(text_ids)}).'
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
'ids': [ordered_ids],
|
'ids': [ordered_ids],
|
||||||
|
|||||||
Reference in New Issue
Block a user