mirror of
https://github.com/yusufipk/dikte.git
synced 2026-09-12 03:16:19 +00:00
Ask Google for the lowest rung it has rather than for none
Google's compatibility layer has no word for off. Sending reasoning_effort "none" is refused outright, so choosing Thinking → Off made every cleanup fail and paste the raw transcript instead: HTTP 400: Request contains an invalid argument. (INVALID_ARGUMENT) Measured against gemini-3.5-flash-lite, asking it to reply "ok": nothing sent 50.59s reasoning_effort "none" 400 reasoning_effort "minimal" 15.40s reasoning_effort "low" 53.35s reasoning_effort "high" 63.83s So "none" lands on "minimal", which is both accepted and the quickest of them, and quickest is what cleanup wants. The thinking_config route the documentation offers is an SDK wrapper and is not a field this endpoint knows: sending it is "Unknown name \"google\"". Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
+11
-9
@@ -469,11 +469,13 @@ def transcribe_segments(target, audio_path, language="", prompt="", timeout=300,
|
||||
return out
|
||||
|
||||
|
||||
# The settings window offers OpenRouter's ladder, whose top two rungs Google
|
||||
# has never heard of. Sent as they are the request is refused, which costs the
|
||||
# cleanup rather than the dictation, so they land on the nearest rung that
|
||||
# exists instead.
|
||||
GEMINI_EFFORT = {"xhigh": "high", "max": "high"}
|
||||
# The settings window offers OpenRouter's ladder, and Google has neither end of
|
||||
# it: "none" is refused outright with a 400, and there is nothing above "high".
|
||||
# Both ends land on the nearest rung that does exist, which costs the cleanup
|
||||
# rather than the dictation when it is wrong. "minimal" is where "off" goes, and
|
||||
# it is the quickest of them by a wide margin, which is what cleanup wants
|
||||
# anyway.
|
||||
GEMINI_EFFORT = {"none": "minimal", "xhigh": "high", "max": "high"}
|
||||
|
||||
|
||||
def _thinking(payload, provider, reasoning):
|
||||
@@ -494,10 +496,10 @@ def _thinking(payload, provider, reasoning):
|
||||
payload["chat_template_kwargs"] = {"enable_thinking": reasoning != "none"}
|
||||
elif provider == "gemini":
|
||||
# Google's compatibility layer takes OpenAI's flat field rather than
|
||||
# OpenRouter's object, and "none" is how thinking is turned off there,
|
||||
# so it is the one level worth sending rather than skipping: a Flash
|
||||
# model left to think spends exactly the second this provider was
|
||||
# chosen to save.
|
||||
# OpenRouter's object, and it has no word for off, so "none" is asked
|
||||
# for as the lowest rung it has rather than skipped: a Flash model left
|
||||
# to decide for itself thinks, and thinking about a comma is the second
|
||||
# this provider was chosen to save.
|
||||
payload["reasoning_effort"] = GEMINI_EFFORT.get(reasoning, reasoning)
|
||||
elif reasoning != "none":
|
||||
# The thinking itself is never shown, so ask for it to be left out.
|
||||
|
||||
Reference in New Issue
Block a user