cuery.tools.flex.generic#
Tool(s) to iterate over data with a response model defined by json schemas.
The idea is to first generate a schema with an LLM using the SchemaGenerator tool, then use that schema process records with the Generic tool.
Attributes#
Classes#
Module Contents#
- cuery.tools.flex.generic.GENERIC_PROMPT = ''#
- cuery.tools.flex.generic.SCHEMA_CONVERSION_PROMPT = ''#
- class cuery.tools.flex.generic.Generic(/, **data)#
Bases:
cuery.tools.flex.base.FlexToolTools that iterates over records with a JSON-schema response model.
- Parameters:
data (Any)
- response_schema: dict#
JSON schema used as response model.
- instructions: str#
Instructions for the tool, describing its purpose and how to use it.
- property prompt: cuery.Prompt#
Generate a prompt string based on the instructions and current schema.
- Return type:
- property response_model: cuery.ResponseClass#
Defines the response model for this tool (ClassVar or property).
- Return type:
cuery.ResponseClass
- class cuery.tools.flex.generic.Auto(/, **data)#
Bases:
GenericFully automatic, general-purpose tool for processing data records.
First auto-generates a response model from the response model instructions, then iterates over the records using that model and the provided tools instructions.
- Parameters:
data (Any)
- response_schema: str | dict | None = None#
Instructions to generate a JSON schema used as response model.
- schema_model: str = None#
Specific model to use to generate the JSON schema.
- _response: cuery.ResponseSet | None = None#
- property prompt: cuery.Prompt#
Generate a prompt string based on the instructions and current schema.
- Return type:
- async response_model()#
Defines the response model for this tool (ClassVar or property).
- Return type:
cuery.ResponseClass
- async task()#
Create a Task instance for this tool.
- Return type:
- async __call__(**kwargs)#
Normalize the nested input records back into individual columns in output.
- Return type:
pandas.DataFrame