_convert_to_v1_from_bedrock() — langchain Function Reference
Architecture documentation for the _convert_to_v1_from_bedrock() function in bedrock.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5e06f7c2_050e_c749_8122_5724861328e5["_convert_to_v1_from_bedrock()"] 1a0b0bf5_99ad_e145_2d19_8867a81352ea["bedrock.py"] 5e06f7c2_050e_c749_8122_5724861328e5 -->|defined in| 1a0b0bf5_99ad_e145_2d19_8867a81352ea d54d451d_d038_a716_50c8_da9c63df5b41["translate_content()"] d54d451d_d038_a716_50c8_da9c63df5b41 -->|calls| 5e06f7c2_050e_c749_8122_5724861328e5 style 5e06f7c2_050e_c749_8122_5724861328e5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/block_translators/bedrock.py lines 10–32
def _convert_to_v1_from_bedrock(message: AIMessage) -> list[types.ContentBlock]:
"""Convert bedrock message content to v1 format."""
out = _convert_to_v1_from_anthropic(message)
content_tool_call_ids = {
block.get("id")
for block in out
if isinstance(block, dict) and block.get("type") == "tool_call"
}
for tool_call in message.tool_calls:
if (id_ := tool_call.get("id")) and id_ not in content_tool_call_ids:
tool_call_block: types.ToolCall = {
"type": "tool_call",
"id": id_,
"name": tool_call["name"],
"args": tool_call["args"],
}
if "index" in tool_call:
tool_call_block["index"] = tool_call["index"] # type: ignore[typeddict-item]
if "extras" in tool_call:
tool_call_block["extras"] = tool_call["extras"] # type: ignore[typeddict-item]
out.append(tool_call_block)
return out
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _convert_to_v1_from_bedrock() do?
_convert_to_v1_from_bedrock() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/block_translators/bedrock.py.
Where is _convert_to_v1_from_bedrock() defined?
_convert_to_v1_from_bedrock() is defined in libs/core/langchain_core/messages/block_translators/bedrock.py at line 10.
What calls _convert_to_v1_from_bedrock()?
_convert_to_v1_from_bedrock() is called by 1 function(s): translate_content.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free