A ProviderStrategy instance that can be used as the responseFormat in createAgent
Creates a provider strategy for structured output using native JSON schema support.
This function is used to configure structured output for agents when the underlying model
supports native JSON schema output (e.g., OpenAI's gpt-4o, gpt-4o-mini, and newer models).
Unlike toolStrategy, which uses function calling to extract structured output, providerStrategy
leverages the provider's native structured output capabilities, resulting in more efficient
and reliable schema enforcement.
When used with a model that supports JSON schema output, the model will return responses that directly conform to the provided schema without requiring tool calls. This is the recommended approach for structured output when your model supports it.
The schema to enforce, either a Zod schema, a JSON schema object, or an options object with schema and optional strict flag
A ProviderStrategy instance that can be used as the responseFormat in createAgent
Creates a provider strategy for structured output using native JSON schema support.
This function is used to configure structured output for agents when the underlying model supports native JSON schema output (e.g., OpenAI's
gpt-4o,gpt-4o-mini, and newer models). UnliketoolStrategy, which uses function calling to extract structured output,providerStrategyleverages the provider's native structured output capabilities, resulting in more efficient and reliable schema enforcement.When used with a model that supports JSON schema output, the model will return responses that directly conform to the provided schema without requiring tool calls. This is the recommended approach for structured output when your model supports it.