test_openai_pdf_tool_messages() — langchain Function Reference
Architecture documentation for the test_openai_pdf_tool_messages() function in test_responses_standard.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 19509b4b_da10_d2cd_31b9_8ced23add686["test_openai_pdf_tool_messages()"] 25cafc0a_8f3b_2d49_7e58_88f79aca1167["TestOpenAIResponses"] 19509b4b_da10_d2cd_31b9_8ced23add686 -->|defined in| 25cafc0a_8f3b_2d49_7e58_88f79aca1167 style 19509b4b_da10_d2cd_31b9_8ced23add686 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/chat_models/test_responses_standard.py lines 87–127
def test_openai_pdf_tool_messages(self, model: BaseChatModel) -> None:
"""Test that the model can process PDF inputs in `ToolMessage` objects."""
url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
pdf_data = base64.b64encode(httpx.get(url).content).decode("utf-8")
tool_message = ToolMessage(
content_blocks=[
{
"type": "file",
"base64": pdf_data,
"mime_type": "application/pdf",
"extras": {"filename": "my-pdf"}, # specify filename
},
],
tool_call_id="1",
name="random_pdf",
)
messages = [
HumanMessage(
"Get a random PDF using the tool and relay the title verbatim."
),
AIMessage(
[],
tool_calls=[
{
"type": "tool_call",
"id": "1",
"name": "random_pdf",
"args": {},
}
],
),
tool_message,
]
def random_pdf() -> str:
"""Return a random PDF."""
return ""
_ = model.bind_tools([random_pdf]).invoke(messages)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_openai_pdf_tool_messages() do?
test_openai_pdf_tool_messages() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_standard.py.
Where is test_openai_pdf_tool_messages() defined?
test_openai_pdf_tool_messages() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_standard.py at line 87.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free