langchain-core 0.3.70__tar.gz → 0.3.71__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of langchain-core might be problematic. Click here for more details.
- {langchain_core-0.3.70 → langchain_core-0.3.71}/PKG-INFO +1 -1
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/chat_models.py +33 -16
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/config.py +1 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/__init__.py +8 -1
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/strings.py +23 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/version.py +1 -1
- {langchain_core-0.3.70 → langchain_core-0.3.71}/pyproject.toml +1 -1
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/chat_models/test_base.py +49 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_imports.py +1 -0
- langchain_core-0.3.71/tests/unit_tests/utils/test_strings.py +49 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/README.md +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/_api/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/_api/beta_decorator.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/_api/deprecation.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/_api/internal.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/_api/path.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/_import_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/agents.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/beta/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/beta/runnables/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/beta/runnables/context.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/caches.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/file.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/manager.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/stdout.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/streaming_stdout.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/usage.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/chat_history.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/chat_loaders.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/chat_sessions.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/document_loaders/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/document_loaders/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/document_loaders/blob_loaders.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/document_loaders/langsmith.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/documents/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/documents/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/documents/compressor.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/documents/transformers.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/embeddings/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/embeddings/embeddings.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/embeddings/fake.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/env.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/example_selectors/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/example_selectors/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/example_selectors/length_based.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/example_selectors/semantic_similarity.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/exceptions.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/globals.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/indexing/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/indexing/api.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/indexing/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/indexing/in_memory.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/fake.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/fake_chat_models.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/llms.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/load/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/load/dump.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/load/load.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/load/mapping.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/load/serializable.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/memory.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/ai.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/chat.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/content_blocks.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/function.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/human.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/modifier.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/system.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/tool.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/messages/utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/format_instructions.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/json.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/list.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/openai_functions.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/openai_tools.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/pydantic.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/string.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/transform.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/xml.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/outputs/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/outputs/chat_generation.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/outputs/chat_result.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/outputs/generation.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/outputs/llm_result.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/outputs/run_info.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompt_values.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/chat.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/dict.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/few_shot.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/few_shot_with_templates.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/image.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/loading.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/message.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/pipeline.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/prompt.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/string.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/structured.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/py.typed +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/pydantic_v1/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/pydantic_v1/dataclasses.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/pydantic_v1/main.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/rate_limiters.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/retrievers.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/branch.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/configurable.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/fallbacks.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/graph.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/graph_ascii.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/graph_mermaid.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/graph_png.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/history.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/passthrough.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/retry.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/router.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/schema.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/runnables/utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/stores.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/structured_query.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/sys_info.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/convert.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/render.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/retriever.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/simple.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tools/structured.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/_streaming.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/context.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/core.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/evaluation.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/event_stream.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/langchain.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/langchain_v1.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/log_stream.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/memory_stream.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/root_listeners.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/run_collector.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/schemas.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/tracers/stdout.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/_merge.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/aiter.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/env.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/formatting.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/function_calling.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/html.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/image.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/input.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/interactive_env.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/iter.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/json.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/json_schema.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/loading.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/mustache.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/pydantic.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/usage.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/utils/utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/vectorstores/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/vectorstores/base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/vectorstores/in_memory.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/vectorstores/utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/benchmarks/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/benchmarks/test_async_callbacks.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/benchmarks/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/integration_tests/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/integration_tests/test_compile.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/_api/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/_api/test_beta_decorator.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/_api/test_deprecation.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/_api/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/_api/test_path.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/caches/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/caches/test_in_memory_cache.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/callbacks/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/callbacks/test_async_callback_manager.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/callbacks/test_dispatch_custom_event.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/callbacks/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/callbacks/test_sync_callback_manager.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/callbacks/test_usage_callback.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/chat_history/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/chat_history/test_chat_history.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/conftest.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/data/prompt_file.txt +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/data/prompts/prompt_extra_args.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/data/prompts/prompt_missing_args.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/data/prompts/simple_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/dependencies/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/dependencies/test_dependencies.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/document_loaders/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/document_loaders/test_base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/document_loaders/test_langsmith.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/documents/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/documents/test_document.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/documents/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/documents/test_str.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/embeddings/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/embeddings/test_deterministic_embedding.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/example_selectors/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/example_selectors/test_base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/example_selectors/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/example_selectors/test_length_based_example_selector.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/example_selectors/test_similarity.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/example-non-utf8.csv +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/example-non-utf8.txt +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/example-utf8.csv +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/example-utf8.txt +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/example_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/examples.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/examples.yaml +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/few_shot_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/few_shot_prompt.yaml +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/few_shot_prompt_example_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/few_shot_prompt_examples_in.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/jinja_injection_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/jinja_injection_prompt.yaml +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/prompt_with_output_parser.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/simple_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/simple_prompt.yaml +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/simple_prompt_with_template_file.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/examples/simple_template.txt +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/fake/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/fake/callbacks.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/fake/test_fake_chat_model.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/indexing/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/indexing/test_hashed_document.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/indexing/test_in_memory_indexer.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/indexing/test_in_memory_record_manager.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/indexing/test_indexing.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/indexing/test_public_api.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/chat_models/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/chat_models/test_benchmark.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/chat_models/test_cache.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/chat_models/test_rate_limiting.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/llms/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/llms/test_base.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/llms/test_cache.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/language_models/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/load/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/load/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/load/test_serializable.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/messages/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/messages/test_ai.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/messages/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/messages/test_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_base_parsers.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_json.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_list_parser.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_openai_functions.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_openai_tools.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_pydantic_parser.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/output_parsers/test_xml_parser.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/outputs/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/outputs/test_chat_generation.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/outputs/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompt_file.txt +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/__snapshots__/test_prompt.ambr +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/prompt_extra_args.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/prompt_missing_args.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/simple_prompt.json +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_chat.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_dict.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_few_shot.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_few_shot_with_templates.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_image.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_loading.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_pipeline_prompt.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_prompt.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_structured.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/prompts/test_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/pydantic_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/rate_limiters/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/rate_limiters/test_in_memory_rate_limiter.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_concurrency.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_config.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_configurable.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_context.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_fallbacks.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_graph.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_history.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_runnable.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_runnable_events_v1.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_runnable_events_v2.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_tracing_interops.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/runnables/test_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/stores/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/stores/test_in_memory.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/stubs.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_globals.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_messages.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_outputs.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_prompt_values.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_pydantic_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_pydantic_serde.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_retrievers.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_setup.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_sys_info.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/test_tools.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_async_base_tracer.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_base_tracer.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_imports.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_langchain.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_memory_stream.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_run_collector.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/tracers/test_schemas.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_aiter.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_env.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_function_calling.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_html.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_iter.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_json_schema.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_pydantic.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_rm_titles.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_usage.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/utils/test_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/vectorstores/__init__.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/vectorstores/test_in_memory.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/vectorstores/test_utils.py +0 -0
- {langchain_core-0.3.70 → langchain_core-0.3.71}/tests/unit_tests/vectorstores/test_vectorstore.py +0 -0
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/chat_models.py
RENAMED
|
@@ -111,8 +111,9 @@ def _generate_response_from_error(error: BaseException) -> list[ChatGeneration]:
|
|
|
111
111
|
def _format_for_tracing(messages: list[BaseMessage]) -> list[BaseMessage]:
|
|
112
112
|
"""Format messages for tracing in on_chat_model_start.
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
- Update image content blocks to OpenAI Chat Completions format (backward
|
|
115
|
+
compatibility).
|
|
116
|
+
- Add "type" key to content blocks that have a single key.
|
|
116
117
|
|
|
117
118
|
Args:
|
|
118
119
|
messages: List of messages to format.
|
|
@@ -125,20 +126,36 @@ def _format_for_tracing(messages: list[BaseMessage]) -> list[BaseMessage]:
|
|
|
125
126
|
message_to_trace = message
|
|
126
127
|
if isinstance(message.content, list):
|
|
127
128
|
for idx, block in enumerate(message.content):
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
message_to_trace
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
129
|
+
if isinstance(block, dict):
|
|
130
|
+
# Update image content blocks to OpenAI # Chat Completions format.
|
|
131
|
+
if (
|
|
132
|
+
block.get("type") == "image"
|
|
133
|
+
and is_data_content_block(block)
|
|
134
|
+
and block.get("source_type") != "id"
|
|
135
|
+
):
|
|
136
|
+
if message_to_trace is message:
|
|
137
|
+
# Shallow copy
|
|
138
|
+
message_to_trace = message.model_copy()
|
|
139
|
+
message_to_trace.content = list(message_to_trace.content)
|
|
140
|
+
|
|
141
|
+
message_to_trace.content[idx] = ( # type: ignore[index] # mypy confused by .model_copy
|
|
142
|
+
convert_to_openai_image_block(block)
|
|
143
|
+
)
|
|
144
|
+
elif len(block) == 1 and "type" not in block:
|
|
145
|
+
# Tracing assumes all content blocks have a "type" key. Here
|
|
146
|
+
# we add this key if it is missing, and there's an obvious
|
|
147
|
+
# choice for the type (e.g., a single key in the block).
|
|
148
|
+
if message_to_trace is message:
|
|
149
|
+
# Shallow copy
|
|
150
|
+
message_to_trace = message.model_copy()
|
|
151
|
+
message_to_trace.content = list(message_to_trace.content)
|
|
152
|
+
key = next(iter(block))
|
|
153
|
+
message_to_trace.content[idx] = { # type: ignore[index]
|
|
154
|
+
"type": key,
|
|
155
|
+
key: block[key],
|
|
156
|
+
}
|
|
157
|
+
else:
|
|
158
|
+
pass
|
|
142
159
|
messages_to_trace.append(message_to_trace)
|
|
143
160
|
|
|
144
161
|
return messages_to_trace
|
|
@@ -230,6 +230,7 @@ def ensure_config(config: Optional[RunnableConfig] = None) -> RunnableConfig:
|
|
|
230
230
|
not key.startswith("__")
|
|
231
231
|
and isinstance(value, (str, int, float, bool))
|
|
232
232
|
and key not in empty["metadata"]
|
|
233
|
+
and key != "api_key"
|
|
233
234
|
):
|
|
234
235
|
empty["metadata"][key] = value
|
|
235
236
|
return empty
|
|
@@ -23,7 +23,12 @@ if TYPE_CHECKING:
|
|
|
23
23
|
from langchain_core.utils.iter import batch_iterate
|
|
24
24
|
from langchain_core.utils.loading import try_load_from_hub
|
|
25
25
|
from langchain_core.utils.pydantic import pre_init
|
|
26
|
-
from langchain_core.utils.strings import
|
|
26
|
+
from langchain_core.utils.strings import (
|
|
27
|
+
comma_list,
|
|
28
|
+
sanitize_for_postgres,
|
|
29
|
+
stringify_dict,
|
|
30
|
+
stringify_value,
|
|
31
|
+
)
|
|
27
32
|
from langchain_core.utils.utils import (
|
|
28
33
|
build_extra_kwargs,
|
|
29
34
|
check_package_version,
|
|
@@ -59,6 +64,7 @@ __all__ = (
|
|
|
59
64
|
"pre_init",
|
|
60
65
|
"print_text",
|
|
61
66
|
"raise_for_status_with_text",
|
|
67
|
+
"sanitize_for_postgres",
|
|
62
68
|
"secret_from_env",
|
|
63
69
|
"stringify_dict",
|
|
64
70
|
"stringify_value",
|
|
@@ -81,6 +87,7 @@ _dynamic_imports = {
|
|
|
81
87
|
"try_load_from_hub": "loading",
|
|
82
88
|
"pre_init": "pydantic",
|
|
83
89
|
"comma_list": "strings",
|
|
90
|
+
"sanitize_for_postgres": "strings",
|
|
84
91
|
"stringify_dict": "strings",
|
|
85
92
|
"stringify_value": "strings",
|
|
86
93
|
"build_extra_kwargs": "utils",
|
|
@@ -46,3 +46,26 @@ def comma_list(items: list[Any]) -> str:
|
|
|
46
46
|
str: The comma-separated string.
|
|
47
47
|
"""
|
|
48
48
|
return ", ".join(str(item) for item in items)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def sanitize_for_postgres(text: str, replacement: str = "") -> str:
|
|
52
|
+
r"""Sanitize text by removing NUL bytes that are incompatible with PostgreSQL.
|
|
53
|
+
|
|
54
|
+
PostgreSQL text fields cannot contain NUL (0x00) bytes, which can cause
|
|
55
|
+
psycopg.DataError when inserting documents. This function removes or replaces
|
|
56
|
+
such characters to ensure compatibility.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
text: The text to sanitize.
|
|
60
|
+
replacement: String to replace NUL bytes with. Defaults to empty string.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
str: The sanitized text with NUL bytes removed or replaced.
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
>>> sanitize_for_postgres("Hello\\x00world")
|
|
67
|
+
'Helloworld'
|
|
68
|
+
>>> sanitize_for_postgres("Hello\\x00world", " ")
|
|
69
|
+
'Hello world'
|
|
70
|
+
"""
|
|
71
|
+
return text.replace("\x00", replacement)
|
|
@@ -467,6 +467,55 @@ def test_trace_images_in_openai_format() -> None:
|
|
|
467
467
|
]
|
|
468
468
|
|
|
469
469
|
|
|
470
|
+
def test_trace_content_blocks_with_no_type_key() -> None:
|
|
471
|
+
"""Test that we add a ``type`` key to certain content blocks that don't have one."""
|
|
472
|
+
llm = ParrotFakeChatModel()
|
|
473
|
+
messages = [
|
|
474
|
+
{
|
|
475
|
+
"role": "user",
|
|
476
|
+
"content": [
|
|
477
|
+
{
|
|
478
|
+
"type": "text",
|
|
479
|
+
"text": "Hello",
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"cachePoint": {"type": "default"},
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
}
|
|
486
|
+
]
|
|
487
|
+
tracer = FakeChatModelStartTracer()
|
|
488
|
+
response = llm.invoke(messages, config={"callbacks": [tracer]})
|
|
489
|
+
assert tracer.messages == [
|
|
490
|
+
[
|
|
491
|
+
[
|
|
492
|
+
HumanMessage(
|
|
493
|
+
[
|
|
494
|
+
{
|
|
495
|
+
"type": "text",
|
|
496
|
+
"text": "Hello",
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"type": "cachePoint",
|
|
500
|
+
"cachePoint": {"type": "default"},
|
|
501
|
+
},
|
|
502
|
+
]
|
|
503
|
+
)
|
|
504
|
+
]
|
|
505
|
+
]
|
|
506
|
+
]
|
|
507
|
+
# Test no mutation
|
|
508
|
+
assert response.content == [
|
|
509
|
+
{
|
|
510
|
+
"type": "text",
|
|
511
|
+
"text": "Hello",
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"cachePoint": {"type": "default"},
|
|
515
|
+
},
|
|
516
|
+
]
|
|
517
|
+
|
|
518
|
+
|
|
470
519
|
def test_extend_support_to_openai_multimodal_formats() -> None:
|
|
471
520
|
"""Test that chat models normalize OpenAI file and audio inputs."""
|
|
472
521
|
llm = ParrotFakeChatModel()
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Test string utilities."""
|
|
2
|
+
|
|
3
|
+
from langchain_core.utils.strings import (
|
|
4
|
+
comma_list,
|
|
5
|
+
sanitize_for_postgres,
|
|
6
|
+
stringify_dict,
|
|
7
|
+
stringify_value,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_sanitize_for_postgres() -> None:
|
|
12
|
+
"""Test sanitizing text for PostgreSQL compatibility."""
|
|
13
|
+
# Test with NUL bytes
|
|
14
|
+
text_with_nul = "Hello\x00world\x00test"
|
|
15
|
+
expected = "Helloworldtest"
|
|
16
|
+
assert sanitize_for_postgres(text_with_nul) == expected
|
|
17
|
+
|
|
18
|
+
# Test with replacement character
|
|
19
|
+
expected_with_replacement = "Hello world test"
|
|
20
|
+
assert sanitize_for_postgres(text_with_nul, " ") == expected_with_replacement
|
|
21
|
+
|
|
22
|
+
# Test with text without NUL bytes
|
|
23
|
+
clean_text = "Hello world"
|
|
24
|
+
assert sanitize_for_postgres(clean_text) == clean_text
|
|
25
|
+
|
|
26
|
+
# Test empty string
|
|
27
|
+
assert sanitize_for_postgres("") == ""
|
|
28
|
+
|
|
29
|
+
# Test with multiple consecutive NUL bytes
|
|
30
|
+
text_with_multiple_nuls = "Hello\x00\x00\x00world"
|
|
31
|
+
assert sanitize_for_postgres(text_with_multiple_nuls) == "Helloworld"
|
|
32
|
+
assert sanitize_for_postgres(text_with_multiple_nuls, "-") == "Hello---world"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_existing_string_functions() -> None:
|
|
36
|
+
"""Test existing string functions still work."""
|
|
37
|
+
# Test comma_list
|
|
38
|
+
assert comma_list([1, 2, 3]) == "1, 2, 3"
|
|
39
|
+
assert comma_list(["a", "b", "c"]) == "a, b, c"
|
|
40
|
+
|
|
41
|
+
# Test stringify_value
|
|
42
|
+
assert stringify_value("hello") == "hello"
|
|
43
|
+
assert stringify_value(42) == "42"
|
|
44
|
+
|
|
45
|
+
# Test stringify_dict
|
|
46
|
+
data = {"key": "value", "number": 123}
|
|
47
|
+
result = stringify_dict(data)
|
|
48
|
+
assert "key: value" in result
|
|
49
|
+
assert "number: 123" in result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/callbacks/streaming_stdout.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/document_loaders/blob_loaders.py
RENAMED
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/document_loaders/langsmith.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/example_selectors/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/example_selectors/length_based.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/language_models/fake_chat_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/format_instructions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/openai_functions.py
RENAMED
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/output_parsers/openai_tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_core-0.3.70 → langchain_core-0.3.71}/langchain_core/prompts/few_shot_with_templates.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|