25 lines
834 B
Python
25 lines
834 B
Python
"""
|
|
title: Athena Thinking Control
|
|
version: 1.0.0
|
|
description: Send the Thinking switch state to Athena on every provider call.
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
|
|
class Filter:
|
|
class Valves(BaseModel):
|
|
priority: int = Field(default=100)
|
|
|
|
def __init__(self):
|
|
self.valves = self.Valves()
|
|
|
|
async def request(self, body: dict, __metadata__: dict = None) -> dict:
|
|
metadata = __metadata__ or {}
|
|
selected = metadata.get("filter_ids", []) or []
|
|
enabled = "athena_thinking" in selected
|
|
options = dict(body.get("chat_template_kwargs") or {})
|
|
options["enable_thinking"] = enabled
|
|
body["chat_template_kwargs"] = options
|
|
# Avoid a chat/model effort setting contradicting the explicit switch.
|
|
body.pop("reasoning_effort", None)
|
|
return body
|