Skip to main content

Parameters

ParameterTypeDefaultDescription
functionCallable[..., Any]-The function to analyze
namestr-The name of the function
descriptionOptional[str]-The description of the function
parameters_schemaDict[str, Any]-JSON schema for function parameters
return_schemaOptional[Dict[str, Any]]-JSON schema for return type
is_asyncbool-Whether the function is async
takes_ctxboolFalseWhether the function takes a RunContext as first parameter
positional_paramsList[str][]List of positional parameter names
var_positional_paramOptional[str]NoneName of the *args parameter if present

Functions

__post_init__

Initialize positional_params if None.

title: SchemaGenerationError sidebarTitle: SchemaGenerationError

Parameters

ParameterTypeDefaultDescription
messagestr-Error message

Functions

No specific functions - Exception raised during schema generation.

title: is_async_callable sidebarTitle: is_async_callable

Functions

is_async_callable

Check if an object is an async callable. Parameters:
  • obj (Any): The object to check
Returns:
  • bool: True if the object is an async callable


title: extract_type_schema sidebarTitle: extract_type_schema

Functions

extract_type_schema

Extract JSON schema from a Python type hint. Parameters:
  • type_hint (Any): The type hint to extract schema from
Returns:
  • Dict[str, Any]: JSON schema representation of the type


title: generate_function_schema sidebarTitle: generate_function_schema

Functions

generate_function_schema

Generate schema information from a function. Parameters:
  • function (Callable[…, Any]): The function to analyze
  • docstring_format (str): The docstring format (‘google’, ‘numpy’, ‘sphinx’, ‘auto’)
  • require_parameter_descriptions (bool): Whether to require parameter descriptions
  • takes_ctx (bool): Whether the function takes a RunContext as first parameter
Returns:
  • FunctionSchema: FunctionSchema object containing all schema information
Raises:
  • SchemaGenerationError: If schema generation fails


title: validate_tool_function sidebarTitle: validate_tool_function

Functions

validate_tool_function

Validate a function to ensure it meets tool requirements. Parameters:
  • func (Callable): The function to validate
Returns:
  • List[str]: List of validation errors (empty if valid)
I