Skip to content

Commit 1354a30

Browse files
committed
refactor!: Rename reasoning param to reasoning_effort
1 parent 17c42c6 commit 1354a30

File tree

8 files changed

+14
-13
lines changed

8 files changed

+14
-13
lines changed

lib/sycophant.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ defmodule Sycophant do
5151
are applied automatically.
5252
5353
Common shared params: `:temperature`, `:max_tokens`, `:top_p`, `:top_k`,
54-
`:stop`, `:reasoning`, `:reasoning_summary`, `:service_tier`, `:tool_choice`,
54+
`:stop`, `:reasoning_effort`, `:reasoning_summary`, `:service_tier`, `:tool_choice`,
5555
`:parallel_tool_calls`.
5656
5757
Wire-specific params are passed as flat keywords alongside shared ones. For

lib/sycophant/param_defs.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ defmodule Sycophant.ParamDefs do
3737
stop:
3838
Zoi.list(Zoi.string(), description: "Stop sequences")
3939
|> Zoi.optional(),
40-
reasoning:
40+
reasoning_effort:
4141
Zoi.enum([:none, :minimal, :low, :medium, :high, :xhigh],
4242
description: "Extended thinking effort level"
4343
)

lib/sycophant/reasoning.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Sycophant.Reasoning do
22
@moduledoc """
33
Reasoning output from an LLM response.
44
5-
When a model supports extended thinking (e.g. with the `:reasoning` parameter),
5+
When a model supports extended thinking (e.g. with the `:reasoning_effort` parameter),
66
the chain-of-thought is available in `response.reasoning.content` as a list
77
of `Content.Thinking` structs. Each thinking block may carry `:text` (raw
88
chain-of-thought), `:summary` (condensed summary), or both, depending on

lib/sycophant/wire_protocol/anthropic_messages.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,11 +512,11 @@ defmodule Sycophant.WireProtocol.AnthropicMessages do
512512

513513
defp maybe_put_tool_choice(payload, _), do: payload
514514

515-
defp maybe_put_thinking(payload, %{reasoning: :none}) do
515+
defp maybe_put_thinking(payload, %{reasoning_effort: :none}) do
516516
Map.put(payload, "thinking", %{"type" => "disabled"})
517517
end
518518

519-
defp maybe_put_thinking(payload, %{reasoning: level})
519+
defp maybe_put_thinking(payload, %{reasoning_effort: level})
520520
when is_map_key(@reasoning_budgets, level) do
521521
budget = Map.fetch!(@reasoning_budgets, level)
522522
Map.put(payload, "thinking", %{"type" => "enabled", "budget_tokens" => budget})

lib/sycophant/wire_protocol/bedrock_converse.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ defmodule Sycophant.WireProtocol.BedrockConverse do
4444
:stop,
4545
:tool_choice,
4646
:parallel_tool_calls,
47-
:reasoning
47+
:reasoning_effort
4848
])
4949
)
5050

@@ -522,13 +522,13 @@ defmodule Sycophant.WireProtocol.BedrockConverse do
522522

523523
# --- Private: Thinking ---
524524

525-
defp maybe_put_thinking(payload, %{reasoning: :none}) do
525+
defp maybe_put_thinking(payload, %{reasoning_effort: :none}) do
526526
Map.put(payload, "additionalModelRequestFields", %{
527527
"thinking" => %{"type" => "disabled"}
528528
})
529529
end
530530

531-
defp maybe_put_thinking(payload, %{reasoning: level})
531+
defp maybe_put_thinking(payload, %{reasoning_effort: level})
532532
when is_map_key(@reasoning_budgets, level) do
533533
budget = Map.fetch!(@reasoning_budgets, level)
534534

lib/sycophant/wire_protocol/google_gemini.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ defmodule Sycophant.WireProtocol.GoogleGemini do
3737
:top_p,
3838
:top_k,
3939
:stop,
40-
:reasoning,
40+
:reasoning_effort,
4141
:reasoning_summary,
4242
:tool_choice,
4343
:parallel_tool_calls
@@ -540,9 +540,10 @@ defmodule Sycophant.WireProtocol.GoogleGemini do
540540
else: Map.put(config, "thinkingConfig", thinking_config)
541541
end
542542

543-
defp build_thinking_level(%{reasoning: :none}, _model), do: %{"thinkingBudget" => 0}
543+
defp build_thinking_level(%{reasoning_effort: :none}, _model),
544+
do: %{"thinkingBudget" => 0}
544545

545-
defp build_thinking_level(%{reasoning: level}, model)
546+
defp build_thinking_level(%{reasoning_effort: level}, model)
546547
when is_map_key(@thinking_levels, level) do
547548
if legacy_thinking_model?(model) do
548549
%{"thinkingBudget" => Map.fetch!(@thinking_budgets, level)}

lib/sycophant/wire_protocol/openai_completions.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ defmodule Sycophant.WireProtocol.OpenAICompletions do
400400
|> maybe_put_reasoning_summary(params)
401401
end
402402

403-
defp maybe_put_reasoning_effort(payload, %{reasoning: level}) when not is_nil(level),
403+
defp maybe_put_reasoning_effort(payload, %{reasoning_effort: level}) when not is_nil(level),
404404
do: Map.put(payload, "reasoning_effort", stringify_atom(level))
405405

406406
defp maybe_put_reasoning_effort(payload, _), do: payload

lib/sycophant/wire_protocol/openai_responses.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ defmodule Sycophant.WireProtocol.OpenAIResponses do
563563
defp maybe_put_reasoning(payload, params) do
564564
reasoning =
565565
%{}
566-
|> maybe_put("effort", Map.get(params, :reasoning))
566+
|> maybe_put("effort", Map.get(params, :reasoning_effort))
567567
|> maybe_put("summary", Map.get(params, :reasoning_summary))
568568

569569
if map_size(reasoning) > 0 do

0 commit comments

Comments
 (0)