agora.sender.schema_generator
TaskSchemaGenerator Objects
class TaskSchemaGenerator()
Toolformer-based task schema generation.
__init__
def __init__(toolformer: Toolformer)
Initialize the SchemaGenerator.
Arguments:
toolformer
Toolformer - The toolformer to use for schema generation.
from_function
def from_function(func: Callable,
description: str = None,
input_schema: dict = None,
output_schema: dict = None) -> TaskSchema
Generate a TaskSchema schema from a function. Unlike TaskSchema.from_function, this method supports generating schemas from functions without type hints.
Arguments:
func
Callable - The function to generate the schema from.description
str, optional - If not None, overrides the generated description. Defaults to None.input_schema
dict, optional - If not None, overrides the generated input schema. Defaults to None.output_schema
dict, optional - If not None, overrides the generated output schema. Defaults to None.
Returns:
TaskSchema
- The generated schema.
from_text
def from_text(text: str,
description: str = None,
input_schema: dict = None,
output_schema: dict = None) -> TaskSchema
Generate a JSON schema from a textual description.
Arguments:
text
str - The description of the task.description
str, optional - If not None, overrides the generated description. Defaults to None.input_schema
dict, optional - If not None, overrides the generated input schema. Defaults to None.output_schema
dict, optional - If not None, overrides the generated output schema. Defaults to None.
Returns:
TaskSchema
- The generated schema.