Redis-Workshops icon indicating copy to clipboard operation
Redis-Workshops copied to clipboard

langchain.vectorstores.redis.base:score_threshold is deprecated

Open antonum opened this issue 2 years ago • 1 comments

Langchain-based notebooks display the following warning:

WARNING:langchain.vectorstores.redis.base:score_threshold is deprecated. Use distance_threshold instead.score_threshold should only be used in similarity_search_with_relevance_scores.score_threshold will be removed in a future release.

The following change would remove the warning:

# retriever=redis.as_retriever()
retriever=redis.as_retriever(search_type="similarity_distance_threshold",search_kwargs={"distance_threshold":0.5}),

Open questions:

  • What are the reasonable defaults for distance_threshold?
  • Any other defaults such as "k":5 worth adding?

antonum avatar Oct 17 '23 20:10 antonum

I too received that warning and modified the code like you did. I realized that I had to experiment with different values of "distance_threshold" and "k". In my case a value of 0.9 and "k" = 3 with some guardrails in the prompt to prevent hallucination seemed to work. I would encourage you to try different values and see what works for you !

code2k13 avatar Jan 10 '24 07:01 code2k13