_get_output_text() — langchain Function Reference
Architecture documentation for the _get_output_text() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0d743376_acb9_d505_7453_01840d66d480["_get_output_text()"] 2b046911_ea21_8e2e_ba0d_9d03da8d7bda["base.py"] 0d743376_acb9_d505_7453_01840d66d480 -->|defined in| 2b046911_ea21_8e2e_ba0d_9d03da8d7bda 06595fa5_189f_7f73_3a37_309f84e5179d["_construct_lc_result_from_responses_api()"] 06595fa5_189f_7f73_3a37_309f84e5179d -->|calls| 0d743376_acb9_d505_7453_01840d66d480 style 0d743376_acb9_d505_7453_01840d66d480 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/langchain_openai/chat_models/base.py lines 4276–4290
def _get_output_text(response: Response) -> str:
"""Safe output text extraction.
Context: OpenAI SDK deleted `response.output_text` momentarily in `1.99.2`.
"""
if hasattr(response, "output_text"):
return response.output_text
texts = [
content.text
for output in response.output
if output.type == "message"
for content in output.content
if content.type == "output_text"
]
return "".join(texts)
Domain
Subdomains
Source
Frequently Asked Questions
What does _get_output_text() do?
_get_output_text() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/chat_models/base.py.
Where is _get_output_text() defined?
_get_output_text() is defined in libs/partners/openai/langchain_openai/chat_models/base.py at line 4276.
What calls _get_output_text()?
_get_output_text() is called by 1 function(s): _construct_lc_result_from_responses_api.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free