Home / Function/ _format_annotation_to_lc() — langchain Function Reference

_format_annotation_to_lc() — langchain Function Reference

Architecture documentation for the _format_annotation_to_lc() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f4107f2b_20c9_97b1_124f_31046942bf15["_format_annotation_to_lc()"]
  2b046911_ea21_8e2e_ba0d_9d03da8d7bda["base.py"]
  f4107f2b_20c9_97b1_124f_31046942bf15 -->|defined in| 2b046911_ea21_8e2e_ba0d_9d03da8d7bda
  06595fa5_189f_7f73_3a37_309f84e5179d["_construct_lc_result_from_responses_api()"]
  06595fa5_189f_7f73_3a37_309f84e5179d -->|calls| f4107f2b_20c9_97b1_124f_31046942bf15
  4ffa404b_88f9_d1df_3a9e_bd6d93548453["_convert_responses_chunk_to_generation_chunk()"]
  4ffa404b_88f9_d1df_3a9e_bd6d93548453 -->|calls| f4107f2b_20c9_97b1_124f_31046942bf15
  style f4107f2b_20c9_97b1_124f_31046942bf15 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/langchain_openai/chat_models/base.py lines 3961–3968

def _format_annotation_to_lc(annotation: dict[str, Any]) -> dict[str, Any]:
    # langchain-core reserves the `"index"` key for streaming aggregation.
    # Here we re-name.
    if annotation.get("type") == "file_citation" and "index" in annotation:
        new_annotation = annotation.copy()
        new_annotation["file_index"] = new_annotation.pop("index")
        return new_annotation
    return annotation

Domain

Subdomains

Frequently Asked Questions

What does _format_annotation_to_lc() do?
_format_annotation_to_lc() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/chat_models/base.py.
Where is _format_annotation_to_lc() defined?
_format_annotation_to_lc() is defined in libs/partners/openai/langchain_openai/chat_models/base.py at line 3961.
What calls _format_annotation_to_lc()?
_format_annotation_to_lc() is called by 2 function(s): _construct_lc_result_from_responses_api, _convert_responses_chunk_to_generation_chunk.

Analyze Your Own Codebase

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

Try Supermodel Free