langchain/libs/community/tests/unit_tests/embeddings
Aubrey Ford 23f701b08e
langchain_community: OpenAIEmbeddings not respecting chunk_size argument (#30946)
This is a follow-on PR to go with the identical changes that were made
in parters/openai.

Previous PR:  https://github.com/langchain-ai/langchain/pull/30757

When calling embed_documents and providing a chunk_size argument, that
argument is ignored when OpenAIEmbeddings is instantiated with its
default configuration (where check_embedding_ctx_length=True).

_get_len_safe_embeddings specifies a chunk_size parameter but it's not
being passed through in embed_documents, which is its only caller. This
appears to be an oversight, especially given that the
_get_len_safe_embeddings docstring states it should respect "the set
embedding context length and chunk size."

Developers typically expect method parameters to take effect (also, take
precedence) when explicitly provided, especially when instantiating
using defaults. I was confused as to why my API calls were being
rejected regardless of the chunk size I provided.
2025-04-21 08:39:07 -04:00
..
__init__.py
test_baichuan.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_deterministic_embedding.py community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
test_edenai.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_embaas.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_gpt4all.py community: Fix ValidationError on creating GPT4AllEmbeddings with no gpt4all_kwargs (#25124) 2024-08-07 13:34:01 +00:00
test_gradient_ai.py community[patch]: Add missing annotations (#24890) 2024-07-31 18:13:44 +00:00
test_huggingface.py community[patch]: upgrade to recent version of mypy (#21616) 2024-05-13 14:55:07 -04:00
test_imports.py community: support Hunyuan Embedding (#23160) 2024-12-16 19:27:19 +00:00
test_infinity_local.py multiple: rely on asyncio_mode auto in tests (#27200) 2024-10-15 16:26:38 +00:00
test_infinity.py
test_llamacpp.py community: Repair embeddings/llamacpp's embed_query method (#29935) 2025-02-23 19:32:17 +00:00
test_llamafile.py
test_llm_rails.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_model2vec.py community[minor]: Add support for modle2vec embeddings (#28507) 2024-12-09 02:17:22 +00:00
test_naver.py community: Add Naver chat model & embeddings (#25162) 2024-10-24 20:54:13 +00:00
test_oci_gen_ai_embedding.py community: Bump ruff version to 0.9 (#29206) 2025-02-08 01:21:10 +00:00
test_ollama.py community[patch]: Add missing annotations (#24890) 2024-07-31 18:13:44 +00:00
test_openai.py langchain_community: OpenAIEmbeddings not respecting chunk_size argument (#30946) 2025-04-21 08:39:07 -04:00
test_ovhcloud.py community: Fix OVHcloud 401 Unauthorized on embedding. (#23260) 2024-06-24 12:58:32 -04:00
test_premai.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_sparkllm.py multiple: pydantic 2 compatibility, v0.3 (#26443) 2024-09-13 14:38:45 -07:00
test_vertexai.py infra: update mypy 1.10, ruff 0.5 (#23721) 2024-07-03 10:33:27 -07:00
test_yandex.py comminity[patch]: fix #25575 YandexGPTs for _grpc_metadata (#25617) 2024-08-28 18:48:10 -07:00