Home / Function/ test_convert_to_openai_messages_openai_string() — langchain Function Reference

test_convert_to_openai_messages_openai_string() — langchain Function Reference

Architecture documentation for the test_convert_to_openai_messages_openai_string() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bd804c96_714d_ed02_1590_41e6029d99db["test_convert_to_openai_messages_openai_string()"]
  03f6a5ae_d57a_eb66_626a_b9e082b763ea["test_utils.py"]
  bd804c96_714d_ed02_1590_41e6029d99db -->|defined in| 03f6a5ae_d57a_eb66_626a_b9e082b763ea
  style bd804c96_714d_ed02_1590_41e6029d99db fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/messages/test_utils.py lines 1007–1024

def test_convert_to_openai_messages_openai_string() -> None:
    messages = [
        HumanMessage(
            content=[
                {"type": "text", "text": "Hello"},
                {"type": "text", "text": "World"},
            ]
        ),
        AIMessage(
            content=[{"type": "text", "text": "Hi"}, {"type": "text", "text": "there"}]
        ),
    ]
    result = convert_to_openai_messages(messages)
    expected = [
        {"role": "user", "content": "Hello\nWorld"},
        {"role": "assistant", "content": "Hi\nthere"},
    ]
    assert result == expected

Domain

Subdomains

Frequently Asked Questions

What does test_convert_to_openai_messages_openai_string() do?
test_convert_to_openai_messages_openai_string() 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_openai_string() defined?
test_convert_to_openai_messages_openai_string() is defined in libs/core/tests/unit_tests/messages/test_utils.py at line 1007.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free