Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support similarity_score_threshold retrieval with Chroma #5655

Merged
merged 1 commit into from
Jun 3, 2023

Conversation

jiayao
Copy link
Contributor

@jiayao jiayao commented Jun 3, 2023

Fixes #5067

Verified the following code now works correctly:

db = Chroma(persist_directory=index_directory(index_name), embedding_function=embeddings)
retriever = db.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": 0.4})
docs = retriever.get_relevant_documents(query)

Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thansk!

@hwchase17 hwchase17 added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Jun 3, 2023
@hwchase17 hwchase17 merged commit 6a3ceaa into langchain-ai:master Jun 3, 2023
@zigax1
Copy link

zigax1 commented Jun 6, 2023

Thank you! Really good feature!

What is the range for "score_threshold"? Can you explain a little bit, please?

Is there also an option, to see how much of a score does source have? So I can easily decide what score_threshold should I use?
P.S. I also use Chroma

@jiayao

Undertone0809 pushed a commit to Undertone0809/langchain that referenced this pull request Jun 19, 2023
…i#5655)

Fixes langchain-ai#5067

Verified the following code now works correctly:
```
db = Chroma(persist_directory=index_directory(index_name), embedding_function=embeddings)
retriever = db.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": 0.4})
docs = retriever.get_relevant_documents(query)
```
This was referenced Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConversationalRetrievalChain doesn't return score with sources
3 participants