cast
Cast is a function that uses a language model to analyze the input data and transform it
marvin.fns.cast
Cast is a function that uses a language model to analyze the input data and transform it into the specified target type, maintaining as much semantic meaning as possible.
Constants
PROMPT
T
Functions
cast
Transforms input data into a specific type using a language model.
This function uses a language model to analyze the input data and transform it into the specified target type, maintaining as much semantic meaning as possible.
Args: data: The input data to transform. Can be any type. target: The type to transform the data into. Defaults to str. instructions: Optional additional instructions to guide the transformation. Used to provide specific guidance about how to interpret or transform the data. agent: Optional custom agent to use for transformation. If not provided, the default agent will be used. thread: Optional thread for maintaining conversation context. Can be either a Thread object or a string thread ID. context: Optional dictionary of additional context to include in the task.
Returns: The transformed data of type T.
Examples:
cast_async
Asynchronously transforms input data into a specific type using a language model.
This function uses a language model to analyze the input data and transform it into the specified target type, maintaining as much semantic meaning as possible.
Args: data: The input data to transform. Can be any type. target: The type to transform the data into. Defaults to str. instructions: Optional additional instructions to guide the transformation. Used to provide specific guidance about how to interpret or transform the data. agent: Optional custom agent to use for transformation. If not provided, the default agent will be used. thread: Optional thread for maintaining conversation context. Can be either a Thread object or a string thread ID. context: Optional dictionary of additional context to include in the task.
Returns: The transformed data of type T.
Examples:
Parent Module: fns