Skip to content

Commit

Permalink
enhanced the nlp search
Browse files Browse the repository at this point in the history
  • Loading branch information
4zz0u4k committed Aug 23, 2024
1 parent ab401ab commit e70c4e9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/services/searchService.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from langchain_pinecone import PineconeVectorStore
from langchain.prompts import ChatPromptTemplate
from langchain_openai import OpenAIEmbeddings
from Core.Shared.Database import db

# Search and model params
MODEL_TEMP = 0.0
Expand Down Expand Up @@ -160,9 +161,13 @@ def search_service(query : str,userID : str):
classification_result = gemini_model.invoke(llm_prompt)

if '1' in classification_result.content:
return name_search_service(query=query,userID=userID)
unique_ids = name_search_service(query=query,userID=userID)
else :
return nlp_search_service(query=query,userID=userID)
unique_ids = nlp_search_service(query=query,userID=userID)
# Ftech the files
file_refs = db.collection('files').where("id", 'in', unique_ids).stream()
files = [file.to_dict() for file in file_refs]
return files

#--------------------------------------------

Expand Down

0 comments on commit e70c4e9

Please sign in to comment.