MCPcopy
hub / github.com/langchain-ai/langchain / create_model

Function create_model

libs/core/langchain_core/runnables/utils.py:511–530  ·  view source on GitHub ↗

Create a pydantic model with the given field definitions. Args: __model_name: The name of the model. **field_definitions: The field definitions for the model. Returns: Type[BaseModel]: The created model.

(
    __model_name: str,
    **field_definitions: Any,
)

Source from the content-addressed store, hash-verified

509
510
511def create_model(
512 __model_name: str,
513 **field_definitions: Any,
514) -> Type[BaseModel]:
515 """Create a pydantic model with the given field definitions.
516
517 Args:
518 __model_name: The name of the model.
519 **field_definitions: The field definitions for the model.
520
521 Returns:
522 Type[BaseModel]: The created model.
523 """
524 try:
525 return _create_model_cached(__model_name, **field_definitions)
526 except TypeError:
527 # something in field definitions is not hashable
528 return _create_model_base(
529 __model_name, __config__=_SchemaConfig, **field_definitions
530 )
531
532
533@lru_cache(maxsize=256)

Callers 15

get_input_schemaMethod · 0.90
get_input_schemaMethod · 0.90
get_output_schemaMethod · 0.90
config_schemaMethod · 0.90
get_graphMethod · 0.90
_seq_input_schemaFunction · 0.90
_seq_output_schemaFunction · 0.90
get_input_schemaMethod · 0.90
get_output_schemaMethod · 0.90
get_input_schemaMethod · 0.90
get_input_schemaMethod · 0.90
get_output_schemaMethod · 0.90

Calls 1

_create_model_cachedFunction · 0.85

Tested by

no test coverage detected