test_convert_to_openai_messages_tool_use_unicode() — langchain Function Reference
Architecture documentation for the test_convert_to_openai_messages_tool_use_unicode() function in test_utils.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ae0bb283_660e_d2d7_99f8_ff06c8b32fa7["test_convert_to_openai_messages_tool_use_unicode()"] ea3f8d89_f44b_6738_3cb9_a740a73cfca4["test_utils.py"] ae0bb283_660e_d2d7_99f8_ff06c8b32fa7 -->|defined in| ea3f8d89_f44b_6738_3cb9_a740a73cfca4 style ae0bb283_660e_d2d7_99f8_ff06c8b32fa7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/messages/test_utils.py lines 1226–1250
def test_convert_to_openai_messages_tool_use_unicode() -> None:
"""Test that Unicode characters in tool call args are preserved correctly."""
messages = [
AIMessage(
content=[
{
"type": "tool_use",
"id": "123",
"name": "create_customer",
"input": {"customer_name": "你好啊集团"},
}
]
)
]
result = convert_to_openai_messages(messages, text_format="block")
assert result[0]["tool_calls"][0]["type"] == "function"
assert result[0]["tool_calls"][0]["id"] == "123"
assert result[0]["tool_calls"][0]["function"]["name"] == "create_customer"
# Ensure Unicode characters are preserved, not escaped as \\uXXXX
arguments_str = result[0]["tool_calls"][0]["function"]["arguments"]
parsed_args = json.loads(arguments_str)
assert parsed_args["customer_name"] == "你好啊集团"
# Also ensure the raw JSON string contains Unicode, not escaped sequences
assert "你好啊集团" in arguments_str
assert "\\u4f60" not in arguments_str # Should not contain escaped Unicode
Domain
Subdomains
Source
Frequently Asked Questions
What does test_convert_to_openai_messages_tool_use_unicode() do?
test_convert_to_openai_messages_tool_use_unicode() 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_tool_use_unicode() defined?
test_convert_to_openai_messages_tool_use_unicode() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 1226.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free