This commit is contained in:
shinrei
2025-07-01 16:01:29 +00:00
parent 80de1eb5f3
commit 2fee90f07d

View File

@@ -3,6 +3,7 @@ from google import genai
from google.genai.types import GenerateContentConfig, ThinkingConfig
from .structures import InputMessage, OutputMessage
from typing import List
from dataclasses import asdict
class SolarisClient:
def __init__(self, api_key: str) -> None:
@@ -16,11 +17,10 @@ class SolarisClient:
)
async def send_messages(self, messages: List[InputMessage]):
data = json.dumps(
[asdict(msg) for msg in messages],
[asdict(msg) for msg in messages], # хм а asdict с датаклассов ваще можно юзать с НЕ датакласами но чем-то датаклассоподобным
ensure_ascii=True
)
resp = await self.chat.send_message(data)
print(resp.text)
output_messages = [
OutputMessage.fromdict(msg)
for msg in json.loads(resp.text)