langchain-core 1.0.0a3__tar.gz → 1.0.0a4__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.
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/PKG-INFO +1 -1
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/chat_models.py +6 -5
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/base.py +4 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/anthropic.py +8 -6
- langchain_core-1.0.0a4/langchain_core/messages/block_translators/bedrock.py +94 -0
- langchain_core-1.0.0a4/langchain_core/messages/block_translators/bedrock_converse.py +283 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/version.py +1 -1
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/pyproject.toml +1 -1
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/chat_models/test_base.py +40 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/block_translators/test_anthropic.py +5 -0
- langchain_core-1.0.0a4/tests/unit_tests/messages/block_translators/test_bedrock.py +407 -0
- langchain_core-1.0.0a4/tests/unit_tests/messages/block_translators/test_bedrock_converse.py +381 -0
- langchain_core-1.0.0a3/langchain_core/messages/block_translators/bedrock.py +0 -47
- langchain_core-1.0.0a3/langchain_core/messages/block_translators/bedrock_converse.py +0 -49
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/README.md +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/_api/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/_api/beta_decorator.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/_api/deprecation.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/_api/internal.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/_api/path.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/_import_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/agents.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/caches.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/file.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/manager.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/stdout.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/streaming_stdout.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/callbacks/usage.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/chat_history.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/chat_loaders.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/chat_sessions.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/document_loaders/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/document_loaders/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/document_loaders/blob_loaders.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/document_loaders/langsmith.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/documents/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/documents/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/documents/compressor.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/documents/transformers.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/embeddings/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/embeddings/embeddings.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/embeddings/fake.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/env.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/example_selectors/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/example_selectors/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/example_selectors/length_based.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/example_selectors/semantic_similarity.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/exceptions.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/globals.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/indexing/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/indexing/api.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/indexing/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/indexing/in_memory.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/fake.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/fake_chat_models.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/llms.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/load/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/load/dump.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/load/load.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/load/mapping.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/load/serializable.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/memory.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/ai.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/google_genai.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/google_vertexai.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/groq.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/langchain_v0.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/ollama.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/block_translators/openai.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/chat.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/content.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/function.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/human.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/modifier.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/system.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/tool.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/messages/utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/format_instructions.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/json.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/list.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/openai_functions.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/openai_tools.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/pydantic.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/string.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/transform.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/output_parsers/xml.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/outputs/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/outputs/chat_generation.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/outputs/chat_result.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/outputs/generation.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/outputs/llm_result.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/outputs/run_info.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompt_values.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/chat.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/dict.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/few_shot.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/few_shot_with_templates.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/image.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/loading.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/message.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/pipeline.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/prompt.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/string.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/prompts/structured.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/py.typed +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/pydantic_v1/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/pydantic_v1/dataclasses.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/pydantic_v1/main.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/rate_limiters.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/retrievers.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/branch.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/config.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/configurable.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/fallbacks.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/graph.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/graph_ascii.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/graph_mermaid.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/graph_png.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/history.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/passthrough.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/retry.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/router.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/schema.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/runnables/utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/stores.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/structured_query.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/sys_info.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/convert.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/render.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/retriever.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/simple.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tools/structured.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/_streaming.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/context.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/core.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/evaluation.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/event_stream.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/langchain.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/langchain_v1.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/log_stream.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/memory_stream.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/root_listeners.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/run_collector.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/schemas.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/tracers/stdout.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/_merge.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/aiter.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/env.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/formatting.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/function_calling.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/html.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/image.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/input.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/interactive_env.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/iter.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/json.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/json_schema.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/loading.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/mustache.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/pydantic.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/strings.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/usage.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/utils/utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/vectorstores/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/vectorstores/base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/vectorstores/in_memory.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/vectorstores/utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/benchmarks/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/benchmarks/test_async_callbacks.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/benchmarks/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/integration_tests/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/integration_tests/test_compile.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/_api/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/_api/test_beta_decorator.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/_api/test_deprecation.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/_api/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/_api/test_path.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/caches/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/caches/test_in_memory_cache.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/callbacks/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/callbacks/test_async_callback_manager.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/callbacks/test_dispatch_custom_event.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/callbacks/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/callbacks/test_sync_callback_manager.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/callbacks/test_usage_callback.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/chat_history/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/chat_history/test_chat_history.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/conftest.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/data/prompt_file.txt +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/data/prompts/prompt_extra_args.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/data/prompts/prompt_missing_args.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/data/prompts/simple_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/dependencies/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/dependencies/test_dependencies.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/document_loaders/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/document_loaders/test_base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/document_loaders/test_langsmith.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/documents/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/documents/test_document.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/documents/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/documents/test_str.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/embeddings/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/embeddings/test_deterministic_embedding.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/example_selectors/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/example_selectors/test_base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/example_selectors/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/example_selectors/test_length_based_example_selector.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/example_selectors/test_similarity.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/example-non-utf8.csv +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/example-non-utf8.txt +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/example-utf8.csv +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/example-utf8.txt +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/example_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/examples.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/examples.yaml +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/few_shot_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/few_shot_prompt.yaml +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/few_shot_prompt_example_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/few_shot_prompt_examples_in.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/few_shot_prompt_yaml_examples.yaml +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/jinja_injection_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/jinja_injection_prompt.yaml +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/prompt_with_output_parser.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/simple_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/simple_prompt.yaml +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/simple_prompt_with_template_file.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/examples/simple_template.txt +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/fake/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/fake/callbacks.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/fake/test_fake_chat_model.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/indexing/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/indexing/test_hashed_document.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/indexing/test_in_memory_indexer.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/indexing/test_in_memory_record_manager.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/indexing/test_indexing.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/indexing/test_public_api.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/chat_models/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/chat_models/test_benchmark.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/chat_models/test_cache.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/chat_models/test_rate_limiting.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/llms/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/llms/test_base.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/llms/test_cache.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/language_models/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/load/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/load/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/load/test_serializable.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/block_translators/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/block_translators/test_langchain_v0.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/block_translators/test_openai.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/block_translators/test_registration.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/test_ai.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/messages/test_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_base_parsers.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_json.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_list_parser.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_openai_functions.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_openai_tools.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_pydantic_parser.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/output_parsers/test_xml_parser.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/outputs/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/outputs/test_chat_generation.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/outputs/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompt_file.txt +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/__snapshots__/test_chat.ambr +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/__snapshots__/test_prompt.ambr +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/prompt_extra_args.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/prompt_missing_args.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/simple_prompt.json +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_chat.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_dict.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_few_shot.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_few_shot_with_templates.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_image.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_loading.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_pipeline_prompt.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_prompt.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_structured.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/prompts/test_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/pydantic_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/rate_limiters/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/rate_limiters/test_in_memory_rate_limiter.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/__snapshots__/test_fallbacks.ambr +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/__snapshots__/test_graph.ambr +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/__snapshots__/test_runnable.ambr +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_concurrency.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_config.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_configurable.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_fallbacks.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_graph.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_history.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_runnable.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_runnable_events_v1.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_runnable_events_v2.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_tracing_interops.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/runnables/test_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/stores/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/stores/test_in_memory.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/stubs.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_globals.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_messages.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_outputs.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_prompt_values.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_pydantic_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_pydantic_serde.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_retrievers.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_setup.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_sys_info.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/test_tools.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_async_base_tracer.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_base_tracer.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_langchain.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_memory_stream.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_run_collector.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/tracers/test_schemas.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_aiter.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_env.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_function_calling.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_html.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_imports.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_iter.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_json_schema.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_pydantic.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_rm_titles.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_strings.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_usage.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/utils/test_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/vectorstores/__init__.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/vectorstores/test_in_memory.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/vectorstores/test_utils.py +0 -0
- {langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/tests/unit_tests/vectorstores/test_vectorstore.py +0 -0
{langchain_core-1.0.0a3 → langchain_core-1.0.0a4}/langchain_core/language_models/chat_models.py
RENAMED
|
@@ -48,7 +48,6 @@ from langchain_core.messages import (
|
|
|
48
48
|
message_chunk_to_message,
|
|
49
49
|
)
|
|
50
50
|
from langchain_core.messages.block_translators.openai import (
|
|
51
|
-
convert_to_openai_data_block,
|
|
52
51
|
convert_to_openai_image_block,
|
|
53
52
|
)
|
|
54
53
|
from langchain_core.output_parsers.openai_tools import (
|
|
@@ -149,16 +148,18 @@ def _format_for_tracing(messages: list[BaseMessage]) -> list[BaseMessage]:
|
|
|
149
148
|
block.get("type") == "file"
|
|
150
149
|
and is_data_content_block(block) # v0 (image/audio/file) or v1
|
|
151
150
|
and "base64" in block
|
|
152
|
-
#
|
|
151
|
+
# Backward compat: convert v1 base64 blocks to v0
|
|
153
152
|
):
|
|
154
153
|
if message_to_trace is message:
|
|
155
154
|
# Shallow copy
|
|
156
155
|
message_to_trace = message.model_copy()
|
|
157
156
|
message_to_trace.content = list(message_to_trace.content)
|
|
158
157
|
|
|
159
|
-
message_to_trace.content[idx] =
|
|
160
|
-
block
|
|
161
|
-
|
|
158
|
+
message_to_trace.content[idx] = { # type: ignore[index]
|
|
159
|
+
**{k: v for k, v in block.items() if k != "base64"},
|
|
160
|
+
"data": block["base64"],
|
|
161
|
+
"source_type": "base64",
|
|
162
|
+
}
|
|
162
163
|
elif len(block) == 1 and "type" not in block:
|
|
163
164
|
# Tracing assumes all content blocks have a "type" key. Here
|
|
164
165
|
# we add this key if it is missing, and there's an obvious
|
|
@@ -184,6 +184,9 @@ class BaseMessage(Serializable):
|
|
|
184
184
|
from langchain_core.messages.block_translators.anthropic import ( # noqa: PLC0415
|
|
185
185
|
_convert_to_v1_from_anthropic_input,
|
|
186
186
|
)
|
|
187
|
+
from langchain_core.messages.block_translators.bedrock_converse import ( # noqa: PLC0415
|
|
188
|
+
_convert_to_v1_from_converse_input,
|
|
189
|
+
)
|
|
187
190
|
from langchain_core.messages.block_translators.langchain_v0 import ( # noqa: PLC0415
|
|
188
191
|
_convert_v0_multimodal_input_to_v1,
|
|
189
192
|
)
|
|
@@ -214,6 +217,7 @@ class BaseMessage(Serializable):
|
|
|
214
217
|
_convert_v0_multimodal_input_to_v1,
|
|
215
218
|
_convert_to_v1_from_chat_completions_input,
|
|
216
219
|
_convert_to_v1_from_anthropic_input,
|
|
220
|
+
_convert_to_v1_from_converse_input,
|
|
217
221
|
]:
|
|
218
222
|
blocks = parsing_step(blocks)
|
|
219
223
|
return blocks
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
from collections.abc import Iterable
|
|
5
|
-
from typing import Any, Optional, cast
|
|
5
|
+
from typing import Any, Optional, Union, cast
|
|
6
6
|
|
|
7
7
|
from langchain_core.messages import AIMessage, AIMessageChunk
|
|
8
8
|
from langchain_core.messages import content as types
|
|
@@ -17,7 +17,7 @@ def _populate_extras(
|
|
|
17
17
|
|
|
18
18
|
for key, value in block.items():
|
|
19
19
|
if key not in known_fields:
|
|
20
|
-
if "extras" not in
|
|
20
|
+
if "extras" not in standard_block:
|
|
21
21
|
# Below type-ignores are because mypy thinks a non-standard block can
|
|
22
22
|
# get here, although we exclude them above.
|
|
23
23
|
standard_block["extras"] = {} # type: ignore[typeddict-unknown-key]
|
|
@@ -186,10 +186,12 @@ def _convert_citation_to_v1(citation: dict[str, Any]) -> types.Annotation:
|
|
|
186
186
|
def _convert_to_v1_from_anthropic(message: AIMessage) -> list[types.ContentBlock]:
|
|
187
187
|
"""Convert Anthropic message content to v1 format."""
|
|
188
188
|
if isinstance(message.content, str):
|
|
189
|
-
|
|
189
|
+
content: list[Union[str, dict]] = [{"type": "text", "text": message.content}]
|
|
190
|
+
else:
|
|
191
|
+
content = message.content
|
|
190
192
|
|
|
191
193
|
def _iter_blocks() -> Iterable[types.ContentBlock]:
|
|
192
|
-
for block in
|
|
194
|
+
for block in content:
|
|
193
195
|
if not isinstance(block, dict):
|
|
194
196
|
continue
|
|
195
197
|
block_type = block.get("type")
|
|
@@ -429,12 +431,12 @@ def _convert_to_v1_from_anthropic(message: AIMessage) -> list[types.ContentBlock
|
|
|
429
431
|
|
|
430
432
|
|
|
431
433
|
def translate_content(message: AIMessage) -> list[types.ContentBlock]:
|
|
432
|
-
"""Derive standard content blocks from a message with
|
|
434
|
+
"""Derive standard content blocks from a message with Anthropic content."""
|
|
433
435
|
return _convert_to_v1_from_anthropic(message)
|
|
434
436
|
|
|
435
437
|
|
|
436
438
|
def translate_content_chunk(message: AIMessageChunk) -> list[types.ContentBlock]:
|
|
437
|
-
"""Derive standard content blocks from a message chunk with
|
|
439
|
+
"""Derive standard content blocks from a message chunk with Anthropic content."""
|
|
438
440
|
return _convert_to_v1_from_anthropic(message)
|
|
439
441
|
|
|
440
442
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Derivations of standard content blocks from Bedrock content."""
|
|
2
|
+
|
|
3
|
+
from langchain_core.messages import AIMessage, AIMessageChunk
|
|
4
|
+
from langchain_core.messages import content as types
|
|
5
|
+
from langchain_core.messages.block_translators.anthropic import (
|
|
6
|
+
_convert_to_v1_from_anthropic,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _convert_to_v1_from_bedrock(message: AIMessage) -> list[types.ContentBlock]:
|
|
11
|
+
"""Convert bedrock message content to v1 format."""
|
|
12
|
+
out = _convert_to_v1_from_anthropic(message)
|
|
13
|
+
|
|
14
|
+
content_tool_call_ids = {
|
|
15
|
+
block.get("id")
|
|
16
|
+
for block in out
|
|
17
|
+
if isinstance(block, dict) and block.get("type") == "tool_call"
|
|
18
|
+
}
|
|
19
|
+
for tool_call in message.tool_calls:
|
|
20
|
+
if (id_ := tool_call.get("id")) and id_ not in content_tool_call_ids:
|
|
21
|
+
tool_call_block: types.ToolCall = {
|
|
22
|
+
"type": "tool_call",
|
|
23
|
+
"id": id_,
|
|
24
|
+
"name": tool_call["name"],
|
|
25
|
+
"args": tool_call["args"],
|
|
26
|
+
}
|
|
27
|
+
if "index" in tool_call:
|
|
28
|
+
tool_call_block["index"] = tool_call["index"] # type: ignore[typeddict-item]
|
|
29
|
+
if "extras" in tool_call:
|
|
30
|
+
tool_call_block["extras"] = tool_call["extras"] # type: ignore[typeddict-item]
|
|
31
|
+
out.append(tool_call_block)
|
|
32
|
+
return out
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _convert_to_v1_from_bedrock_chunk(
|
|
36
|
+
message: AIMessageChunk,
|
|
37
|
+
) -> list[types.ContentBlock]:
|
|
38
|
+
"""Convert bedrock message chunk content to v1 format."""
|
|
39
|
+
if (
|
|
40
|
+
message.content == ""
|
|
41
|
+
and not message.additional_kwargs
|
|
42
|
+
and not message.tool_calls
|
|
43
|
+
):
|
|
44
|
+
# Bedrock outputs multiple chunks containing response metadata
|
|
45
|
+
return []
|
|
46
|
+
|
|
47
|
+
out = _convert_to_v1_from_anthropic(message)
|
|
48
|
+
|
|
49
|
+
if (
|
|
50
|
+
message.tool_call_chunks
|
|
51
|
+
and not message.content
|
|
52
|
+
and message.chunk_position != "last" # keep tool_calls if aggregated
|
|
53
|
+
):
|
|
54
|
+
for tool_call_chunk in message.tool_call_chunks:
|
|
55
|
+
tc: types.ToolCallChunk = {
|
|
56
|
+
"type": "tool_call_chunk",
|
|
57
|
+
"id": tool_call_chunk.get("id"),
|
|
58
|
+
"name": tool_call_chunk.get("name"),
|
|
59
|
+
"args": tool_call_chunk.get("args"),
|
|
60
|
+
}
|
|
61
|
+
if (idx := tool_call_chunk.get("index")) is not None:
|
|
62
|
+
tc["index"] = idx
|
|
63
|
+
out.append(tc)
|
|
64
|
+
return out
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def translate_content(message: AIMessage) -> list[types.ContentBlock]:
|
|
68
|
+
"""Derive standard content blocks from a message with Bedrock content."""
|
|
69
|
+
if "claude" not in message.response_metadata.get("model_name", "").lower():
|
|
70
|
+
raise NotImplementedError # fall back to best-effort parsing
|
|
71
|
+
return _convert_to_v1_from_bedrock(message)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def translate_content_chunk(message: AIMessageChunk) -> list[types.ContentBlock]:
|
|
75
|
+
"""Derive standard content blocks from a message chunk with Bedrock content."""
|
|
76
|
+
# TODO: add model_name to all Bedrock chunks and update core merging logic
|
|
77
|
+
# to not append during aggregation. Then raise NotImplementedError here if
|
|
78
|
+
# not an Anthropic model to fall back to best-effort parsing.
|
|
79
|
+
return _convert_to_v1_from_bedrock_chunk(message)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _register_bedrock_translator() -> None:
|
|
83
|
+
"""Register the bedrock translator with the central registry.
|
|
84
|
+
|
|
85
|
+
Run automatically when the module is imported.
|
|
86
|
+
"""
|
|
87
|
+
from langchain_core.messages.block_translators import ( # noqa: PLC0415
|
|
88
|
+
register_translator,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
register_translator("bedrock", translate_content, translate_content_chunk)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
_register_bedrock_translator()
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"""Derivations of standard content blocks from Amazon (Bedrock Converse) content."""
|
|
2
|
+
|
|
3
|
+
import base64
|
|
4
|
+
from collections.abc import Iterable
|
|
5
|
+
from typing import Any, Optional, cast
|
|
6
|
+
|
|
7
|
+
from langchain_core.messages import AIMessage, AIMessageChunk
|
|
8
|
+
from langchain_core.messages import content as types
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _bytes_to_b64_str(bytes_: bytes) -> str:
|
|
12
|
+
return base64.b64encode(bytes_).decode("utf-8")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _populate_extras(
|
|
16
|
+
standard_block: types.ContentBlock, block: dict[str, Any], known_fields: set[str]
|
|
17
|
+
) -> types.ContentBlock:
|
|
18
|
+
"""Mutate a block, populating extras."""
|
|
19
|
+
if standard_block.get("type") == "non_standard":
|
|
20
|
+
return standard_block
|
|
21
|
+
|
|
22
|
+
for key, value in block.items():
|
|
23
|
+
if key not in known_fields:
|
|
24
|
+
if "extras" not in standard_block:
|
|
25
|
+
# Below type-ignores are because mypy thinks a non-standard block can
|
|
26
|
+
# get here, although we exclude them above.
|
|
27
|
+
standard_block["extras"] = {} # type: ignore[typeddict-unknown-key]
|
|
28
|
+
standard_block["extras"][key] = value # type: ignore[typeddict-item]
|
|
29
|
+
|
|
30
|
+
return standard_block
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _convert_to_v1_from_converse_input(
|
|
34
|
+
content: list[types.ContentBlock],
|
|
35
|
+
) -> list[types.ContentBlock]:
|
|
36
|
+
"""Attempt to unpack non-standard blocks."""
|
|
37
|
+
|
|
38
|
+
def _iter_blocks() -> Iterable[types.ContentBlock]:
|
|
39
|
+
blocks: list[dict[str, Any]] = [
|
|
40
|
+
cast("dict[str, Any]", block)
|
|
41
|
+
if block.get("type") != "non_standard"
|
|
42
|
+
else block["value"] # type: ignore[typeddict-item] # this is only non-standard blocks
|
|
43
|
+
for block in content
|
|
44
|
+
]
|
|
45
|
+
for block in blocks:
|
|
46
|
+
num_keys = len(block)
|
|
47
|
+
|
|
48
|
+
if num_keys == 1 and (text := block.get("text")):
|
|
49
|
+
yield {"type": "text", "text": text}
|
|
50
|
+
|
|
51
|
+
elif (
|
|
52
|
+
num_keys == 1
|
|
53
|
+
and (document := block.get("document"))
|
|
54
|
+
and isinstance(document, dict)
|
|
55
|
+
and "format" in document
|
|
56
|
+
):
|
|
57
|
+
if document.get("format") == "pdf":
|
|
58
|
+
if "bytes" in document.get("source", {}):
|
|
59
|
+
file_block: types.FileContentBlock = {
|
|
60
|
+
"type": "file",
|
|
61
|
+
"base64": _bytes_to_b64_str(document["source"]["bytes"]),
|
|
62
|
+
"mime_type": "application/pdf",
|
|
63
|
+
}
|
|
64
|
+
_populate_extras(file_block, document, {"format", "source"})
|
|
65
|
+
yield file_block
|
|
66
|
+
|
|
67
|
+
else:
|
|
68
|
+
yield {"type": "non_standard", "value": block}
|
|
69
|
+
|
|
70
|
+
elif document["format"] == "txt":
|
|
71
|
+
if "text" in document.get("source", {}):
|
|
72
|
+
plain_text_block: types.PlainTextContentBlock = {
|
|
73
|
+
"type": "text-plain",
|
|
74
|
+
"text": document["source"]["text"],
|
|
75
|
+
"mime_type": "text/plain",
|
|
76
|
+
}
|
|
77
|
+
_populate_extras(
|
|
78
|
+
plain_text_block, document, {"format", "source"}
|
|
79
|
+
)
|
|
80
|
+
yield plain_text_block
|
|
81
|
+
else:
|
|
82
|
+
yield {"type": "non_standard", "value": block}
|
|
83
|
+
|
|
84
|
+
else:
|
|
85
|
+
yield {"type": "non_standard", "value": block}
|
|
86
|
+
|
|
87
|
+
elif (
|
|
88
|
+
num_keys == 1
|
|
89
|
+
and (image := block.get("image"))
|
|
90
|
+
and isinstance(image, dict)
|
|
91
|
+
and "format" in image
|
|
92
|
+
):
|
|
93
|
+
if "bytes" in image.get("source", {}):
|
|
94
|
+
image_block: types.ImageContentBlock = {
|
|
95
|
+
"type": "image",
|
|
96
|
+
"base64": _bytes_to_b64_str(image["source"]["bytes"]),
|
|
97
|
+
"mime_type": f"image/{image['format']}",
|
|
98
|
+
}
|
|
99
|
+
_populate_extras(image_block, image, {"format", "source"})
|
|
100
|
+
yield image_block
|
|
101
|
+
|
|
102
|
+
else:
|
|
103
|
+
yield {"type": "non_standard", "value": block}
|
|
104
|
+
|
|
105
|
+
elif block.get("type") in types.KNOWN_BLOCK_TYPES:
|
|
106
|
+
yield cast("types.ContentBlock", block)
|
|
107
|
+
|
|
108
|
+
else:
|
|
109
|
+
yield {"type": "non_standard", "value": block}
|
|
110
|
+
|
|
111
|
+
return list(_iter_blocks())
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _convert_citation_to_v1(citation: dict[str, Any]) -> types.Annotation:
|
|
115
|
+
standard_citation: types.Citation = {"type": "citation"}
|
|
116
|
+
if "title" in citation:
|
|
117
|
+
standard_citation["title"] = citation["title"]
|
|
118
|
+
if (
|
|
119
|
+
(source_content := citation.get("source_content"))
|
|
120
|
+
and isinstance(source_content, list)
|
|
121
|
+
and all(isinstance(item, dict) for item in source_content)
|
|
122
|
+
):
|
|
123
|
+
standard_citation["cited_text"] = "".join(
|
|
124
|
+
item.get("text", "") for item in source_content
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
known_fields = {"type", "source_content", "title", "index", "extras"}
|
|
128
|
+
|
|
129
|
+
for key, value in citation.items():
|
|
130
|
+
if key not in known_fields:
|
|
131
|
+
if "extras" not in standard_citation:
|
|
132
|
+
standard_citation["extras"] = {}
|
|
133
|
+
standard_citation["extras"][key] = value
|
|
134
|
+
|
|
135
|
+
return standard_citation
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _convert_to_v1_from_converse(message: AIMessage) -> list[types.ContentBlock]:
|
|
139
|
+
"""Convert Bedrock Converse message content to v1 format."""
|
|
140
|
+
if (
|
|
141
|
+
message.content == ""
|
|
142
|
+
and not message.additional_kwargs
|
|
143
|
+
and not message.tool_calls
|
|
144
|
+
):
|
|
145
|
+
# Converse outputs multiple chunks containing response metadata
|
|
146
|
+
return []
|
|
147
|
+
|
|
148
|
+
if isinstance(message.content, str):
|
|
149
|
+
message.content = [{"type": "text", "text": message.content}]
|
|
150
|
+
|
|
151
|
+
def _iter_blocks() -> Iterable[types.ContentBlock]:
|
|
152
|
+
for block in message.content:
|
|
153
|
+
if not isinstance(block, dict):
|
|
154
|
+
continue
|
|
155
|
+
block_type = block.get("type")
|
|
156
|
+
|
|
157
|
+
if block_type == "text":
|
|
158
|
+
if citations := block.get("citations"):
|
|
159
|
+
text_block: types.TextContentBlock = {
|
|
160
|
+
"type": "text",
|
|
161
|
+
"text": block.get("text", ""),
|
|
162
|
+
"annotations": [_convert_citation_to_v1(a) for a in citations],
|
|
163
|
+
}
|
|
164
|
+
else:
|
|
165
|
+
text_block = {"type": "text", "text": block["text"]}
|
|
166
|
+
if "index" in block:
|
|
167
|
+
text_block["index"] = block["index"]
|
|
168
|
+
yield text_block
|
|
169
|
+
|
|
170
|
+
elif block_type == "reasoning_content":
|
|
171
|
+
reasoning_block: types.ReasoningContentBlock = {"type": "reasoning"}
|
|
172
|
+
if reasoning_content := block.get("reasoning_content"):
|
|
173
|
+
if reasoning := reasoning_content.get("text"):
|
|
174
|
+
reasoning_block["reasoning"] = reasoning
|
|
175
|
+
if signature := reasoning_content.get("signature"):
|
|
176
|
+
if "extras" not in reasoning_block:
|
|
177
|
+
reasoning_block["extras"] = {}
|
|
178
|
+
reasoning_block["extras"]["signature"] = signature
|
|
179
|
+
|
|
180
|
+
if "index" in block:
|
|
181
|
+
reasoning_block["index"] = block["index"]
|
|
182
|
+
|
|
183
|
+
known_fields = {"type", "reasoning_content", "index", "extras"}
|
|
184
|
+
for key in block:
|
|
185
|
+
if key not in known_fields:
|
|
186
|
+
if "extras" not in reasoning_block:
|
|
187
|
+
reasoning_block["extras"] = {}
|
|
188
|
+
reasoning_block["extras"][key] = block[key]
|
|
189
|
+
yield reasoning_block
|
|
190
|
+
|
|
191
|
+
elif block_type == "tool_use":
|
|
192
|
+
if (
|
|
193
|
+
isinstance(message, AIMessageChunk)
|
|
194
|
+
and len(message.tool_call_chunks) == 1
|
|
195
|
+
and message.chunk_position != "last"
|
|
196
|
+
):
|
|
197
|
+
# Isolated chunk
|
|
198
|
+
tool_call_chunk: types.ToolCallChunk = (
|
|
199
|
+
message.tool_call_chunks[0].copy() # type: ignore[assignment]
|
|
200
|
+
)
|
|
201
|
+
if "type" not in tool_call_chunk:
|
|
202
|
+
tool_call_chunk["type"] = "tool_call_chunk"
|
|
203
|
+
yield tool_call_chunk
|
|
204
|
+
else:
|
|
205
|
+
tool_call_block: Optional[types.ToolCall] = None
|
|
206
|
+
# Non-streaming or gathered chunk
|
|
207
|
+
if len(message.tool_calls) == 1:
|
|
208
|
+
tool_call_block = {
|
|
209
|
+
"type": "tool_call",
|
|
210
|
+
"name": message.tool_calls[0]["name"],
|
|
211
|
+
"args": message.tool_calls[0]["args"],
|
|
212
|
+
"id": message.tool_calls[0].get("id"),
|
|
213
|
+
}
|
|
214
|
+
elif call_id := block.get("id"):
|
|
215
|
+
for tc in message.tool_calls:
|
|
216
|
+
if tc.get("id") == call_id:
|
|
217
|
+
tool_call_block = {
|
|
218
|
+
"type": "tool_call",
|
|
219
|
+
"name": tc["name"],
|
|
220
|
+
"args": tc["args"],
|
|
221
|
+
"id": tc.get("id"),
|
|
222
|
+
}
|
|
223
|
+
break
|
|
224
|
+
else:
|
|
225
|
+
pass
|
|
226
|
+
if not tool_call_block:
|
|
227
|
+
tool_call_block = {
|
|
228
|
+
"type": "tool_call",
|
|
229
|
+
"name": block.get("name", ""),
|
|
230
|
+
"args": block.get("input", {}),
|
|
231
|
+
"id": block.get("id", ""),
|
|
232
|
+
}
|
|
233
|
+
if "index" in block:
|
|
234
|
+
tool_call_block["index"] = block["index"]
|
|
235
|
+
yield tool_call_block
|
|
236
|
+
|
|
237
|
+
elif (
|
|
238
|
+
block_type == "input_json_delta"
|
|
239
|
+
and isinstance(message, AIMessageChunk)
|
|
240
|
+
and len(message.tool_call_chunks) == 1
|
|
241
|
+
):
|
|
242
|
+
tool_call_chunk = (
|
|
243
|
+
message.tool_call_chunks[0].copy() # type: ignore[assignment]
|
|
244
|
+
)
|
|
245
|
+
if "type" not in tool_call_chunk:
|
|
246
|
+
tool_call_chunk["type"] = "tool_call_chunk"
|
|
247
|
+
yield tool_call_chunk
|
|
248
|
+
|
|
249
|
+
else:
|
|
250
|
+
new_block: types.NonStandardContentBlock = {
|
|
251
|
+
"type": "non_standard",
|
|
252
|
+
"value": block,
|
|
253
|
+
}
|
|
254
|
+
if "index" in new_block["value"]:
|
|
255
|
+
new_block["index"] = new_block["value"].pop("index")
|
|
256
|
+
yield new_block
|
|
257
|
+
|
|
258
|
+
return list(_iter_blocks())
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def translate_content(message: AIMessage) -> list[types.ContentBlock]:
|
|
262
|
+
"""Derive standard content blocks from a message with Bedrock Converse content."""
|
|
263
|
+
return _convert_to_v1_from_converse(message)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def translate_content_chunk(message: AIMessageChunk) -> list[types.ContentBlock]:
|
|
267
|
+
"""Derive standard content blocks from a chunk with Bedrock Converse content."""
|
|
268
|
+
return _convert_to_v1_from_converse(message)
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
def _register_bedrock_converse_translator() -> None:
|
|
272
|
+
"""Register the Bedrock Converse translator with the central registry.
|
|
273
|
+
|
|
274
|
+
Run automatically when the module is imported.
|
|
275
|
+
"""
|
|
276
|
+
from langchain_core.messages.block_translators import ( # noqa: PLC0415
|
|
277
|
+
register_translator,
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
register_translator("bedrock_converse", translate_content, translate_content_chunk)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
_register_bedrock_converse_translator()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Test base chat model."""
|
|
2
2
|
|
|
3
3
|
import uuid
|
|
4
|
+
import warnings
|
|
4
5
|
from collections.abc import AsyncIterator, Iterator
|
|
5
6
|
from typing import TYPE_CHECKING, Any, Literal, Optional, Union
|
|
6
7
|
|
|
@@ -505,6 +506,45 @@ def test_trace_images_in_openai_format() -> None:
|
|
|
505
506
|
]
|
|
506
507
|
|
|
507
508
|
|
|
509
|
+
def test_trace_pdfs() -> None:
|
|
510
|
+
# For backward compat
|
|
511
|
+
llm = ParrotFakeChatModel()
|
|
512
|
+
messages = [
|
|
513
|
+
{
|
|
514
|
+
"role": "user",
|
|
515
|
+
"content": [
|
|
516
|
+
{
|
|
517
|
+
"type": "file",
|
|
518
|
+
"mime_type": "application/pdf",
|
|
519
|
+
"base64": "<base64 string>",
|
|
520
|
+
}
|
|
521
|
+
],
|
|
522
|
+
}
|
|
523
|
+
]
|
|
524
|
+
tracer = FakeChatModelStartTracer()
|
|
525
|
+
|
|
526
|
+
with warnings.catch_warnings():
|
|
527
|
+
warnings.simplefilter("error")
|
|
528
|
+
llm.invoke(messages, config={"callbacks": [tracer]})
|
|
529
|
+
|
|
530
|
+
assert tracer.messages == [
|
|
531
|
+
[
|
|
532
|
+
[
|
|
533
|
+
HumanMessage(
|
|
534
|
+
content=[
|
|
535
|
+
{
|
|
536
|
+
"type": "file",
|
|
537
|
+
"mime_type": "application/pdf",
|
|
538
|
+
"source_type": "base64",
|
|
539
|
+
"data": "<base64 string>",
|
|
540
|
+
}
|
|
541
|
+
]
|
|
542
|
+
)
|
|
543
|
+
]
|
|
544
|
+
]
|
|
545
|
+
]
|
|
546
|
+
|
|
547
|
+
|
|
508
548
|
def test_content_block_transformation_v0_to_v1_image() -> None:
|
|
509
549
|
"""Test that v0 format image content blocks are transformed to v1 format."""
|
|
510
550
|
# Create a message with v0 format image content
|
|
@@ -162,6 +162,11 @@ def test_convert_to_v1_from_anthropic() -> None:
|
|
|
162
162
|
# Check no mutation
|
|
163
163
|
assert message.content != expected_content
|
|
164
164
|
|
|
165
|
+
message = AIMessage("Hello", response_metadata={"model_provider": "anthropic"})
|
|
166
|
+
expected_content = [{"type": "text", "text": "Hello"}]
|
|
167
|
+
assert message.content_blocks == expected_content
|
|
168
|
+
assert message.content != expected_content # check no mutation
|
|
169
|
+
|
|
165
170
|
|
|
166
171
|
def test_convert_to_v1_from_anthropic_chunk() -> None:
|
|
167
172
|
chunks = [
|