Skip to content

Commit

Permalink
Merge pull request #51 from FloRul/feature/prompt_inspection
Browse files Browse the repository at this point in the history
Refactor prepare_document_prompt function and add final_prompt to lam…
  • Loading branch information
FloRul authored Feb 29, 2024
2 parents 1ca1196 + ee7c2c6 commit 8f438a8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lambdas/inference/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def prepare_prompt(query: str, docs: list, history: list, source: str):


def prepare_document_prompt(docs):
if docs:
if len(docs) > 0:
docs_context = ".\n".join(doc[0].page_content for doc in docs)
return f"Here is a set of quotes between <quotes></quotes> XML tags to help you answer: <quotes>{docs_context}</quotes>."
return "I could not find any relevant quotes to help you answer the user's query."
Expand Down Expand Up @@ -99,7 +99,7 @@ def lambda_handler(event, context):
response = "this is a dummy response"
source = event.get("queryStringParameters", {}).get("source", "message")
embedding_collection_name = event["queryStringParameters"]["collectionName"]

enable_history = False
if "sessionId" in event["queryStringParameters"]:
enable_history = True
Expand Down Expand Up @@ -130,6 +130,7 @@ def lambda_handler(event, context):
)
result = {
"completion": response,
"final_prompt": prompt,
"docs": json.dumps(
list(
map(
Expand Down

0 comments on commit 8f438a8

Please sign in to comment.