Skip to content

Commit

Permalink
more refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
ccheng26 committed Apr 4, 2024
1 parent 59bdefe commit eab0eba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions 02-household-queries/chainlit-household-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ async def message_submitted(message: cl.Message):
# 3. Use LlmPrompts lp.register_answer

# Reminder to use make_async for long running tasks: https://docs.chainlit.io/guides/sync-async#long-running-synchronous-tasks
# If options `streaming` and `use_vector_db` are set the RAG chain will not be called
# If options `streaming` is set, or `use_vector_db` is not set, the RAG chain will not be called
if settings["streaming"]:
if settings["use_vector_db"]:
await cl.Message("Change the setting to use non-streaming instead").send()
Expand All @@ -256,7 +256,7 @@ async def message_submitted(message: cl.Message):
if settings["use_vector_db"] and vectordb:
await retrieval_function(vectordb=vectordb, llm=client)
response = retrieval_call(client, vectordb, message.content)
answer = f"Result: {response['result']} \nSources: {response['source_documents'][0].metadata}"
answer = f"Result: {response['result']} \nSources: \n" + "\n".join([doc.metadata for doc in response['source_documents']])
await cl.Message(content=answer).send()
else:
response = call_llm(message)
Expand Down
2 changes: 1 addition & 1 deletion 02-household-queries/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def retrieval_call(llm, vectordb, question):

)

print("Please state your question here: ")
# question = os.environ.get("USER_QUERY")
if question == None:
print("Please state your question here: ")
question = input()
# Invoke the retrieval chain
response=retrieval_chain.invoke({"query":question})
Expand Down

0 comments on commit eab0eba

Please sign in to comment.