You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/community/tests/unit_tests/embeddings
Egor Krasheninnikov c8391d4ff1
community[patch]: Fix YandexGPT embeddings (#19720)
Fix of YandexGPT embeddings. 

The current version uses a single `model_name` for queries and
documents, essentially making the `embed_documents` and `embed_query`
methods the same. Yandex has a different endpoint (`model_uri`) for
encoding documents, see
[this](https://yandex.cloud/en/docs/yandexgpt/concepts/embeddings). The
bug may impact retrievers built with `YandexGPTEmbeddings` (for instance
FAISS database as retriever) since they use both `embed_documents` and
`embed_query`.

A simple snippet to test the behaviour:
```python
from langchain_community.embeddings.yandex import YandexGPTEmbeddings
embeddings = YandexGPTEmbeddings()
q_emb = embeddings.embed_query('hello world')
doc_emb = embeddings.embed_documents(['hello world', 'hello world'])
q_emb == doc_emb[0]
```
The response is `True` with the current version and `False` with the
changes I made.


Twitter: @egor_krash

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
4 months ago
..
__init__.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 8 months ago
test_deterministic_embedding.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 8 months ago
test_edenai.py infra: add print rule to ruff (#16221) 6 months ago
test_embaas.py infra: add print rule to ruff (#16221) 6 months ago
test_gradient_ai.py infra: add -p to mkdir in lint steps (#17013) 7 months ago
test_huggingface.py Community[patch]use secret str in Tavily and HuggingFaceInferenceEmbeddings (#16109) 7 months ago
test_imports.py community[patch]: import flattening fix (#20110) 4 months ago
test_infinity.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 8 months ago
test_infinity_local.py community[minor]: infinity embedding local option (#17671) 6 months ago
test_llamafile.py community[minor]: llamafile embeddings support (#17976) 6 months ago
test_llm_rails.py infra: add print rule to ruff (#16221) 6 months ago
test_oci_gen_ai_embedding.py infra: add -p to mkdir in lint steps (#17013) 7 months ago
test_ollama.py community[patch]: OllamaEmbeddings - Pass headers to post request (#16880) 5 months ago
test_openai.py community[patch]: Fix chat openai unit test (#17124) 6 months ago
test_premai.py community[minor]: Prem AI langchain integration (#19113) 5 months ago
test_vertexai.py community[minor]: New model parameters and dynamic batching for VertexAIEmbeddings (#13999) 8 months ago
test_yandex.py community[patch]: Fix YandexGPT embeddings (#19720) 4 months ago