Skip to content

Commit

Permalink
Merge pull request #13 from FacerAin/feat/retrieval
Browse files Browse the repository at this point in the history
Update endpoint for similarity_search
  • Loading branch information
FacerAin authored Nov 13, 2023
2 parents 791962c + afbc1a6 commit 5533060
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/agent/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
If you don't know the answer, just say that you don't know, don't try to make up an answer.
Users tend to want up-to-date information, so please refer to the current date to answer.
Each context is separated by [SEP]. In most cases, the contents of each context are independent, so choose the most appropriate one and answer.
If you think there are multiple appropriate answers, it’s okay to paste a reference link and a brief explanation at the bottom of the answer.
In situations where the provided context is insufficient, it’s possible to list multiple candidate links to inform the user.
When the context cannot be found, instead of saying that the context was not found, advise the user on suitable alternative actions.
Attach the page link of the corresponding context at the bottom of the answer.
You must answer in Korean.
Expand Down
7 changes: 7 additions & 0 deletions app/api/api_v1/endpoints/chat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fastapi import APIRouter

from app.agent import ChatAgent
from app.agent.retriever import PineconeRetriever
from app.schemas.chat import ResponseAnswer, ReuqestQuery

router = APIRouter()
Expand All @@ -12,3 +13,9 @@
def make_chat(req: ReuqestQuery):
answer = chat_agent.run(req.query)
return {"answer": answer}


@router.get("/similarity-search")
def get_similarity_search(query: str):
retreiver = PineconeRetriever(index_name="khugpt")
return retreiver.get_relevant_doc_string(query)

0 comments on commit 5533060

Please sign in to comment.