diff --git a/src/bot/modules/solaris/client.py b/src/bot/modules/solaris/client.py index 30252db..bff3346 100644 --- a/src/bot/modules/solaris/client.py +++ b/src/bot/modules/solaris/client.py @@ -1,18 +1,17 @@ import json from google import genai -from google.genai.types import GenerateContentConfig, ThinkingConfig +from google.genai import types as google_types +from google.genai.types import GenerateContentConfig, ThinkingConfig, SafetySetting from .structures import InputMessage, OutputMessage from dataclasses import asdict +from .content_config import CONTENT_CONFIG class SolarisClient: def __init__(self, api_key: str) -> None: client = genai.Client(api_key=api_key).aio self.chat = client.chats.create( model="gemini-2.5-flash", - config=GenerateContentConfig( - system_instruction="meow meow meow", # надо где-то промпт хранить, в бд наверное хезе - thinking_config=ThinkingConfig(thinking_budget=0), - ), + config=CONTENT_CONFIG ) async def send_messages(self, messages: list[InputMessage]) -> list[OutputMessage]: data = json.dumps( diff --git a/src/bot/modules/solaris/content_config.py b/src/bot/modules/solaris/content_config.py new file mode 100644 index 0000000..55a5f0d --- /dev/null +++ b/src/bot/modules/solaris/content_config.py @@ -0,0 +1,17 @@ +# хезе как и куда жто тулить но в мейн класс не хочу +from google.genai import types +from .structures import OutputMessage + +CONTENT_CONFIG = types.GenerateContentConfig( + system_instruction="meow meow meow", # надо где-то промпт хранить, в бд наверное хезе + thinking_config=types.ThinkingConfig(thinking_budget=0), + response_mime_type="application/json", + response_json_schema=list[OutputMessage], + safety_settings=[ + types.SafetySetting( + category=category, + threshold=types.HarmBlockThreshold.OFF + ) + for category in types.HarmBlockThreshold + ] +),