Skip to content

Commit

Permalink
Merge pull request #44 from FloRul/fix/email-source
Browse files Browse the repository at this point in the history
Fix/email source
  • Loading branch information
FloRul authored Feb 22, 2024
2 parents 0965306 + 39e803a commit db252eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lambdas/inference/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def prepare_source_prompt(source: str):
if source == "email":
return "You are currently answering an email. After you finish answering the initial query anticipate the user's follow-up questions and answer it too up to 4 questions."
return "You are currently answering an email so your answer can be more detailed. After you finish answering the initial query generate follow-up questions and answer it too up to 4 questions."
elif source == "call":
return "Make your answer short and concise."
else:
Expand Down Expand Up @@ -40,9 +40,9 @@ def prepare_prompt(query: str, docs: list, history: list, source: str):
history_prompt = prepare_history_prompt(history)
source_prompt = prepare_source_prompt(source)
final_prompt = f"""{basic_prompt}\n
{source_prompt}\n
{document_prompt}\n
{history_prompt}\n
{source_prompt}\n
{ENV_VARS['system_prompt']}\n
\nAssistant:"""
print(final_prompt)
Expand Down
3 changes: 2 additions & 1 deletion lambdas/inference/src/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def __init__(
def fetch_documents(self, query: str, top_k: int = 10):
try:
docs = self._vector_store.similarity_search_with_relevance_scores(
query=query, k=top_k
query=query,
k=top_k,
)
return [x for x in docs if x[1] > self._relevance_treshold]
except Exception as e:
Expand Down

0 comments on commit db252eb

Please sign in to comment.