
    `gj
                    T    d Z ddlmZ ddlmZmZ h dZdddZddd	Z	 	 	 	 	 	 dd
Z	y)a  LM Studio reasoning-effort resolution shared by the chat-completions
transport and run_agent's iteration-limit summary path.

LM Studio publishes per-model ``capabilities.reasoning.allowed_options`` (e.g.
``["off","on"]`` for toggle-style models, ``["off","minimal","low"]`` for
graduated models). We map the user's ``reasoning_config`` onto LM Studio's
OpenAI-compatible vocabulary, then clamp against the model's allowed set so
the server doesn't 400 on an unsupported effort.
    )annotations)ListOptional>   lowhighnonexhighmediumminimalr   r
   )offonr	   )maxultrac                   d}| rt        | t              r}| j                  d      du rd}ng| j                  d      xs dj                         j	                         }t
        j                  ||      }t        j                  ||      }|t        v r|}|r(|D ch c]  }t
        j                  ||       }}||vry|S c c}w )a  Return the ``reasoning_effort`` string to send to LM Studio, or ``None``.

    ``None`` means "omit the field": the user picked a level the model can't
    honor, so let LM Studio fall back to the model's declared default rather
    than silently substituting a different effort. When ``allowed_options`` is
    falsy (probe failed), skip clamping and send the resolved effort anyway.
    r
   enabledFr   effort N)
isinstancedictgetstriplower_LM_EFFORT_ALIASES_LM_EFFORT_CLAMP_LM_VALID_EFFORTS)reasoning_configallowed_optionsr   rawoptalloweds         K/root/.hermes/venv/lib/python3.12/site-packages/agent/lmstudio_reasoning.pyresolve_lmstudio_effortr"   #   s     FJ'7>	*e3F#''17R>>@FFHC$((c2C"&&sC0C''?NO%))#s3OO M Ps   B>N)r   zOptional[dict]r   zOptional[List[str]]returnzOptional[str])
__doc__
__future__r   typingr   r   r   r   r   r"        r!   <module>r)      sT    # ! J  $84  #W5 $( r(   