Skip to content

Commit

Permalink
rework to accommodate sync requests
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed Oct 10, 2024
1 parent 823a02e commit c92ca66
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/main/lib/text_similarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ def async_search_text(task, modality):
return elastic_crud.get_async_presto_response(task, "text", modality)

def sync_search_text(task, modality):
import code;code.interact(local=dict(globals(), **locals()))
obj, temporary, context, presto_result = elastic_crud.get_blocked_presto_response(task, "text", modality)
obj["models"] = ["elasticsearch"]
if isinstance(presto_result, list):
for presto_vector_result in presto_result:
obj['vector_'+presto_vector_result["model"]] = presto_vector_result["response"]["body"]["result"]
obj['model_'+presto_vector_result["model"]] = 1
obj["models"].append(presto_vector_result["model"])
document, _ = elastic_crud.get_object(obj, "text")
return search_text(document, True)

Expand Down

0 comments on commit c92ca66

Please sign in to comment.