_pop_index_and_sub_index() — langchain Function Reference
Architecture documentation for the _pop_index_and_sub_index() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ad1a549b_b34e_2769_401e_132731113e67["_pop_index_and_sub_index()"] 2b046911_ea21_8e2e_ba0d_9d03da8d7bda["base.py"] ad1a549b_b34e_2769_401e_132731113e67 -->|defined in| 2b046911_ea21_8e2e_ba0d_9d03da8d7bda b988bc7d_ceff_06f1_193c_a22abc7a149f["_construct_responses_api_input()"] b988bc7d_ceff_06f1_193c_a22abc7a149f -->|calls| ad1a549b_b34e_2769_401e_132731113e67 style ad1a549b_b34e_2769_401e_132731113e67 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/langchain_openai/chat_models/base.py lines 4091–4103
def _pop_index_and_sub_index(block: dict) -> dict:
"""When streaming, `langchain-core` uses `index` to aggregate text blocks.
OpenAI API does not support this key, so we need to remove it.
"""
new_block = {k: v for k, v in block.items() if k != "index"}
if "summary" in new_block and isinstance(new_block["summary"], list):
new_summary = []
for sub_block in new_block["summary"]:
new_sub_block = {k: v for k, v in sub_block.items() if k != "index"}
new_summary.append(new_sub_block)
new_block["summary"] = new_summary
return new_block
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _pop_index_and_sub_index() do?
_pop_index_and_sub_index() is a function in the langchain codebase, defined in libs/partners/openai/langchain_openai/chat_models/base.py.
Where is _pop_index_and_sub_index() defined?
_pop_index_and_sub_index() is defined in libs/partners/openai/langchain_openai/chat_models/base.py at line 4091.
What calls _pop_index_and_sub_index()?
_pop_index_and_sub_index() is called by 1 function(s): _construct_responses_api_input.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free