feat: fix types and add reasoning_details to chat responses (#27)

This commit is contained in:
Matt Apperson
2025-12-16 16:16:22 -05:00
committed by GitHub
parent d433ce35e8
commit f190e3f950
81 changed files with 2249 additions and 1133 deletions
@@ -1,6 +1,7 @@
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from ._schema3 import Schema3, Schema3TypedDict
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .chatcompletionfinishreason import ChatCompletionFinishReason
from .chatmessagetokenlogprobs import (
@@ -17,6 +18,7 @@ from openrouter.types import (
from openrouter.utils import validate_open_enum
from pydantic import model_serializer
from pydantic.functional_validators import PlainValidator
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
@@ -24,6 +26,7 @@ class ChatResponseChoiceTypedDict(TypedDict):
finish_reason: Nullable[ChatCompletionFinishReason]
index: float
message: AssistantMessageTypedDict
reasoning_details: NotRequired[List[Schema3TypedDict]]
logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]]
@@ -36,11 +39,13 @@ class ChatResponseChoice(BaseModel):
message: AssistantMessage
reasoning_details: Optional[List[Schema3]] = None
logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = ["logprobs"]
optional_fields = ["reasoning_details", "logprobs"]
nullable_fields = ["finish_reason", "logprobs"]
null_default_fields = []