Skip to content

Commit

Permalink
Merge pull request #22 from K3A-Team/enhanced-search
Browse files Browse the repository at this point in the history
enhanced the nlp search
  • Loading branch information
4zz0u4k authored Aug 23, 2024
2 parents ab401ab + e70c4e9 commit 90d9be1
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 90d9be1

Please sign in to comment.