mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-02 12:50:48 +08:00
feat: fix types and add reasoning_details to chat responses (#27)
This commit is contained in:
@@ -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 = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user