langchain/langchain
vowelparrot 4ffc58e07b
Add similarity_search_with_normalized_similarities (#2916)
Add a method that exposes a similarity search with corresponding
normalized similarity scores. Implement only for FAISS now.

### Motivation:

Some memory definitions combine `relevance` with other scores, like
recency , importance, etc.

While many (but not all) of the `VectorStore`'s expose a
`similarity_search_with_score` method, they don't all interpret the
units of that score (depends on the distance metric and whether or not
the the embeddings are normalized).

This PR proposes a `similarity_search_with_normalized_similarities`
method that lets consumers of the vector store not have to worry about
the metric and embedding scale.

*Most providers default to euclidean distance, with Pinecone being one
exception (defaults to cosine _similarity_).*

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-04-15 21:06:08 -07:00
..
agents Update reduce_openapi_spec for PATCH and DELETE (#2861) 2023-04-13 20:27:40 -07:00
callbacks Comet callback updates (#2889) 2023-04-14 13:19:58 -07:00
chains Move PythonRepl -> langchain.utilities (#2917) 2023-04-15 10:50:25 -07:00
chat_models Fix ChatAnthropic stop_sequences error (#2919) (#2920) 2023-04-14 17:22:01 -07:00
docstore Harrison/retrieval code (#1916) 2023-03-22 23:15:04 -07:00
document_loaders Add title, lang, description to Web loader document metadata (#2955) 2023-04-15 16:07:08 -07:00
embeddings Minor: Remove duplicated word in error message (#2706) 2023-04-11 13:10:33 -07:00
evaluation Improve eval chain prompt (#2798) 2023-04-12 17:05:20 -07:00
graphs Minor: Remove duplicated word in error message (#2706) 2023-04-11 13:10:33 -07:00
indexes Fix typo in VectorStoreIndexWrapper method (#1922) 2023-03-23 07:08:04 -07:00
llms Fix wrong token counts from get_num_tokens from openai llms (#2952) 2023-04-15 16:09:17 -07:00
memory Harrison/retriever memory (#2804) 2023-04-13 10:03:43 -07:00
output_parsers Add type inference for output parsers (#2769) 2023-04-12 09:12:20 -07:00
prompts Fix small typo in SemanticSimilarityExampleSelector (#2629) 2023-04-09 12:53:02 -07:00
retrievers SVM retriever (#2947) (#2949) 2023-04-15 12:49:59 -07:00
tools Move PythonRepl -> langchain.utilities (#2917) 2023-04-15 10:50:25 -07:00
utilities Move PythonRepl -> langchain.utilities (#2917) 2023-04-15 10:50:25 -07:00
vectorstores Add similarity_search_with_normalized_similarities (#2916) 2023-04-15 21:06:08 -07:00
__init__.py Harrison/llama (#2314) 2023-04-02 14:57:45 -07:00
cache.py Harrison/gpt cache (#2744) 2023-04-12 14:16:58 -07:00
docker-compose.yaml add tracing support to langchain (#741) 2023-01-26 17:38:13 -08:00
example_generator.py Harrison/improve cache (#368) 2022-12-18 16:22:42 -05:00
formatting.py initial commit 2022-10-24 14:51:15 -07:00
input.py Add asyncio support for LLM (OpenAI), Chain (LLMChain, LLMMathChain), and Agent (#841) 2023-02-07 21:21:57 -08:00
model_laboratory.py Harrison/improve cache (#368) 2022-12-18 16:22:42 -05:00
py.typed Add py.typed marker to package (#121) 2022-11-12 11:22:32 -08:00
python.py Move PythonRepl -> langchain.utilities (#2917) 2023-04-15 10:50:25 -07:00
requests.py fixed aiohttp.client_exceptions.ClientConnectionError: Connection closed (#2718) 2023-04-11 10:52:55 -07:00
schema.py Add type inference for output parsers (#2769) 2023-04-12 09:12:20 -07:00
serpapi.py move serpapi wrapper (#1199) 2023-02-20 21:15:45 -08:00
server.py Fix missing docker-compose (#2899) 2023-04-15 16:05:11 -07:00
sql_database.py Harrison/table index (#2526) 2023-04-06 23:03:09 -07:00
text_splitter.py Minor: Remove duplicated word in error message (#2706) 2023-04-11 13:10:33 -07:00
utils.py Harrison/bing wrapper (#656) 2023-01-19 14:48:30 -08:00