_rm_titles() — langchain Function Reference
Architecture documentation for the _rm_titles() function in function_calling.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ab698410_e291_9809_335f_cba19c23f0a8["_rm_titles()"] 344b2838_87a8_d5dc_b550_fdb443ff6c4e["function_calling.py"] ab698410_e291_9809_335f_cba19c23f0a8 -->|defined in| 344b2838_87a8_d5dc_b550_fdb443ff6c4e 0edd121c_051a_5776_8748_581f03d9e57c["_convert_json_schema_to_openai_function()"] 0edd121c_051a_5776_8748_581f03d9e57c -->|calls| ab698410_e291_9809_335f_cba19c23f0a8 style ab698410_e291_9809_335f_cba19c23f0a8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/utils/function_calling.py lines 88–119
def _rm_titles(kv: dict, prev_key: str = "") -> dict:
"""Recursively removes `'title'` fields from a JSON schema dictionary.
Remove `'title'` fields from the input JSON schema dictionary,
except when a `'title'` appears within a property definition under `'properties'`.
Args:
kv: The input JSON schema as a dictionary.
prev_key: The key from the parent dictionary, used to identify context.
Returns:
A new dictionary with appropriate `'title'` fields removed.
"""
new_kv = {}
for k, v in kv.items():
if k == "title":
# If the value is a nested dict and part of a property under "properties",
# preserve the title but continue recursion
if isinstance(v, dict) and prev_key == "properties":
new_kv[k] = _rm_titles(v, k)
else:
# Otherwise, remove this "title" key
continue
elif isinstance(v, dict):
# Recurse into nested dictionaries
new_kv[k] = _rm_titles(v, k)
else:
# Leave non-dict values untouched
new_kv[k] = v
return new_kv
Domain
Subdomains
Source
Frequently Asked Questions
What does _rm_titles() do?
_rm_titles() is a function in the langchain codebase, defined in libs/core/langchain_core/utils/function_calling.py.
Where is _rm_titles() defined?
_rm_titles() is defined in libs/core/langchain_core/utils/function_calling.py at line 88.
What calls _rm_titles()?
_rm_titles() is called by 1 function(s): _convert_json_schema_to_openai_function.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free