Skip to content

Commit

Permalink
fix: Query fixes for repeated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorrr committed Sep 19, 2024
1 parent d52bce7 commit 7eddbad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion agents-api/agents_api/clients/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@wraps(_acompletion)
@beartype
async def acompletion(
*, model: str, messages: list[dict], custom_api_key: str = None, **kwargs
*, model: str, messages: list[dict], custom_api_key: None | str = None, **kwargs
) -> ModelResponse | CustomStreamWrapper:

supported_params = get_supported_openai_params(model)
Expand Down
29 changes: 24 additions & 5 deletions agents-api/agents_api/models/docs/search_docs_by_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ def search_docs_by_embedding(
"""

collect_query = """
m[
n[
doc_id,
owner_type,
owner_id,
collect(snippet),
unique(snippet_data),
distance,
title,
] :=
Expand All @@ -209,11 +209,30 @@ def search_docs_by_embedding(
snippet_data,
distance,
title,
}, snippet = {
"index": snippet_data->0,
"content": snippet_data->1,
}
m[
doc_id,
owner_type,
owner_id,
collect(snippet),
distance,
title,
] :=
n[
doc_id,
owner_type,
owner_id,
snippet_data,
distance,
title,
],
snippet = {
"index": snippet_datum->0,
"content": snippet_datum->1
},
snippet_datum in snippet_data
?[
id,
owner_type,
Expand Down

0 comments on commit 7eddbad

Please sign in to comment.