@@ -241,7 +241,8 @@ def initialize(dialect_klass, gateway_klass, llm_model, gateway: nil)
241241 # @param feature_context { Hash - Optional } - The feature context to use for the completion.
242242 # @param partial_tool_calls { Boolean - Optional } - If true, the completion will return partial tool calls.
243243 # @param output_thinking { Boolean - Optional } - If true, the completion will return the thinking output for thinking models.
244- # @param extra_model_params { Hash - Optional } - Other params that are not available accross models. e.g. response_format JSON schema.
244+ # @param response_format { Hash - Optional } - JSON schema passed to the API as the desired structured output.
245+ # @param [Experimental] extra_model_params { Hash - Optional } - Other params that are not available accross models. e.g. response_format JSON schema.
245246 #
246247 # @param &on_partial_blk { Block - Optional } - The passed block will get called with the LLM partial response alongside a cancel function.
247248 #
@@ -259,6 +260,7 @@ def generate(
259260 feature_context : nil ,
260261 partial_tool_calls : false ,
261262 output_thinking : false ,
263+ response_format : nil ,
262264 extra_model_params : nil ,
263265 &partial_read_blk
264266 )
@@ -274,6 +276,7 @@ def generate(
274276 feature_context : feature_context ,
275277 partial_tool_calls : partial_tool_calls ,
276278 output_thinking : output_thinking ,
279+ response_format : response_format ,
277280 extra_model_params : extra_model_params ,
278281 } ,
279282 )
@@ -282,6 +285,7 @@ def generate(
282285
283286 model_params [ :temperature ] = temperature if temperature
284287 model_params [ :top_p ] = top_p if top_p
288+ model_params [ :response_format ] = response_format if response_format
285289 model_params . merge! ( extra_model_params ) if extra_model_params
286290
287291 if prompt . is_a? ( String )
0 commit comments