_get_annotation_description() — langchain Function Reference
Architecture documentation for the _get_annotation_description() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 644477c8_2315_71b4_87b9_459bd6db6814["_get_annotation_description()"] 6508e071_ac7c_8516_5d11_f42f8a45558c["base.py"] 644477c8_2315_71b4_87b9_459bd6db6814 -->|defined in| 6508e071_ac7c_8516_5d11_f42f8a45558c daa5e145_cf07_31db_8626_86e163af6615["_infer_arg_descriptions()"] daa5e145_cf07_31db_8626_86e163af6615 -->|calls| 644477c8_2315_71b4_87b9_459bd6db6814 b5571bd9_2c1c_0fa8_e749_a69f0b3f4b64["_is_annotated_type()"] 644477c8_2315_71b4_87b9_459bd6db6814 -->|calls| b5571bd9_2c1c_0fa8_e749_a69f0b3f4b64 style 644477c8_2315_71b4_87b9_459bd6db6814 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tools/base.py lines 105–123
def _get_annotation_description(arg_type: type) -> str | None:
"""Extract description from an `Annotated` type.
Checks for string annotations and `FieldInfo` objects with descriptions.
Args:
arg_type: The type to extract description from.
Returns:
The description string if found, `None` otherwise.
"""
if _is_annotated_type(arg_type):
annotated_args = get_args(arg_type)
for annotation in annotated_args[1:]:
if isinstance(annotation, str):
return annotation
if isinstance(annotation, FieldInfo) and annotation.description:
return annotation.description
return None
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does _get_annotation_description() do?
_get_annotation_description() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _get_annotation_description() defined?
_get_annotation_description() is defined in libs/core/langchain_core/tools/base.py at line 105.
What does _get_annotation_description() call?
_get_annotation_description() calls 1 function(s): _is_annotated_type.
What calls _get_annotation_description()?
_get_annotation_description() is called by 1 function(s): _infer_arg_descriptions.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free