translate_content() — langchain Function Reference
Architecture documentation for the translate_content() function in openai.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD af54f3fb_5bfb_6940_293f_4c3b25c7f24f["translate_content()"] 3f58992c_878c_57d1_7412_5e64743aa7ba["openai.py"] af54f3fb_5bfb_6940_293f_4c3b25c7f24f -->|defined in| 3f58992c_878c_57d1_7412_5e64743aa7ba ff798f74_5068_bddf_4e8d_fd7028b514da["_convert_to_v1_from_chat_completions()"] af54f3fb_5bfb_6940_293f_4c3b25c7f24f -->|calls| ff798f74_5068_bddf_4e8d_fd7028b514da 6dd0c2f6_197f_5200_610f_82ef7e9b8132["_convert_from_v03_ai_message()"] af54f3fb_5bfb_6940_293f_4c3b25c7f24f -->|calls| 6dd0c2f6_197f_5200_610f_82ef7e9b8132 24124a46_40a1_1ce3_a730_b36c3f9a0520["_convert_to_v1_from_responses()"] af54f3fb_5bfb_6940_293f_4c3b25c7f24f -->|calls| 24124a46_40a1_1ce3_a730_b36c3f9a0520 style af54f3fb_5bfb_6940_293f_4c3b25c7f24f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/block_translators/openai.py lines 993–1005
def translate_content(message: AIMessage) -> list[types.ContentBlock]:
"""Derive standard content blocks from a message with OpenAI content.
Args:
message: The message to translate.
Returns:
The derived content blocks.
"""
if isinstance(message.content, str):
return _convert_to_v1_from_chat_completions(message)
message = _convert_from_v03_ai_message(message)
return _convert_to_v1_from_responses(message)
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does translate_content() do?
translate_content() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/block_translators/openai.py.
Where is translate_content() defined?
translate_content() is defined in libs/core/langchain_core/messages/block_translators/openai.py at line 993.
What does translate_content() call?
translate_content() calls 3 function(s): _convert_from_v03_ai_message, _convert_to_v1_from_chat_completions, _convert_to_v1_from_responses.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free