Files
openrouter-python-sdk-retry…/src/openrouter/components/generationcontentdata.py
T

86 lines
2.2 KiB
Python

"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Any, List, Union
from typing_extensions import TypeAliasType, TypedDict
class Input2TypedDict(TypedDict):
messages: List[Nullable[Any]]
class Input2(BaseModel):
messages: List[Nullable[Any]]
class Input1TypedDict(TypedDict):
prompt: str
class Input1(BaseModel):
prompt: str
InputUnionTypedDict = TypeAliasType(
"InputUnionTypedDict", Union[Input1TypedDict, Input2TypedDict]
)
r"""The input to the generation — either a prompt string or an array of messages"""
InputUnion = TypeAliasType("InputUnion", Union[Input1, Input2])
r"""The input to the generation — either a prompt string or an array of messages"""
class GenerationContentDataOutputTypedDict(TypedDict):
r"""The output from the generation"""
completion: Nullable[str]
r"""The completion output"""
reasoning: Nullable[str]
r"""Reasoning/thinking output, if any"""
class GenerationContentDataOutput(BaseModel):
r"""The output from the generation"""
completion: Nullable[str]
r"""The completion output"""
reasoning: Nullable[str]
r"""Reasoning/thinking output, if any"""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k, serialized.get(n))
if val != UNSET_SENTINEL:
m[k] = val
return m
class GenerationContentDataTypedDict(TypedDict):
r"""Stored prompt and completion content"""
input: InputUnionTypedDict
r"""The input to the generation — either a prompt string or an array of messages"""
output: GenerationContentDataOutputTypedDict
r"""The output from the generation"""
class GenerationContentData(BaseModel):
r"""Stored prompt and completion content"""
input: InputUnion
r"""The input to the generation — either a prompt string or an array of messages"""
output: GenerationContentDataOutput
r"""The output from the generation"""