cuery.tools.flex.base ===================== .. py:module:: cuery.tools.flex.base Classes ------- .. autoapisummary:: cuery.tools.flex.base.FlexTool Functions --------- .. autoapisummary:: cuery.tools.flex.base.preprocess_records Module Contents --------------- .. py:function:: preprocess_records(records, attrs = None, max_samples = None) Sample and filter attributes/columns in records. .. py:class:: FlexTool(/, **data) Bases: :py:obj:`cuery.Tool` Base class for tools iterating over data records with arbitrary attributes. .. py:attribute:: model_config Needed to allow DataFrame and other non-Pydantic types. .. py:attribute:: records :type: pandas.DataFrame | list[dict] Data records to iterate over. .. py:attribute:: attrs :type: list[str] | None :value: None List of record attributes to use. If None, all attributes are used. .. py:attribute:: record_format :type: Literal['json', 'md', 'text'] :value: 'text' Format of the record in the prompt. .. py:property:: template :type: str Get the name of the record template for the prompt. Each record/row will be formatted into the prompt using this template. .. py:property:: context :type: list[dict] For each input record, returns an object with a single "record" key. Jinja templates can then iterate over the "record" object's attributes .. py:method:: __call__(**kwargs) :async: Normalize the nested input records back into individual columns in output.