MCPcopy
hub / github.com/langroid/langroid / get_field_names

Function get_field_names

langroid/utils/pydantic_utils.py:157–162  ·  view source on GitHub ↗

Get all field names from a possibly nested Pydantic model.

(model: Type[BaseModel])

Source from the content-addressed store, hash-verified

155
156
157def get_field_names(model: Type[BaseModel]) -> List[str]:
158 """Get all field names from a possibly nested Pydantic model."""
159 mdl = flatten_pydantic_model(model)
160 fields = list(mdl.model_fields.keys())
161 # fields may be like a__b__c , so we only want the last part
162 return [f.split("__")[-1] for f in fields]
163
164
165def generate_simple_schema(

Callers 1

questions_toolMethod · 0.90

Calls 2

flatten_pydantic_modelFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…