_convert_annotation_to_v1() — langchain Function Reference
Architecture documentation for the _convert_annotation_to_v1() function in openai.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 87592a59_792a_6756_12b5_e2905efc3b01["_convert_annotation_to_v1()"] 3f58992c_878c_57d1_7412_5e64743aa7ba["openai.py"] 87592a59_792a_6756_12b5_e2905efc3b01 -->|defined in| 3f58992c_878c_57d1_7412_5e64743aa7ba 24124a46_40a1_1ce3_a730_b36c3f9a0520["_convert_to_v1_from_responses()"] 24124a46_40a1_1ce3_a730_b36c3f9a0520 -->|calls| 87592a59_792a_6756_12b5_e2905efc3b01 style 87592a59_792a_6756_12b5_e2905efc3b01 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/messages/block_translators/openai.py lines 557–607
def _convert_annotation_to_v1(annotation: dict[str, Any]) -> types.Annotation:
annotation_type = annotation.get("type")
if annotation_type == "url_citation":
known_fields = {
"type",
"url",
"title",
"cited_text",
"start_index",
"end_index",
}
url_citation = cast("types.Citation", {})
for field in ("end_index", "start_index", "title"):
if field in annotation:
url_citation[field] = annotation[field]
url_citation["type"] = "citation"
url_citation["url"] = annotation["url"]
for field, value in annotation.items():
if field not in known_fields:
if "extras" not in url_citation:
url_citation["extras"] = {}
url_citation["extras"][field] = value
return url_citation
if annotation_type == "file_citation":
known_fields = {
"type",
"title",
"cited_text",
"start_index",
"end_index",
"filename",
}
document_citation: types.Citation = {"type": "citation"}
if "filename" in annotation:
document_citation["title"] = annotation["filename"]
for field, value in annotation.items():
if field not in known_fields:
if "extras" not in document_citation:
document_citation["extras"] = {}
document_citation["extras"][field] = value
return document_citation
# TODO: standardise container_file_citation?
non_standard_annotation: types.NonStandardAnnotation = {
"type": "non_standard_annotation",
"value": annotation,
}
return non_standard_annotation
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _convert_annotation_to_v1() do?
_convert_annotation_to_v1() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/block_translators/openai.py.
Where is _convert_annotation_to_v1() defined?
_convert_annotation_to_v1() is defined in libs/core/langchain_core/messages/block_translators/openai.py at line 557.
What calls _convert_annotation_to_v1()?
_convert_annotation_to_v1() is called by 1 function(s): _convert_to_v1_from_responses.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free