Skip to content

Commit

Permalink
Use a sim score threshold of .5
Browse files Browse the repository at this point in the history
  • Loading branch information
heiko-braun committed Dec 12, 2023
1 parent 388b1e9 commit 9485dc6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def configure_retriever(collection_name):
embeddings=OpenAIEmbeddings())

# top k and threshold settings see https://python.langchain.com/docs/modules/data_connection/retrievers/vectorstore
return qdrant.as_retriever()
return qdrant.as_retriever(
search_type="similarity_score_threshold",
search_kwargs={"score_threshold": .5}
)

comp_ref_tool = create_retriever_tool(
configure_retriever("agent_fuse_comp_ref"),
Expand Down Expand Up @@ -99,7 +102,8 @@ def send_feedback(run_id, score):
with st.chat_message("assistant"):
st_callback = StreamlitCallbackHandler(
parent_container=st.container(),
collapse_completed_thoughts=False
collapse_completed_thoughts=True,
expand_new_thoughts=False
)
response = agent_executor(
{"input": prompt, "history": st.session_state.messages},
Expand Down

0 comments on commit 9485dc6

Please sign in to comment.