Skip to main content

marvin.fns.generate

Constants

DEFAULT_PROMPT

T

Functions

generate

Generates examples of a specific type or matching a description. This function uses a language model to generate high-quality, random examples that match the specified type or description. The examples are returned as a list. Args: target: The type of entities to generate. n: The number of examples to generate. Defaults to 1. instructions: Optional instructions describing what to generate. Used to provide specific guidance about what kinds of examples to create. agent: Optional custom agent to use for generation. 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. handlers: Optional list of handlers to use for the task. prompt: Optional prompt to use for the task. If not provided, the default prompt will be used. Returns: A list of n generated entities of type T.

generate_async

Generates examples of a specific type or matching a description asynchronously. This function uses a language model to generate high-quality, random examples that match the specified type or description. The examples are returned as a list. Args: target: The type of entities to generate. n: The number of examples to generate. Defaults to 1. instructions: Optional instructions describing what to generate. Used to provide specific guidance about what kinds of examples to create. agent: Optional custom agent to use for generation. 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. handlers: Optional list of handlers to use for the task. prompt: Optional prompt to use for the task. If not provided, the default prompt will be used. Returns: A list of n generated entities of type T.

generate_schema

Generates a JSON schema from a description.

generate_schema_async

Generates a JSON schema from a description.
Parent Module: fns