Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 6e950b4

Browse files
committed
DEV: Support for extra model params in LLM completions
This will be useful to start experiment with non-standard features like structured outputs.
1 parent 01eced7 commit 6e950b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/completions/llm.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ def generate(
258258
feature_context: nil,
259259
partial_tool_calls: false,
260260
output_thinking: false,
261+
extra_model_params: nil,
261262
&partial_read_blk
262263
)
263264
self.class.record_prompt(
@@ -272,13 +273,15 @@ def generate(
272273
feature_context: feature_context,
273274
partial_tool_calls: partial_tool_calls,
274275
output_thinking: output_thinking,
276+
extra_model_params: extra_model_params,
275277
},
276278
)
277279

278280
model_params = { max_tokens: max_tokens, stop_sequences: stop_sequences }
279281

280282
model_params[:temperature] = temperature if temperature
281283
model_params[:top_p] = top_p if top_p
284+
model_params.merge!(extra_model_params) if extra_model_params
282285

283286
if prompt.is_a?(String)
284287
prompt =

0 commit comments

Comments
 (0)