@@ -304,7 +304,8 @@ def initialize(dialect_klass, gateway_klass, llm_model, gateway: nil)
304304 # @param feature_context { Hash - Optional } - The feature context to use for the completion.
305305 # @param partial_tool_calls { Boolean - Optional } - If true, the completion will return partial tool calls.
306306 # @param output_thinking { Boolean - Optional } - If true, the completion will return the thinking output for thinking models.
307- # @param extra_model_params { Hash - Optional } - Other params that are not available accross models. e.g. response_format JSON schema.
307+ # @param response_format { Hash - Optional } - JSON schema passed to the API as the desired structured output.
308+ # @param [Experimental] extra_model_params { Hash - Optional } - Other params that are not available accross models. e.g. response_format JSON schema.
308309 #
309310 # @param &on_partial_blk { Block - Optional } - The passed block will get called with the LLM partial response alongside a cancel function.
310311 #
@@ -322,6 +323,7 @@ def generate(
322323 feature_context : nil ,
323324 partial_tool_calls : false ,
324325 output_thinking : false ,
326+ response_format : nil ,
325327 extra_model_params : nil ,
326328 &partial_read_blk
327329 )
@@ -337,6 +339,7 @@ def generate(
337339 feature_context : feature_context ,
338340 partial_tool_calls : partial_tool_calls ,
339341 output_thinking : output_thinking ,
342+ response_format : response_format ,
340343 extra_model_params : extra_model_params ,
341344 } ,
342345 )
@@ -345,6 +348,7 @@ def generate(
345348
346349 model_params [ :temperature ] = temperature if temperature
347350 model_params [ :top_p ] = top_p if top_p
351+ model_params [ :response_format ] = response_format if response_format
348352 model_params . merge! ( extra_model_params ) if extra_model_params
349353
350354 if prompt . is_a? ( String )
0 commit comments