extract
marvin.fns.extract
Constants
PROMPT
T
Functions
extract
Extracts entities of a specific type from the provided data.
This function uses a language model to identify and extract entities of the specified type from the input data. The extracted entities are returned as a list.
Args: data: The input data to extract entities from. Can be any type. target: The type of entities to extract. Defaults to str. instructions: Optional additional instructions to guide the extraction. Used to provide specific guidance about what to extract or how to process the data. Required when target is str. agent: Optional custom agent to use for extraction. 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: A list of extracted entities of type T.
Raises: ValueError: If target is str and no instructions are provided.
extract_async
Extracts entities of a specific type from the provided data.
This function uses a language model to identify and extract entities of the specified type from the input data. The extracted entities are returned as a list.
Args: data: The input data to extract entities from. Can be any type. target: The type of entities to extract. Defaults to str. instructions: Optional additional instructions to guide the extraction. Used to provide specific guidance about what to extract or how to process the data. Required when target is str. agent: Optional custom agent to use for extraction. 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: A list of extracted entities of type T.
Raises: ValueError: If target is str and no instructions are provided.
Parent Module: fns