test_convert_to_openai_messages_reasoning_content() — langchain Function Reference
Architecture documentation for the test_convert_to_openai_messages_reasoning_content() function in test_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 80470b0b_6d5e_f68f_8faf_07752fa6fb55["test_convert_to_openai_messages_reasoning_content()"] 03f6a5ae_d57a_eb66_626a_b9e082b763ea["test_utils.py"] 80470b0b_6d5e_f68f_8faf_07752fa6fb55 -->|defined in| 03f6a5ae_d57a_eb66_626a_b9e082b763ea style 80470b0b_6d5e_f68f_8faf_07752fa6fb55 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/messages/test_utils.py lines 1822–1880
def test_convert_to_openai_messages_reasoning_content() -> None:
"""Test convert_to_openai_messages with reasoning content blocks."""
# Test reasoning block with empty summary
msg = AIMessage(content=[{"type": "reasoning", "summary": []}])
result = convert_to_openai_messages(msg, text_format="block")
expected = {"role": "assistant", "content": [{"type": "reasoning", "summary": []}]}
assert result == expected
# Test reasoning block with summary content
msg_with_summary = AIMessage(
content=[
{
"type": "reasoning",
"summary": [
{"type": "text", "text": "First thought"},
{"type": "text", "text": "Second thought"},
],
}
]
)
result_with_summary = convert_to_openai_messages(
msg_with_summary, text_format="block"
)
expected_with_summary = {
"role": "assistant",
"content": [
{
"type": "reasoning",
"summary": [
{"type": "text", "text": "First thought"},
{"type": "text", "text": "Second thought"},
],
}
],
}
assert result_with_summary == expected_with_summary
# Test mixed content with reasoning and text
mixed_msg = AIMessage(
content=[
{"type": "text", "text": "Regular response"},
{
"type": "reasoning",
"summary": [{"type": "text", "text": "My reasoning process"}],
},
]
)
mixed_result = convert_to_openai_messages(mixed_msg, text_format="block")
expected_mixed = {
"role": "assistant",
"content": [
{"type": "text", "text": "Regular response"},
{
"type": "reasoning",
"summary": [{"type": "text", "text": "My reasoning process"}],
},
],
}
assert mixed_result == expected_mixed
Domain
Subdomains
Source
Frequently Asked Questions
What does test_convert_to_openai_messages_reasoning_content() do?
test_convert_to_openai_messages_reasoning_content() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/messages/test_utils.py.
Where is test_convert_to_openai_messages_reasoning_content() defined?
test_convert_to_openai_messages_reasoning_content() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 1822.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free