mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-02 12:50:48 +08:00
first commit
This commit is contained in:
@@ -0,0 +1,957 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
from importlib import import_module
|
||||
import builtins
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .annotationdetail import AnnotationDetail, AnnotationDetailTypedDict
|
||||
from .chatcompletion import (
|
||||
ChatCompletion,
|
||||
ChatCompletionObject,
|
||||
ChatCompletionTypedDict,
|
||||
)
|
||||
from .chatcompletionassistantmessageparam import (
|
||||
ChatCompletionAssistantMessageParam,
|
||||
ChatCompletionAssistantMessageParamContent,
|
||||
ChatCompletionAssistantMessageParamContentTypedDict,
|
||||
ChatCompletionAssistantMessageParamRole,
|
||||
ChatCompletionAssistantMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletionchoice import (
|
||||
ChatCompletionChoice,
|
||||
ChatCompletionChoiceFinishReason,
|
||||
ChatCompletionChoiceTypedDict,
|
||||
)
|
||||
from .chatcompletionchunk import (
|
||||
ChatCompletionChunk,
|
||||
ChatCompletionChunkObject,
|
||||
ChatCompletionChunkTypedDict,
|
||||
)
|
||||
from .chatcompletionchunkchoice import (
|
||||
ChatCompletionChunkChoice,
|
||||
ChatCompletionChunkChoiceFinishReason,
|
||||
ChatCompletionChunkChoiceTypedDict,
|
||||
)
|
||||
from .chatcompletionchunkchoicedelta import (
|
||||
ChatCompletionChunkChoiceDelta,
|
||||
ChatCompletionChunkChoiceDeltaRole,
|
||||
ChatCompletionChunkChoiceDeltaTypedDict,
|
||||
)
|
||||
from .chatcompletionchunkchoicedeltatoolcall import (
|
||||
ChatCompletionChunkChoiceDeltaToolCall,
|
||||
ChatCompletionChunkChoiceDeltaToolCallFunction,
|
||||
ChatCompletionChunkChoiceDeltaToolCallFunctionTypedDict,
|
||||
ChatCompletionChunkChoiceDeltaToolCallType,
|
||||
ChatCompletionChunkChoiceDeltaToolCallTypedDict,
|
||||
)
|
||||
from .chatcompletioncontentpart import (
|
||||
ChatCompletionContentPart,
|
||||
ChatCompletionContentPartTypedDict,
|
||||
)
|
||||
from .chatcompletioncontentpartaudio import (
|
||||
ChatCompletionContentPartAudio,
|
||||
ChatCompletionContentPartAudioFormat,
|
||||
ChatCompletionContentPartAudioType,
|
||||
ChatCompletionContentPartAudioTypedDict,
|
||||
InputAudio,
|
||||
InputAudioTypedDict,
|
||||
)
|
||||
from .chatcompletioncontentpartimage import (
|
||||
ChatCompletionContentPartImage,
|
||||
ChatCompletionContentPartImageImageURL,
|
||||
ChatCompletionContentPartImageImageURLTypedDict,
|
||||
ChatCompletionContentPartImageType,
|
||||
ChatCompletionContentPartImageTypedDict,
|
||||
Detail,
|
||||
)
|
||||
from .chatcompletioncontentparttext import (
|
||||
ChatCompletionContentPartText,
|
||||
ChatCompletionContentPartTextType,
|
||||
ChatCompletionContentPartTextTypedDict,
|
||||
)
|
||||
from .chatcompletioncreateparams import (
|
||||
ChatCompletionCreateParams,
|
||||
ChatCompletionCreateParamsAudio,
|
||||
ChatCompletionCreateParamsAudioTypedDict,
|
||||
ChatCompletionCreateParamsCompletion,
|
||||
ChatCompletionCreateParamsCompletionTypedDict,
|
||||
ChatCompletionCreateParamsDataCollection,
|
||||
ChatCompletionCreateParamsEffort,
|
||||
ChatCompletionCreateParamsEngine,
|
||||
ChatCompletionCreateParamsIDChainOfThought,
|
||||
ChatCompletionCreateParamsIDFileParser,
|
||||
ChatCompletionCreateParamsIDModeration,
|
||||
ChatCompletionCreateParamsIDWeb,
|
||||
ChatCompletionCreateParamsIgnoreEnum,
|
||||
ChatCompletionCreateParamsIgnoreUnion,
|
||||
ChatCompletionCreateParamsIgnoreUnionTypedDict,
|
||||
ChatCompletionCreateParamsImage,
|
||||
ChatCompletionCreateParamsImageTypedDict,
|
||||
ChatCompletionCreateParamsJSONSchema,
|
||||
ChatCompletionCreateParamsJSONSchemaTypedDict,
|
||||
ChatCompletionCreateParamsMaxPrice,
|
||||
ChatCompletionCreateParamsMaxPriceTypedDict,
|
||||
ChatCompletionCreateParamsOnlyEnum,
|
||||
ChatCompletionCreateParamsOnlyUnion,
|
||||
ChatCompletionCreateParamsOnlyUnionTypedDict,
|
||||
ChatCompletionCreateParamsOrderEnum,
|
||||
ChatCompletionCreateParamsOrderUnion,
|
||||
ChatCompletionCreateParamsOrderUnionTypedDict,
|
||||
ChatCompletionCreateParamsPdf,
|
||||
ChatCompletionCreateParamsPdfEngine,
|
||||
ChatCompletionCreateParamsPdfTypedDict,
|
||||
ChatCompletionCreateParamsPluginChainOfThought,
|
||||
ChatCompletionCreateParamsPluginChainOfThoughtTypedDict,
|
||||
ChatCompletionCreateParamsPluginFileParser,
|
||||
ChatCompletionCreateParamsPluginFileParserTypedDict,
|
||||
ChatCompletionCreateParamsPluginModeration,
|
||||
ChatCompletionCreateParamsPluginModerationTypedDict,
|
||||
ChatCompletionCreateParamsPluginUnion,
|
||||
ChatCompletionCreateParamsPluginUnionTypedDict,
|
||||
ChatCompletionCreateParamsPluginWeb,
|
||||
ChatCompletionCreateParamsPluginWebTypedDict,
|
||||
ChatCompletionCreateParamsPrompt,
|
||||
ChatCompletionCreateParamsPromptTypedDict,
|
||||
ChatCompletionCreateParamsProvider,
|
||||
ChatCompletionCreateParamsProviderTypedDict,
|
||||
ChatCompletionCreateParamsQuantization,
|
||||
ChatCompletionCreateParamsReasoning,
|
||||
ChatCompletionCreateParamsReasoningEffort,
|
||||
ChatCompletionCreateParamsReasoningTypedDict,
|
||||
ChatCompletionCreateParamsRequest,
|
||||
ChatCompletionCreateParamsRequestTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatGrammar,
|
||||
ChatCompletionCreateParamsResponseFormatGrammarTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatJSONObject,
|
||||
ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatJSONSchema,
|
||||
ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatPython,
|
||||
ChatCompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatText,
|
||||
ChatCompletionCreateParamsResponseFormatTextTypedDict,
|
||||
ChatCompletionCreateParamsResponseFormatUnion,
|
||||
ChatCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
ChatCompletionCreateParamsSort,
|
||||
ChatCompletionCreateParamsStop,
|
||||
ChatCompletionCreateParamsStopTypedDict,
|
||||
ChatCompletionCreateParamsStreamOptions,
|
||||
ChatCompletionCreateParamsStreamOptionsTypedDict,
|
||||
ChatCompletionCreateParamsTypeGrammar,
|
||||
ChatCompletionCreateParamsTypeJSONObject,
|
||||
ChatCompletionCreateParamsTypeJSONSchema,
|
||||
ChatCompletionCreateParamsTypePython,
|
||||
ChatCompletionCreateParamsTypeText,
|
||||
ChatCompletionCreateParamsTypedDict,
|
||||
)
|
||||
from .chatcompletionerror import Error, ErrorTypedDict
|
||||
from .chatcompletionmessage import (
|
||||
ChatCompletionMessage,
|
||||
ChatCompletionMessageRole,
|
||||
ChatCompletionMessageTypedDict,
|
||||
)
|
||||
from .chatcompletionmessageparam import (
|
||||
ChatCompletionMessageParam,
|
||||
ChatCompletionMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletionmessagetoolcall import (
|
||||
ChatCompletionMessageToolCall,
|
||||
ChatCompletionMessageToolCallFunction,
|
||||
ChatCompletionMessageToolCallFunctionTypedDict,
|
||||
ChatCompletionMessageToolCallType,
|
||||
ChatCompletionMessageToolCallTypedDict,
|
||||
)
|
||||
from .chatcompletionnamedtoolchoice import (
|
||||
ChatCompletionNamedToolChoice,
|
||||
ChatCompletionNamedToolChoiceFunction,
|
||||
ChatCompletionNamedToolChoiceFunctionTypedDict,
|
||||
ChatCompletionNamedToolChoiceType,
|
||||
ChatCompletionNamedToolChoiceTypedDict,
|
||||
)
|
||||
from .chatcompletionsystemmessageparam import (
|
||||
ChatCompletionSystemMessageParam,
|
||||
ChatCompletionSystemMessageParamContent,
|
||||
ChatCompletionSystemMessageParamContentTypedDict,
|
||||
ChatCompletionSystemMessageParamRole,
|
||||
ChatCompletionSystemMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletiontokenlogprob import (
|
||||
ChatCompletionTokenLogprob,
|
||||
ChatCompletionTokenLogprobTypedDict,
|
||||
TopLogprob,
|
||||
TopLogprobTypedDict,
|
||||
)
|
||||
from .chatcompletiontokenlogprobs import (
|
||||
ChatCompletionTokenLogprobs,
|
||||
ChatCompletionTokenLogprobsTypedDict,
|
||||
)
|
||||
from .chatcompletiontool import (
|
||||
ChatCompletionTool,
|
||||
ChatCompletionToolFunction,
|
||||
ChatCompletionToolFunctionTypedDict,
|
||||
ChatCompletionToolType,
|
||||
ChatCompletionToolTypedDict,
|
||||
Parameters,
|
||||
ParametersTypedDict,
|
||||
)
|
||||
from .chatcompletiontoolchoiceoption import (
|
||||
ChatCompletionToolChoiceOption,
|
||||
ChatCompletionToolChoiceOptionAuto,
|
||||
ChatCompletionToolChoiceOptionNone,
|
||||
ChatCompletionToolChoiceOptionRequired,
|
||||
ChatCompletionToolChoiceOptionTypedDict,
|
||||
)
|
||||
from .chatcompletiontoolmessageparam import (
|
||||
ChatCompletionToolMessageParam,
|
||||
ChatCompletionToolMessageParamContent,
|
||||
ChatCompletionToolMessageParamContentTypedDict,
|
||||
ChatCompletionToolMessageParamRole,
|
||||
ChatCompletionToolMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletionusermessageparam import (
|
||||
ChatCompletionUserMessageParam,
|
||||
ChatCompletionUserMessageParamContent,
|
||||
ChatCompletionUserMessageParamContentTypedDict,
|
||||
ChatCompletionUserMessageParamRole,
|
||||
ChatCompletionUserMessageParamTypedDict,
|
||||
)
|
||||
from .chatstreamcompletioncreateparams import (
|
||||
ChatStreamCompletionCreateParams,
|
||||
ChatStreamCompletionCreateParamsAudio,
|
||||
ChatStreamCompletionCreateParamsAudioTypedDict,
|
||||
ChatStreamCompletionCreateParamsCompletion,
|
||||
ChatStreamCompletionCreateParamsCompletionTypedDict,
|
||||
ChatStreamCompletionCreateParamsDataCollection,
|
||||
ChatStreamCompletionCreateParamsEffort,
|
||||
ChatStreamCompletionCreateParamsEngine,
|
||||
ChatStreamCompletionCreateParamsIDChainOfThought,
|
||||
ChatStreamCompletionCreateParamsIDFileParser,
|
||||
ChatStreamCompletionCreateParamsIDModeration,
|
||||
ChatStreamCompletionCreateParamsIDWeb,
|
||||
ChatStreamCompletionCreateParamsIgnoreEnum,
|
||||
ChatStreamCompletionCreateParamsIgnoreUnion,
|
||||
ChatStreamCompletionCreateParamsIgnoreUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsImage,
|
||||
ChatStreamCompletionCreateParamsImageTypedDict,
|
||||
ChatStreamCompletionCreateParamsJSONSchema,
|
||||
ChatStreamCompletionCreateParamsJSONSchemaTypedDict,
|
||||
ChatStreamCompletionCreateParamsMaxPrice,
|
||||
ChatStreamCompletionCreateParamsMaxPriceTypedDict,
|
||||
ChatStreamCompletionCreateParamsOnlyEnum,
|
||||
ChatStreamCompletionCreateParamsOnlyUnion,
|
||||
ChatStreamCompletionCreateParamsOnlyUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsOrderEnum,
|
||||
ChatStreamCompletionCreateParamsOrderUnion,
|
||||
ChatStreamCompletionCreateParamsOrderUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsPdf,
|
||||
ChatStreamCompletionCreateParamsPdfEngine,
|
||||
ChatStreamCompletionCreateParamsPdfTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginChainOfThought,
|
||||
ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginFileParser,
|
||||
ChatStreamCompletionCreateParamsPluginFileParserTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginModeration,
|
||||
ChatStreamCompletionCreateParamsPluginModerationTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginUnion,
|
||||
ChatStreamCompletionCreateParamsPluginUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsPluginWeb,
|
||||
ChatStreamCompletionCreateParamsPluginWebTypedDict,
|
||||
ChatStreamCompletionCreateParamsPrompt,
|
||||
ChatStreamCompletionCreateParamsPromptTypedDict,
|
||||
ChatStreamCompletionCreateParamsProvider,
|
||||
ChatStreamCompletionCreateParamsProviderTypedDict,
|
||||
ChatStreamCompletionCreateParamsQuantization,
|
||||
ChatStreamCompletionCreateParamsReasoning,
|
||||
ChatStreamCompletionCreateParamsReasoningEffort,
|
||||
ChatStreamCompletionCreateParamsReasoningTypedDict,
|
||||
ChatStreamCompletionCreateParamsRequest,
|
||||
ChatStreamCompletionCreateParamsRequestTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatGrammar,
|
||||
ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONObject,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONSchema,
|
||||
ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatPython,
|
||||
ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatText,
|
||||
ChatStreamCompletionCreateParamsResponseFormatTextTypedDict,
|
||||
ChatStreamCompletionCreateParamsResponseFormatUnion,
|
||||
ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict,
|
||||
ChatStreamCompletionCreateParamsSort,
|
||||
ChatStreamCompletionCreateParamsStop,
|
||||
ChatStreamCompletionCreateParamsStopTypedDict,
|
||||
ChatStreamCompletionCreateParamsStreamOptions,
|
||||
ChatStreamCompletionCreateParamsStreamOptionsTypedDict,
|
||||
ChatStreamCompletionCreateParamsTypeGrammar,
|
||||
ChatStreamCompletionCreateParamsTypeJSONObject,
|
||||
ChatStreamCompletionCreateParamsTypeJSONSchema,
|
||||
ChatStreamCompletionCreateParamsTypePython,
|
||||
ChatStreamCompletionCreateParamsTypeText,
|
||||
ChatStreamCompletionCreateParamsTypedDict,
|
||||
)
|
||||
from .completionusage import (
|
||||
CompletionTokensDetails,
|
||||
CompletionTokensDetailsTypedDict,
|
||||
CompletionUsage,
|
||||
CompletionUsageTypedDict,
|
||||
PromptTokensDetails,
|
||||
PromptTokensDetailsTypedDict,
|
||||
)
|
||||
from .fileannotationdetail import (
|
||||
ContentImageURL,
|
||||
ContentImageURLTypedDict,
|
||||
ContentText,
|
||||
ContentTextTypedDict,
|
||||
ContentTypeImageURL,
|
||||
ContentTypeText,
|
||||
File,
|
||||
FileAnnotationDetail,
|
||||
FileAnnotationDetailContentUnion,
|
||||
FileAnnotationDetailContentUnionTypedDict,
|
||||
FileAnnotationDetailImageURL,
|
||||
FileAnnotationDetailImageURLTypedDict,
|
||||
FileAnnotationDetailTypedDict,
|
||||
FileTypedDict,
|
||||
TypeFile,
|
||||
)
|
||||
from .reasoningdetail import ReasoningDetail, ReasoningDetailTypedDict
|
||||
from .reasoningdetailencrypted import (
|
||||
ReasoningDetailEncrypted,
|
||||
ReasoningDetailEncryptedFormat,
|
||||
ReasoningDetailEncryptedType,
|
||||
ReasoningDetailEncryptedTypedDict,
|
||||
)
|
||||
from .reasoningdetailsummary import (
|
||||
ReasoningDetailSummary,
|
||||
ReasoningDetailSummaryFormat,
|
||||
ReasoningDetailSummaryType,
|
||||
ReasoningDetailSummaryTypedDict,
|
||||
)
|
||||
from .reasoningdetailtext import (
|
||||
ReasoningDetailText,
|
||||
ReasoningDetailTextFormat,
|
||||
ReasoningDetailTextType,
|
||||
ReasoningDetailTextTypedDict,
|
||||
)
|
||||
from .responseformatjsonschemaschema import (
|
||||
ResponseFormatJSONSchemaSchema,
|
||||
ResponseFormatJSONSchemaSchemaTypedDict,
|
||||
)
|
||||
from .security import Security, SecurityTypedDict
|
||||
from .streamchatcompletionop import (
|
||||
StreamChatCompletionResponseBody,
|
||||
StreamChatCompletionResponseBodyTypedDict,
|
||||
)
|
||||
from .urlcitationannotationdetail import (
|
||||
URLCitation,
|
||||
URLCitationAnnotationDetail,
|
||||
URLCitationAnnotationDetailType,
|
||||
URLCitationAnnotationDetailTypedDict,
|
||||
URLCitationTypedDict,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"AnnotationDetail",
|
||||
"AnnotationDetailTypedDict",
|
||||
"ChatCompletion",
|
||||
"ChatCompletionAssistantMessageParam",
|
||||
"ChatCompletionAssistantMessageParamContent",
|
||||
"ChatCompletionAssistantMessageParamContentTypedDict",
|
||||
"ChatCompletionAssistantMessageParamRole",
|
||||
"ChatCompletionAssistantMessageParamTypedDict",
|
||||
"ChatCompletionChoice",
|
||||
"ChatCompletionChoiceFinishReason",
|
||||
"ChatCompletionChoiceTypedDict",
|
||||
"ChatCompletionChunk",
|
||||
"ChatCompletionChunkChoice",
|
||||
"ChatCompletionChunkChoiceDelta",
|
||||
"ChatCompletionChunkChoiceDeltaRole",
|
||||
"ChatCompletionChunkChoiceDeltaToolCall",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallFunction",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallFunctionTypedDict",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallType",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallTypedDict",
|
||||
"ChatCompletionChunkChoiceDeltaTypedDict",
|
||||
"ChatCompletionChunkChoiceFinishReason",
|
||||
"ChatCompletionChunkChoiceTypedDict",
|
||||
"ChatCompletionChunkObject",
|
||||
"ChatCompletionChunkTypedDict",
|
||||
"ChatCompletionContentPart",
|
||||
"ChatCompletionContentPartAudio",
|
||||
"ChatCompletionContentPartAudioFormat",
|
||||
"ChatCompletionContentPartAudioType",
|
||||
"ChatCompletionContentPartAudioTypedDict",
|
||||
"ChatCompletionContentPartImage",
|
||||
"ChatCompletionContentPartImageImageURL",
|
||||
"ChatCompletionContentPartImageImageURLTypedDict",
|
||||
"ChatCompletionContentPartImageType",
|
||||
"ChatCompletionContentPartImageTypedDict",
|
||||
"ChatCompletionContentPartText",
|
||||
"ChatCompletionContentPartTextType",
|
||||
"ChatCompletionContentPartTextTypedDict",
|
||||
"ChatCompletionContentPartTypedDict",
|
||||
"ChatCompletionCreateParams",
|
||||
"ChatCompletionCreateParamsAudio",
|
||||
"ChatCompletionCreateParamsAudioTypedDict",
|
||||
"ChatCompletionCreateParamsCompletion",
|
||||
"ChatCompletionCreateParamsCompletionTypedDict",
|
||||
"ChatCompletionCreateParamsDataCollection",
|
||||
"ChatCompletionCreateParamsEffort",
|
||||
"ChatCompletionCreateParamsEngine",
|
||||
"ChatCompletionCreateParamsIDChainOfThought",
|
||||
"ChatCompletionCreateParamsIDFileParser",
|
||||
"ChatCompletionCreateParamsIDModeration",
|
||||
"ChatCompletionCreateParamsIDWeb",
|
||||
"ChatCompletionCreateParamsIgnoreEnum",
|
||||
"ChatCompletionCreateParamsIgnoreUnion",
|
||||
"ChatCompletionCreateParamsIgnoreUnionTypedDict",
|
||||
"ChatCompletionCreateParamsImage",
|
||||
"ChatCompletionCreateParamsImageTypedDict",
|
||||
"ChatCompletionCreateParamsJSONSchema",
|
||||
"ChatCompletionCreateParamsJSONSchemaTypedDict",
|
||||
"ChatCompletionCreateParamsMaxPrice",
|
||||
"ChatCompletionCreateParamsMaxPriceTypedDict",
|
||||
"ChatCompletionCreateParamsOnlyEnum",
|
||||
"ChatCompletionCreateParamsOnlyUnion",
|
||||
"ChatCompletionCreateParamsOnlyUnionTypedDict",
|
||||
"ChatCompletionCreateParamsOrderEnum",
|
||||
"ChatCompletionCreateParamsOrderUnion",
|
||||
"ChatCompletionCreateParamsOrderUnionTypedDict",
|
||||
"ChatCompletionCreateParamsPdf",
|
||||
"ChatCompletionCreateParamsPdfEngine",
|
||||
"ChatCompletionCreateParamsPdfTypedDict",
|
||||
"ChatCompletionCreateParamsPluginChainOfThought",
|
||||
"ChatCompletionCreateParamsPluginChainOfThoughtTypedDict",
|
||||
"ChatCompletionCreateParamsPluginFileParser",
|
||||
"ChatCompletionCreateParamsPluginFileParserTypedDict",
|
||||
"ChatCompletionCreateParamsPluginModeration",
|
||||
"ChatCompletionCreateParamsPluginModerationTypedDict",
|
||||
"ChatCompletionCreateParamsPluginUnion",
|
||||
"ChatCompletionCreateParamsPluginUnionTypedDict",
|
||||
"ChatCompletionCreateParamsPluginWeb",
|
||||
"ChatCompletionCreateParamsPluginWebTypedDict",
|
||||
"ChatCompletionCreateParamsPrompt",
|
||||
"ChatCompletionCreateParamsPromptTypedDict",
|
||||
"ChatCompletionCreateParamsProvider",
|
||||
"ChatCompletionCreateParamsProviderTypedDict",
|
||||
"ChatCompletionCreateParamsQuantization",
|
||||
"ChatCompletionCreateParamsReasoning",
|
||||
"ChatCompletionCreateParamsReasoningEffort",
|
||||
"ChatCompletionCreateParamsReasoningTypedDict",
|
||||
"ChatCompletionCreateParamsRequest",
|
||||
"ChatCompletionCreateParamsRequestTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammar",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammarTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObject",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchema",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatPython",
|
||||
"ChatCompletionCreateParamsResponseFormatPythonTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatText",
|
||||
"ChatCompletionCreateParamsResponseFormatTextTypedDict",
|
||||
"ChatCompletionCreateParamsResponseFormatUnion",
|
||||
"ChatCompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
"ChatCompletionCreateParamsSort",
|
||||
"ChatCompletionCreateParamsStop",
|
||||
"ChatCompletionCreateParamsStopTypedDict",
|
||||
"ChatCompletionCreateParamsStreamOptions",
|
||||
"ChatCompletionCreateParamsStreamOptionsTypedDict",
|
||||
"ChatCompletionCreateParamsTypeGrammar",
|
||||
"ChatCompletionCreateParamsTypeJSONObject",
|
||||
"ChatCompletionCreateParamsTypeJSONSchema",
|
||||
"ChatCompletionCreateParamsTypePython",
|
||||
"ChatCompletionCreateParamsTypeText",
|
||||
"ChatCompletionCreateParamsTypedDict",
|
||||
"ChatCompletionMessage",
|
||||
"ChatCompletionMessageParam",
|
||||
"ChatCompletionMessageParamTypedDict",
|
||||
"ChatCompletionMessageRole",
|
||||
"ChatCompletionMessageToolCall",
|
||||
"ChatCompletionMessageToolCallFunction",
|
||||
"ChatCompletionMessageToolCallFunctionTypedDict",
|
||||
"ChatCompletionMessageToolCallType",
|
||||
"ChatCompletionMessageToolCallTypedDict",
|
||||
"ChatCompletionMessageTypedDict",
|
||||
"ChatCompletionNamedToolChoice",
|
||||
"ChatCompletionNamedToolChoiceFunction",
|
||||
"ChatCompletionNamedToolChoiceFunctionTypedDict",
|
||||
"ChatCompletionNamedToolChoiceType",
|
||||
"ChatCompletionNamedToolChoiceTypedDict",
|
||||
"ChatCompletionObject",
|
||||
"ChatCompletionSystemMessageParam",
|
||||
"ChatCompletionSystemMessageParamContent",
|
||||
"ChatCompletionSystemMessageParamContentTypedDict",
|
||||
"ChatCompletionSystemMessageParamRole",
|
||||
"ChatCompletionSystemMessageParamTypedDict",
|
||||
"ChatCompletionTokenLogprob",
|
||||
"ChatCompletionTokenLogprobTypedDict",
|
||||
"ChatCompletionTokenLogprobs",
|
||||
"ChatCompletionTokenLogprobsTypedDict",
|
||||
"ChatCompletionTool",
|
||||
"ChatCompletionToolChoiceOption",
|
||||
"ChatCompletionToolChoiceOptionAuto",
|
||||
"ChatCompletionToolChoiceOptionNone",
|
||||
"ChatCompletionToolChoiceOptionRequired",
|
||||
"ChatCompletionToolChoiceOptionTypedDict",
|
||||
"ChatCompletionToolFunction",
|
||||
"ChatCompletionToolFunctionTypedDict",
|
||||
"ChatCompletionToolMessageParam",
|
||||
"ChatCompletionToolMessageParamContent",
|
||||
"ChatCompletionToolMessageParamContentTypedDict",
|
||||
"ChatCompletionToolMessageParamRole",
|
||||
"ChatCompletionToolMessageParamTypedDict",
|
||||
"ChatCompletionToolType",
|
||||
"ChatCompletionToolTypedDict",
|
||||
"ChatCompletionTypedDict",
|
||||
"ChatCompletionUserMessageParam",
|
||||
"ChatCompletionUserMessageParamContent",
|
||||
"ChatCompletionUserMessageParamContentTypedDict",
|
||||
"ChatCompletionUserMessageParamRole",
|
||||
"ChatCompletionUserMessageParamTypedDict",
|
||||
"ChatStreamCompletionCreateParams",
|
||||
"ChatStreamCompletionCreateParamsAudio",
|
||||
"ChatStreamCompletionCreateParamsAudioTypedDict",
|
||||
"ChatStreamCompletionCreateParamsCompletion",
|
||||
"ChatStreamCompletionCreateParamsCompletionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsDataCollection",
|
||||
"ChatStreamCompletionCreateParamsEffort",
|
||||
"ChatStreamCompletionCreateParamsEngine",
|
||||
"ChatStreamCompletionCreateParamsIDChainOfThought",
|
||||
"ChatStreamCompletionCreateParamsIDFileParser",
|
||||
"ChatStreamCompletionCreateParamsIDModeration",
|
||||
"ChatStreamCompletionCreateParamsIDWeb",
|
||||
"ChatStreamCompletionCreateParamsIgnoreEnum",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnion",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsImage",
|
||||
"ChatStreamCompletionCreateParamsImageTypedDict",
|
||||
"ChatStreamCompletionCreateParamsJSONSchema",
|
||||
"ChatStreamCompletionCreateParamsJSONSchemaTypedDict",
|
||||
"ChatStreamCompletionCreateParamsMaxPrice",
|
||||
"ChatStreamCompletionCreateParamsMaxPriceTypedDict",
|
||||
"ChatStreamCompletionCreateParamsOnlyEnum",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnion",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsOrderEnum",
|
||||
"ChatStreamCompletionCreateParamsOrderUnion",
|
||||
"ChatStreamCompletionCreateParamsOrderUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPdf",
|
||||
"ChatStreamCompletionCreateParamsPdfEngine",
|
||||
"ChatStreamCompletionCreateParamsPdfTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThought",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParser",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParserTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginModeration",
|
||||
"ChatStreamCompletionCreateParamsPluginModerationTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginUnion",
|
||||
"ChatStreamCompletionCreateParamsPluginUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPluginWeb",
|
||||
"ChatStreamCompletionCreateParamsPluginWebTypedDict",
|
||||
"ChatStreamCompletionCreateParamsPrompt",
|
||||
"ChatStreamCompletionCreateParamsPromptTypedDict",
|
||||
"ChatStreamCompletionCreateParamsProvider",
|
||||
"ChatStreamCompletionCreateParamsProviderTypedDict",
|
||||
"ChatStreamCompletionCreateParamsQuantization",
|
||||
"ChatStreamCompletionCreateParamsReasoning",
|
||||
"ChatStreamCompletionCreateParamsReasoningEffort",
|
||||
"ChatStreamCompletionCreateParamsReasoningTypedDict",
|
||||
"ChatStreamCompletionCreateParamsRequest",
|
||||
"ChatStreamCompletionCreateParamsRequestTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammar",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObject",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchema",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPython",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatText",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatTextTypedDict",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnion",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict",
|
||||
"ChatStreamCompletionCreateParamsSort",
|
||||
"ChatStreamCompletionCreateParamsStop",
|
||||
"ChatStreamCompletionCreateParamsStopTypedDict",
|
||||
"ChatStreamCompletionCreateParamsStreamOptions",
|
||||
"ChatStreamCompletionCreateParamsStreamOptionsTypedDict",
|
||||
"ChatStreamCompletionCreateParamsTypeGrammar",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONObject",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONSchema",
|
||||
"ChatStreamCompletionCreateParamsTypePython",
|
||||
"ChatStreamCompletionCreateParamsTypeText",
|
||||
"ChatStreamCompletionCreateParamsTypedDict",
|
||||
"CompletionTokensDetails",
|
||||
"CompletionTokensDetailsTypedDict",
|
||||
"CompletionUsage",
|
||||
"CompletionUsageTypedDict",
|
||||
"ContentImageURL",
|
||||
"ContentImageURLTypedDict",
|
||||
"ContentText",
|
||||
"ContentTextTypedDict",
|
||||
"ContentTypeImageURL",
|
||||
"ContentTypeText",
|
||||
"Detail",
|
||||
"Error",
|
||||
"ErrorTypedDict",
|
||||
"File",
|
||||
"FileAnnotationDetail",
|
||||
"FileAnnotationDetailContentUnion",
|
||||
"FileAnnotationDetailContentUnionTypedDict",
|
||||
"FileAnnotationDetailImageURL",
|
||||
"FileAnnotationDetailImageURLTypedDict",
|
||||
"FileAnnotationDetailTypedDict",
|
||||
"FileTypedDict",
|
||||
"InputAudio",
|
||||
"InputAudioTypedDict",
|
||||
"Parameters",
|
||||
"ParametersTypedDict",
|
||||
"PromptTokensDetails",
|
||||
"PromptTokensDetailsTypedDict",
|
||||
"ReasoningDetail",
|
||||
"ReasoningDetailEncrypted",
|
||||
"ReasoningDetailEncryptedFormat",
|
||||
"ReasoningDetailEncryptedType",
|
||||
"ReasoningDetailEncryptedTypedDict",
|
||||
"ReasoningDetailSummary",
|
||||
"ReasoningDetailSummaryFormat",
|
||||
"ReasoningDetailSummaryType",
|
||||
"ReasoningDetailSummaryTypedDict",
|
||||
"ReasoningDetailText",
|
||||
"ReasoningDetailTextFormat",
|
||||
"ReasoningDetailTextType",
|
||||
"ReasoningDetailTextTypedDict",
|
||||
"ReasoningDetailTypedDict",
|
||||
"ResponseFormatJSONSchemaSchema",
|
||||
"ResponseFormatJSONSchemaSchemaTypedDict",
|
||||
"Security",
|
||||
"SecurityTypedDict",
|
||||
"StreamChatCompletionResponseBody",
|
||||
"StreamChatCompletionResponseBodyTypedDict",
|
||||
"TopLogprob",
|
||||
"TopLogprobTypedDict",
|
||||
"TypeFile",
|
||||
"URLCitation",
|
||||
"URLCitationAnnotationDetail",
|
||||
"URLCitationAnnotationDetailType",
|
||||
"URLCitationAnnotationDetailTypedDict",
|
||||
"URLCitationTypedDict",
|
||||
]
|
||||
|
||||
_dynamic_imports: dict[str, str] = {
|
||||
"AnnotationDetail": ".annotationdetail",
|
||||
"AnnotationDetailTypedDict": ".annotationdetail",
|
||||
"ChatCompletion": ".chatcompletion",
|
||||
"ChatCompletionObject": ".chatcompletion",
|
||||
"ChatCompletionTypedDict": ".chatcompletion",
|
||||
"ChatCompletionAssistantMessageParam": ".chatcompletionassistantmessageparam",
|
||||
"ChatCompletionAssistantMessageParamContent": ".chatcompletionassistantmessageparam",
|
||||
"ChatCompletionAssistantMessageParamContentTypedDict": ".chatcompletionassistantmessageparam",
|
||||
"ChatCompletionAssistantMessageParamRole": ".chatcompletionassistantmessageparam",
|
||||
"ChatCompletionAssistantMessageParamTypedDict": ".chatcompletionassistantmessageparam",
|
||||
"ChatCompletionChoice": ".chatcompletionchoice",
|
||||
"ChatCompletionChoiceFinishReason": ".chatcompletionchoice",
|
||||
"ChatCompletionChoiceTypedDict": ".chatcompletionchoice",
|
||||
"ChatCompletionChunk": ".chatcompletionchunk",
|
||||
"ChatCompletionChunkObject": ".chatcompletionchunk",
|
||||
"ChatCompletionChunkTypedDict": ".chatcompletionchunk",
|
||||
"ChatCompletionChunkChoice": ".chatcompletionchunkchoice",
|
||||
"ChatCompletionChunkChoiceFinishReason": ".chatcompletionchunkchoice",
|
||||
"ChatCompletionChunkChoiceTypedDict": ".chatcompletionchunkchoice",
|
||||
"ChatCompletionChunkChoiceDelta": ".chatcompletionchunkchoicedelta",
|
||||
"ChatCompletionChunkChoiceDeltaRole": ".chatcompletionchunkchoicedelta",
|
||||
"ChatCompletionChunkChoiceDeltaTypedDict": ".chatcompletionchunkchoicedelta",
|
||||
"ChatCompletionChunkChoiceDeltaToolCall": ".chatcompletionchunkchoicedeltatoolcall",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallFunction": ".chatcompletionchunkchoicedeltatoolcall",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallFunctionTypedDict": ".chatcompletionchunkchoicedeltatoolcall",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallType": ".chatcompletionchunkchoicedeltatoolcall",
|
||||
"ChatCompletionChunkChoiceDeltaToolCallTypedDict": ".chatcompletionchunkchoicedeltatoolcall",
|
||||
"ChatCompletionContentPart": ".chatcompletioncontentpart",
|
||||
"ChatCompletionContentPartTypedDict": ".chatcompletioncontentpart",
|
||||
"ChatCompletionContentPartAudio": ".chatcompletioncontentpartaudio",
|
||||
"ChatCompletionContentPartAudioFormat": ".chatcompletioncontentpartaudio",
|
||||
"ChatCompletionContentPartAudioType": ".chatcompletioncontentpartaudio",
|
||||
"ChatCompletionContentPartAudioTypedDict": ".chatcompletioncontentpartaudio",
|
||||
"InputAudio": ".chatcompletioncontentpartaudio",
|
||||
"InputAudioTypedDict": ".chatcompletioncontentpartaudio",
|
||||
"ChatCompletionContentPartImage": ".chatcompletioncontentpartimage",
|
||||
"ChatCompletionContentPartImageImageURL": ".chatcompletioncontentpartimage",
|
||||
"ChatCompletionContentPartImageImageURLTypedDict": ".chatcompletioncontentpartimage",
|
||||
"ChatCompletionContentPartImageType": ".chatcompletioncontentpartimage",
|
||||
"ChatCompletionContentPartImageTypedDict": ".chatcompletioncontentpartimage",
|
||||
"Detail": ".chatcompletioncontentpartimage",
|
||||
"ChatCompletionContentPartText": ".chatcompletioncontentparttext",
|
||||
"ChatCompletionContentPartTextType": ".chatcompletioncontentparttext",
|
||||
"ChatCompletionContentPartTextTypedDict": ".chatcompletioncontentparttext",
|
||||
"ChatCompletionCreateParams": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsAudio": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsAudioTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsCompletion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsCompletionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsDataCollection": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsEffort": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsEngine": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDChainOfThought": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDFileParser": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDModeration": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIDWeb": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIgnoreEnum": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIgnoreUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsIgnoreUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsImage": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsImageTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsJSONSchema": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsJSONSchemaTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsMaxPrice": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsMaxPriceTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOnlyEnum": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOnlyUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOnlyUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOrderEnum": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOrderUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsOrderUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPdf": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPdfEngine": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPdfTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginChainOfThought": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginChainOfThoughtTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginFileParser": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginFileParserTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginModeration": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginModerationTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginWeb": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPluginWebTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPrompt": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsPromptTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsProvider": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsProviderTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsQuantization": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsReasoning": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsReasoningEffort": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsReasoningTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsRequest": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsRequestTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammar": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatGrammarTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObject": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchema": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatPython": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatPythonTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatText": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatTextTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatUnion": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsResponseFormatUnionTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsSort": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStop": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStopTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStreamOptions": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsStreamOptionsTypedDict": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeGrammar": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeJSONObject": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeJSONSchema": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypePython": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypeText": ".chatcompletioncreateparams",
|
||||
"ChatCompletionCreateParamsTypedDict": ".chatcompletioncreateparams",
|
||||
"Error": ".chatcompletionerror",
|
||||
"ErrorTypedDict": ".chatcompletionerror",
|
||||
"ChatCompletionMessage": ".chatcompletionmessage",
|
||||
"ChatCompletionMessageRole": ".chatcompletionmessage",
|
||||
"ChatCompletionMessageTypedDict": ".chatcompletionmessage",
|
||||
"ChatCompletionMessageParam": ".chatcompletionmessageparam",
|
||||
"ChatCompletionMessageParamTypedDict": ".chatcompletionmessageparam",
|
||||
"ChatCompletionMessageToolCall": ".chatcompletionmessagetoolcall",
|
||||
"ChatCompletionMessageToolCallFunction": ".chatcompletionmessagetoolcall",
|
||||
"ChatCompletionMessageToolCallFunctionTypedDict": ".chatcompletionmessagetoolcall",
|
||||
"ChatCompletionMessageToolCallType": ".chatcompletionmessagetoolcall",
|
||||
"ChatCompletionMessageToolCallTypedDict": ".chatcompletionmessagetoolcall",
|
||||
"ChatCompletionNamedToolChoice": ".chatcompletionnamedtoolchoice",
|
||||
"ChatCompletionNamedToolChoiceFunction": ".chatcompletionnamedtoolchoice",
|
||||
"ChatCompletionNamedToolChoiceFunctionTypedDict": ".chatcompletionnamedtoolchoice",
|
||||
"ChatCompletionNamedToolChoiceType": ".chatcompletionnamedtoolchoice",
|
||||
"ChatCompletionNamedToolChoiceTypedDict": ".chatcompletionnamedtoolchoice",
|
||||
"ChatCompletionSystemMessageParam": ".chatcompletionsystemmessageparam",
|
||||
"ChatCompletionSystemMessageParamContent": ".chatcompletionsystemmessageparam",
|
||||
"ChatCompletionSystemMessageParamContentTypedDict": ".chatcompletionsystemmessageparam",
|
||||
"ChatCompletionSystemMessageParamRole": ".chatcompletionsystemmessageparam",
|
||||
"ChatCompletionSystemMessageParamTypedDict": ".chatcompletionsystemmessageparam",
|
||||
"ChatCompletionTokenLogprob": ".chatcompletiontokenlogprob",
|
||||
"ChatCompletionTokenLogprobTypedDict": ".chatcompletiontokenlogprob",
|
||||
"TopLogprob": ".chatcompletiontokenlogprob",
|
||||
"TopLogprobTypedDict": ".chatcompletiontokenlogprob",
|
||||
"ChatCompletionTokenLogprobs": ".chatcompletiontokenlogprobs",
|
||||
"ChatCompletionTokenLogprobsTypedDict": ".chatcompletiontokenlogprobs",
|
||||
"ChatCompletionTool": ".chatcompletiontool",
|
||||
"ChatCompletionToolFunction": ".chatcompletiontool",
|
||||
"ChatCompletionToolFunctionTypedDict": ".chatcompletiontool",
|
||||
"ChatCompletionToolType": ".chatcompletiontool",
|
||||
"ChatCompletionToolTypedDict": ".chatcompletiontool",
|
||||
"Parameters": ".chatcompletiontool",
|
||||
"ParametersTypedDict": ".chatcompletiontool",
|
||||
"ChatCompletionToolChoiceOption": ".chatcompletiontoolchoiceoption",
|
||||
"ChatCompletionToolChoiceOptionAuto": ".chatcompletiontoolchoiceoption",
|
||||
"ChatCompletionToolChoiceOptionNone": ".chatcompletiontoolchoiceoption",
|
||||
"ChatCompletionToolChoiceOptionRequired": ".chatcompletiontoolchoiceoption",
|
||||
"ChatCompletionToolChoiceOptionTypedDict": ".chatcompletiontoolchoiceoption",
|
||||
"ChatCompletionToolMessageParam": ".chatcompletiontoolmessageparam",
|
||||
"ChatCompletionToolMessageParamContent": ".chatcompletiontoolmessageparam",
|
||||
"ChatCompletionToolMessageParamContentTypedDict": ".chatcompletiontoolmessageparam",
|
||||
"ChatCompletionToolMessageParamRole": ".chatcompletiontoolmessageparam",
|
||||
"ChatCompletionToolMessageParamTypedDict": ".chatcompletiontoolmessageparam",
|
||||
"ChatCompletionUserMessageParam": ".chatcompletionusermessageparam",
|
||||
"ChatCompletionUserMessageParamContent": ".chatcompletionusermessageparam",
|
||||
"ChatCompletionUserMessageParamContentTypedDict": ".chatcompletionusermessageparam",
|
||||
"ChatCompletionUserMessageParamRole": ".chatcompletionusermessageparam",
|
||||
"ChatCompletionUserMessageParamTypedDict": ".chatcompletionusermessageparam",
|
||||
"ChatStreamCompletionCreateParams": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsAudio": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsAudioTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsCompletion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsCompletionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsDataCollection": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsEffort": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsEngine": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDChainOfThought": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDFileParser": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDModeration": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIDWeb": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIgnoreEnum": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsIgnoreUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsImage": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsImageTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsJSONSchema": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsJSONSchemaTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsMaxPrice": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsMaxPriceTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOnlyEnum": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOnlyUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOrderEnum": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOrderUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsOrderUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPdf": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPdfEngine": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPdfTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThought": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParser": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginFileParserTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginModeration": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginModerationTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginWeb": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPluginWebTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPrompt": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsPromptTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsProvider": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsProviderTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsQuantization": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsReasoning": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsReasoningEffort": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsReasoningTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsRequest": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsRequestTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammar": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObject": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchema": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPython": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatText": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatTextTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnion": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsSort": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStop": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStopTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStreamOptions": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsStreamOptionsTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeGrammar": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONObject": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeJSONSchema": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypePython": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypeText": ".chatstreamcompletioncreateparams",
|
||||
"ChatStreamCompletionCreateParamsTypedDict": ".chatstreamcompletioncreateparams",
|
||||
"CompletionTokensDetails": ".completionusage",
|
||||
"CompletionTokensDetailsTypedDict": ".completionusage",
|
||||
"CompletionUsage": ".completionusage",
|
||||
"CompletionUsageTypedDict": ".completionusage",
|
||||
"PromptTokensDetails": ".completionusage",
|
||||
"PromptTokensDetailsTypedDict": ".completionusage",
|
||||
"ContentImageURL": ".fileannotationdetail",
|
||||
"ContentImageURLTypedDict": ".fileannotationdetail",
|
||||
"ContentText": ".fileannotationdetail",
|
||||
"ContentTextTypedDict": ".fileannotationdetail",
|
||||
"ContentTypeImageURL": ".fileannotationdetail",
|
||||
"ContentTypeText": ".fileannotationdetail",
|
||||
"File": ".fileannotationdetail",
|
||||
"FileAnnotationDetail": ".fileannotationdetail",
|
||||
"FileAnnotationDetailContentUnion": ".fileannotationdetail",
|
||||
"FileAnnotationDetailContentUnionTypedDict": ".fileannotationdetail",
|
||||
"FileAnnotationDetailImageURL": ".fileannotationdetail",
|
||||
"FileAnnotationDetailImageURLTypedDict": ".fileannotationdetail",
|
||||
"FileAnnotationDetailTypedDict": ".fileannotationdetail",
|
||||
"FileTypedDict": ".fileannotationdetail",
|
||||
"TypeFile": ".fileannotationdetail",
|
||||
"ReasoningDetail": ".reasoningdetail",
|
||||
"ReasoningDetailTypedDict": ".reasoningdetail",
|
||||
"ReasoningDetailEncrypted": ".reasoningdetailencrypted",
|
||||
"ReasoningDetailEncryptedFormat": ".reasoningdetailencrypted",
|
||||
"ReasoningDetailEncryptedType": ".reasoningdetailencrypted",
|
||||
"ReasoningDetailEncryptedTypedDict": ".reasoningdetailencrypted",
|
||||
"ReasoningDetailSummary": ".reasoningdetailsummary",
|
||||
"ReasoningDetailSummaryFormat": ".reasoningdetailsummary",
|
||||
"ReasoningDetailSummaryType": ".reasoningdetailsummary",
|
||||
"ReasoningDetailSummaryTypedDict": ".reasoningdetailsummary",
|
||||
"ReasoningDetailText": ".reasoningdetailtext",
|
||||
"ReasoningDetailTextFormat": ".reasoningdetailtext",
|
||||
"ReasoningDetailTextType": ".reasoningdetailtext",
|
||||
"ReasoningDetailTextTypedDict": ".reasoningdetailtext",
|
||||
"ResponseFormatJSONSchemaSchema": ".responseformatjsonschemaschema",
|
||||
"ResponseFormatJSONSchemaSchemaTypedDict": ".responseformatjsonschemaschema",
|
||||
"Security": ".security",
|
||||
"SecurityTypedDict": ".security",
|
||||
"StreamChatCompletionResponseBody": ".streamchatcompletionop",
|
||||
"StreamChatCompletionResponseBodyTypedDict": ".streamchatcompletionop",
|
||||
"URLCitation": ".urlcitationannotationdetail",
|
||||
"URLCitationAnnotationDetail": ".urlcitationannotationdetail",
|
||||
"URLCitationAnnotationDetailType": ".urlcitationannotationdetail",
|
||||
"URLCitationAnnotationDetailTypedDict": ".urlcitationannotationdetail",
|
||||
"URLCitationTypedDict": ".urlcitationannotationdetail",
|
||||
}
|
||||
|
||||
|
||||
def __getattr__(attr_name: str) -> object:
|
||||
module_name = _dynamic_imports.get(attr_name)
|
||||
if module_name is None:
|
||||
raise AttributeError(
|
||||
f"No {attr_name} found in _dynamic_imports for module name -> {__name__} "
|
||||
)
|
||||
|
||||
try:
|
||||
module = import_module(module_name, __package__)
|
||||
result = getattr(module, attr_name)
|
||||
return result
|
||||
except ImportError as e:
|
||||
raise ImportError(
|
||||
f"Failed to import {attr_name} from {module_name}: {e}"
|
||||
) from e
|
||||
except AttributeError as e:
|
||||
raise AttributeError(
|
||||
f"Failed to get {attr_name} from {module_name}: {e}"
|
||||
) from e
|
||||
|
||||
|
||||
def __dir__():
|
||||
lazy_attrs = builtins.list(_dynamic_imports.keys())
|
||||
return builtins.sorted(lazy_attrs)
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .fileannotationdetail import FileAnnotationDetail, FileAnnotationDetailTypedDict
|
||||
from .urlcitationannotationdetail import (
|
||||
URLCitationAnnotationDetail,
|
||||
URLCitationAnnotationDetailTypedDict,
|
||||
)
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
AnnotationDetailTypedDict = TypeAliasType(
|
||||
"AnnotationDetailTypedDict",
|
||||
Union[FileAnnotationDetailTypedDict, URLCitationAnnotationDetailTypedDict],
|
||||
)
|
||||
r"""Annotation information"""
|
||||
|
||||
|
||||
AnnotationDetail = Annotated[
|
||||
Union[
|
||||
Annotated[FileAnnotationDetail, Tag("file")],
|
||||
Annotated[URLCitationAnnotationDetail, Tag("url_citation")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""Annotation information"""
|
||||
@@ -0,0 +1,92 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
|
||||
from .completionusage import CompletionUsage, CompletionUsageTypedDict
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionObject(str, Enum):
|
||||
CHAT_COMPLETION = "chat.completion"
|
||||
|
||||
|
||||
class ChatCompletionTypedDict(TypedDict):
|
||||
r"""Chat completion response"""
|
||||
|
||||
id: str
|
||||
r"""Unique completion identifier"""
|
||||
choices: List[ChatCompletionChoiceTypedDict]
|
||||
r"""List of completion choices"""
|
||||
created: float
|
||||
r"""Unix timestamp of creation"""
|
||||
model: str
|
||||
r"""Model used for completion"""
|
||||
object: ChatCompletionObject
|
||||
system_fingerprint: NotRequired[Nullable[str]]
|
||||
r"""System fingerprint"""
|
||||
usage: NotRequired[CompletionUsageTypedDict]
|
||||
r"""Token usage statistics"""
|
||||
|
||||
|
||||
class ChatCompletion(BaseModel):
|
||||
r"""Chat completion response"""
|
||||
|
||||
id: str
|
||||
r"""Unique completion identifier"""
|
||||
|
||||
choices: List[ChatCompletionChoice]
|
||||
r"""List of completion choices"""
|
||||
|
||||
created: float
|
||||
r"""Unix timestamp of creation"""
|
||||
|
||||
model: str
|
||||
r"""Model used for completion"""
|
||||
|
||||
object: ChatCompletionObject
|
||||
|
||||
system_fingerprint: OptionalNullable[str] = UNSET
|
||||
r"""System fingerprint"""
|
||||
|
||||
usage: Optional[CompletionUsage] = None
|
||||
r"""Token usage statistics"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["system_fingerprint", "usage"]
|
||||
nullable_fields = ["system_fingerprint"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,102 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletioncontentpart import (
|
||||
ChatCompletionContentPart,
|
||||
ChatCompletionContentPartTypedDict,
|
||||
)
|
||||
from .chatcompletionmessagetoolcall import (
|
||||
ChatCompletionMessageToolCall,
|
||||
ChatCompletionMessageToolCallTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Any, List, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionAssistantMessageParamRole(str, Enum):
|
||||
ASSISTANT = "assistant"
|
||||
|
||||
|
||||
ChatCompletionAssistantMessageParamContentTypedDict = TypeAliasType(
|
||||
"ChatCompletionAssistantMessageParamContentTypedDict",
|
||||
Union[str, List[ChatCompletionContentPartTypedDict], Any],
|
||||
)
|
||||
r"""Assistant message content"""
|
||||
|
||||
|
||||
ChatCompletionAssistantMessageParamContent = TypeAliasType(
|
||||
"ChatCompletionAssistantMessageParamContent",
|
||||
Union[str, List[ChatCompletionContentPart], Any],
|
||||
)
|
||||
r"""Assistant message content"""
|
||||
|
||||
|
||||
class ChatCompletionAssistantMessageParamTypedDict(TypedDict):
|
||||
r"""Assistant message with tool calls and audio support"""
|
||||
|
||||
role: ChatCompletionAssistantMessageParamRole
|
||||
content: NotRequired[Nullable[ChatCompletionAssistantMessageParamContentTypedDict]]
|
||||
r"""Assistant message content"""
|
||||
name: NotRequired[str]
|
||||
r"""Optional name for the assistant"""
|
||||
tool_calls: NotRequired[List[ChatCompletionMessageToolCallTypedDict]]
|
||||
r"""Tool calls made by the assistant"""
|
||||
refusal: NotRequired[Nullable[str]]
|
||||
r"""Refusal message if content was refused"""
|
||||
|
||||
|
||||
class ChatCompletionAssistantMessageParam(BaseModel):
|
||||
r"""Assistant message with tool calls and audio support"""
|
||||
|
||||
role: ChatCompletionAssistantMessageParamRole
|
||||
|
||||
content: OptionalNullable[ChatCompletionAssistantMessageParamContent] = UNSET
|
||||
r"""Assistant message content"""
|
||||
|
||||
name: Optional[str] = None
|
||||
r"""Optional name for the assistant"""
|
||||
|
||||
tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
|
||||
r"""Tool calls made by the assistant"""
|
||||
|
||||
refusal: OptionalNullable[str] = UNSET
|
||||
r"""Refusal message if content was refused"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["content", "name", "tool_calls", "refusal"]
|
||||
nullable_fields = ["content", "refusal"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,87 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionmessage import ChatCompletionMessage, ChatCompletionMessageTypedDict
|
||||
from .chatcompletiontokenlogprobs import (
|
||||
ChatCompletionTokenLogprobs,
|
||||
ChatCompletionTokenLogprobsTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionChoiceFinishReason(str, Enum):
|
||||
r"""Reason the completion finished"""
|
||||
|
||||
TOOL_CALLS = "tool_calls"
|
||||
STOP = "stop"
|
||||
LENGTH = "length"
|
||||
CONTENT_FILTER = "content_filter"
|
||||
ERROR = "error"
|
||||
|
||||
|
||||
class ChatCompletionChoiceTypedDict(TypedDict):
|
||||
r"""Chat completion choice"""
|
||||
|
||||
finish_reason: Nullable[ChatCompletionChoiceFinishReason]
|
||||
r"""Reason the completion finished"""
|
||||
index: float
|
||||
r"""Choice index"""
|
||||
message: ChatCompletionMessageTypedDict
|
||||
r"""Assistant message in completion response"""
|
||||
logprobs: NotRequired[Nullable[ChatCompletionTokenLogprobsTypedDict]]
|
||||
r"""Log probabilities for the completion"""
|
||||
|
||||
|
||||
class ChatCompletionChoice(BaseModel):
|
||||
r"""Chat completion choice"""
|
||||
|
||||
finish_reason: Nullable[ChatCompletionChoiceFinishReason]
|
||||
r"""Reason the completion finished"""
|
||||
|
||||
index: float
|
||||
r"""Choice index"""
|
||||
|
||||
message: ChatCompletionMessage
|
||||
r"""Assistant message in completion response"""
|
||||
|
||||
logprobs: OptionalNullable[ChatCompletionTokenLogprobs] = UNSET
|
||||
r"""Log probabilities for the completion"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,85 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionchunkchoice import (
|
||||
ChatCompletionChunkChoice,
|
||||
ChatCompletionChunkChoiceTypedDict,
|
||||
)
|
||||
from .completionusage import CompletionUsage, CompletionUsageTypedDict
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionChunkObject(str, Enum):
|
||||
CHAT_COMPLETION_CHUNK = "chat.completion.chunk"
|
||||
|
||||
|
||||
class ChatCompletionChunkTypedDict(TypedDict):
|
||||
r"""Streaming chat completion chunk"""
|
||||
|
||||
id: str
|
||||
choices: List[ChatCompletionChunkChoiceTypedDict]
|
||||
created: float
|
||||
model: str
|
||||
object: ChatCompletionChunkObject
|
||||
system_fingerprint: NotRequired[Nullable[str]]
|
||||
usage: NotRequired[CompletionUsageTypedDict]
|
||||
r"""Token usage statistics"""
|
||||
|
||||
|
||||
class ChatCompletionChunk(BaseModel):
|
||||
r"""Streaming chat completion chunk"""
|
||||
|
||||
id: str
|
||||
|
||||
choices: List[ChatCompletionChunkChoice]
|
||||
|
||||
created: float
|
||||
|
||||
model: str
|
||||
|
||||
object: ChatCompletionChunkObject
|
||||
|
||||
system_fingerprint: OptionalNullable[str] = UNSET
|
||||
|
||||
usage: Optional[CompletionUsage] = None
|
||||
r"""Token usage statistics"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["system_fingerprint", "usage"]
|
||||
nullable_fields = ["system_fingerprint"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,84 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionchunkchoicedelta import (
|
||||
ChatCompletionChunkChoiceDelta,
|
||||
ChatCompletionChunkChoiceDeltaTypedDict,
|
||||
)
|
||||
from .chatcompletiontokenlogprobs import (
|
||||
ChatCompletionTokenLogprobs,
|
||||
ChatCompletionTokenLogprobsTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceFinishReason(str, Enum):
|
||||
TOOL_CALLS = "tool_calls"
|
||||
STOP = "stop"
|
||||
LENGTH = "length"
|
||||
CONTENT_FILTER = "content_filter"
|
||||
ERROR = "error"
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceTypedDict(TypedDict):
|
||||
r"""Streaming completion choice chunk"""
|
||||
|
||||
delta: ChatCompletionChunkChoiceDeltaTypedDict
|
||||
r"""Delta changes in streaming response"""
|
||||
finish_reason: Nullable[ChatCompletionChunkChoiceFinishReason]
|
||||
index: float
|
||||
logprobs: NotRequired[Nullable[ChatCompletionTokenLogprobsTypedDict]]
|
||||
r"""Log probabilities for the completion"""
|
||||
|
||||
|
||||
class ChatCompletionChunkChoice(BaseModel):
|
||||
r"""Streaming completion choice chunk"""
|
||||
|
||||
delta: ChatCompletionChunkChoiceDelta
|
||||
r"""Delta changes in streaming response"""
|
||||
|
||||
finish_reason: Nullable[ChatCompletionChunkChoiceFinishReason]
|
||||
|
||||
index: float
|
||||
|
||||
logprobs: OptionalNullable[ChatCompletionTokenLogprobs] = UNSET
|
||||
r"""Log probabilities for the completion"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["logprobs"]
|
||||
nullable_fields = ["finish_reason", "logprobs"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,108 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .annotationdetail import AnnotationDetail, AnnotationDetailTypedDict
|
||||
from .chatcompletionchunkchoicedeltatoolcall import (
|
||||
ChatCompletionChunkChoiceDeltaToolCall,
|
||||
ChatCompletionChunkChoiceDeltaToolCallTypedDict,
|
||||
)
|
||||
from .reasoningdetail import ReasoningDetail, ReasoningDetailTypedDict
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaRole(str, Enum):
|
||||
r"""The role of the message author"""
|
||||
|
||||
ASSISTANT = "assistant"
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaTypedDict(TypedDict):
|
||||
r"""Delta changes in streaming response"""
|
||||
|
||||
role: NotRequired[ChatCompletionChunkChoiceDeltaRole]
|
||||
r"""The role of the message author"""
|
||||
content: NotRequired[Nullable[str]]
|
||||
r"""Message content delta"""
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
r"""Reasoning content delta"""
|
||||
refusal: NotRequired[Nullable[str]]
|
||||
r"""Refusal message delta"""
|
||||
tool_calls: NotRequired[List[ChatCompletionChunkChoiceDeltaToolCallTypedDict]]
|
||||
r"""Tool calls delta"""
|
||||
reasoning_details: NotRequired[List[ReasoningDetailTypedDict]]
|
||||
r"""Reasoning details delta to send reasoning details back to upstream"""
|
||||
annotations: NotRequired[List[AnnotationDetailTypedDict]]
|
||||
r"""Annotations delta to send annotations back to upstream"""
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDelta(BaseModel):
|
||||
r"""Delta changes in streaming response"""
|
||||
|
||||
role: Optional[ChatCompletionChunkChoiceDeltaRole] = None
|
||||
r"""The role of the message author"""
|
||||
|
||||
content: OptionalNullable[str] = UNSET
|
||||
r"""Message content delta"""
|
||||
|
||||
reasoning: OptionalNullable[str] = UNSET
|
||||
r"""Reasoning content delta"""
|
||||
|
||||
refusal: OptionalNullable[str] = UNSET
|
||||
r"""Refusal message delta"""
|
||||
|
||||
tool_calls: Optional[List[ChatCompletionChunkChoiceDeltaToolCall]] = None
|
||||
r"""Tool calls delta"""
|
||||
|
||||
reasoning_details: Optional[List[ReasoningDetail]] = None
|
||||
r"""Reasoning details delta to send reasoning details back to upstream"""
|
||||
|
||||
annotations: Optional[List[AnnotationDetail]] = None
|
||||
r"""Annotations delta to send annotations back to upstream"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"role",
|
||||
"content",
|
||||
"reasoning",
|
||||
"refusal",
|
||||
"tool_calls",
|
||||
"reasoning_details",
|
||||
"annotations",
|
||||
]
|
||||
nullable_fields = ["content", "reasoning", "refusal"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,61 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaToolCallType(str, Enum):
|
||||
r"""Tool call type"""
|
||||
|
||||
FUNCTION = "function"
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaToolCallFunctionTypedDict(TypedDict):
|
||||
r"""Function call details"""
|
||||
|
||||
name: NotRequired[str]
|
||||
r"""Function name"""
|
||||
arguments: NotRequired[str]
|
||||
r"""Function arguments as JSON string"""
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaToolCallFunction(BaseModel):
|
||||
r"""Function call details"""
|
||||
|
||||
name: Optional[str] = None
|
||||
r"""Function name"""
|
||||
|
||||
arguments: Optional[str] = None
|
||||
r"""Function arguments as JSON string"""
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaToolCallTypedDict(TypedDict):
|
||||
r"""Tool call delta for streaming responses"""
|
||||
|
||||
index: float
|
||||
r"""Tool call index in the array"""
|
||||
id: NotRequired[str]
|
||||
r"""Tool call identifier"""
|
||||
type: NotRequired[ChatCompletionChunkChoiceDeltaToolCallType]
|
||||
r"""Tool call type"""
|
||||
function: NotRequired[ChatCompletionChunkChoiceDeltaToolCallFunctionTypedDict]
|
||||
r"""Function call details"""
|
||||
|
||||
|
||||
class ChatCompletionChunkChoiceDeltaToolCall(BaseModel):
|
||||
r"""Tool call delta for streaming responses"""
|
||||
|
||||
index: float
|
||||
r"""Tool call index in the array"""
|
||||
|
||||
id: Optional[str] = None
|
||||
r"""Tool call identifier"""
|
||||
|
||||
type: Optional[ChatCompletionChunkChoiceDeltaToolCallType] = None
|
||||
r"""Tool call type"""
|
||||
|
||||
function: Optional[ChatCompletionChunkChoiceDeltaToolCallFunction] = None
|
||||
r"""Function call details"""
|
||||
@@ -0,0 +1,41 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletioncontentpartaudio import (
|
||||
ChatCompletionContentPartAudio,
|
||||
ChatCompletionContentPartAudioTypedDict,
|
||||
)
|
||||
from .chatcompletioncontentpartimage import (
|
||||
ChatCompletionContentPartImage,
|
||||
ChatCompletionContentPartImageTypedDict,
|
||||
)
|
||||
from .chatcompletioncontentparttext import (
|
||||
ChatCompletionContentPartText,
|
||||
ChatCompletionContentPartTextTypedDict,
|
||||
)
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
ChatCompletionContentPartTypedDict = TypeAliasType(
|
||||
"ChatCompletionContentPartTypedDict",
|
||||
Union[
|
||||
ChatCompletionContentPartTextTypedDict,
|
||||
ChatCompletionContentPartImageTypedDict,
|
||||
ChatCompletionContentPartAudioTypedDict,
|
||||
],
|
||||
)
|
||||
r"""Content part for chat completion messages"""
|
||||
|
||||
|
||||
ChatCompletionContentPart = Annotated[
|
||||
Union[
|
||||
Annotated[ChatCompletionContentPartText, Tag("text")],
|
||||
Annotated[ChatCompletionContentPartImage, Tag("image_url")],
|
||||
Annotated[ChatCompletionContentPartAudio, Tag("input_audio")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""Content part for chat completion messages"""
|
||||
@@ -0,0 +1,55 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
import pydantic
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionContentPartAudioType(str, Enum):
|
||||
INPUT_AUDIO = "input_audio"
|
||||
|
||||
|
||||
class ChatCompletionContentPartAudioFormat(str, Enum):
|
||||
r"""Audio format"""
|
||||
|
||||
WAV = "wav"
|
||||
MP3 = "mp3"
|
||||
FLAC = "flac"
|
||||
M4A = "m4a"
|
||||
OGG = "ogg"
|
||||
PCM16 = "pcm16"
|
||||
PCM24 = "pcm24"
|
||||
|
||||
|
||||
class InputAudioTypedDict(TypedDict):
|
||||
data: str
|
||||
r"""Base64 encoded audio data"""
|
||||
format_: ChatCompletionContentPartAudioFormat
|
||||
r"""Audio format"""
|
||||
|
||||
|
||||
class InputAudio(BaseModel):
|
||||
data: str
|
||||
r"""Base64 encoded audio data"""
|
||||
|
||||
format_: Annotated[
|
||||
ChatCompletionContentPartAudioFormat, pydantic.Field(alias="format")
|
||||
]
|
||||
r"""Audio format"""
|
||||
|
||||
|
||||
class ChatCompletionContentPartAudioTypedDict(TypedDict):
|
||||
r"""Audio input content part"""
|
||||
|
||||
type: ChatCompletionContentPartAudioType
|
||||
input_audio: InputAudioTypedDict
|
||||
|
||||
|
||||
class ChatCompletionContentPartAudio(BaseModel):
|
||||
r"""Audio input content part"""
|
||||
|
||||
type: ChatCompletionContentPartAudioType
|
||||
|
||||
input_audio: InputAudio
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionContentPartImageType(str, Enum):
|
||||
IMAGE_URL = "image_url"
|
||||
|
||||
|
||||
class Detail(str, Enum):
|
||||
r"""Image detail level for vision models"""
|
||||
|
||||
AUTO = "auto"
|
||||
LOW = "low"
|
||||
HIGH = "high"
|
||||
|
||||
|
||||
class ChatCompletionContentPartImageImageURLTypedDict(TypedDict):
|
||||
url: str
|
||||
r"""URL of the image (data: URLs supported)"""
|
||||
detail: NotRequired[Detail]
|
||||
r"""Image detail level for vision models"""
|
||||
|
||||
|
||||
class ChatCompletionContentPartImageImageURL(BaseModel):
|
||||
url: str
|
||||
r"""URL of the image (data: URLs supported)"""
|
||||
|
||||
detail: Optional[Detail] = None
|
||||
r"""Image detail level for vision models"""
|
||||
|
||||
|
||||
class ChatCompletionContentPartImageTypedDict(TypedDict):
|
||||
r"""Image content part for vision models"""
|
||||
|
||||
type: ChatCompletionContentPartImageType
|
||||
image_url: ChatCompletionContentPartImageImageURLTypedDict
|
||||
|
||||
|
||||
class ChatCompletionContentPartImage(BaseModel):
|
||||
r"""Image content part for vision models"""
|
||||
|
||||
type: ChatCompletionContentPartImageType
|
||||
|
||||
image_url: ChatCompletionContentPartImageImageURL
|
||||
@@ -0,0 +1,25 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ChatCompletionContentPartTextType(str, Enum):
|
||||
TEXT = "text"
|
||||
|
||||
|
||||
class ChatCompletionContentPartTextTypedDict(TypedDict):
|
||||
r"""Text content part"""
|
||||
|
||||
type: ChatCompletionContentPartTextType
|
||||
text: str
|
||||
|
||||
|
||||
class ChatCompletionContentPartText(BaseModel):
|
||||
r"""Text content part"""
|
||||
|
||||
type: ChatCompletionContentPartTextType
|
||||
|
||||
text: str
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
"""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_extensions import TypedDict
|
||||
|
||||
|
||||
class ErrorTypedDict(TypedDict):
|
||||
r"""Error object structure"""
|
||||
|
||||
code: Nullable[str]
|
||||
message: str
|
||||
param: Nullable[str]
|
||||
type: str
|
||||
|
||||
|
||||
class Error(BaseModel):
|
||||
r"""Error object structure"""
|
||||
|
||||
code: Nullable[str]
|
||||
|
||||
message: str
|
||||
|
||||
param: Nullable[str]
|
||||
|
||||
type: str
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["code", "param"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,101 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .annotationdetail import AnnotationDetail, AnnotationDetailTypedDict
|
||||
from .chatcompletionmessagetoolcall import (
|
||||
ChatCompletionMessageToolCall,
|
||||
ChatCompletionMessageToolCallTypedDict,
|
||||
)
|
||||
from .reasoningdetail import ReasoningDetail, ReasoningDetailTypedDict
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import List, Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionMessageRole(str, Enum):
|
||||
ASSISTANT = "assistant"
|
||||
|
||||
|
||||
class ChatCompletionMessageTypedDict(TypedDict):
|
||||
r"""Assistant message in completion response"""
|
||||
|
||||
role: ChatCompletionMessageRole
|
||||
content: Nullable[str]
|
||||
r"""Message content"""
|
||||
refusal: Nullable[str]
|
||||
r"""Refusal message if content was refused"""
|
||||
reasoning: NotRequired[Nullable[str]]
|
||||
r"""Reasoning output"""
|
||||
tool_calls: NotRequired[List[ChatCompletionMessageToolCallTypedDict]]
|
||||
r"""Tool calls made by the assistant"""
|
||||
reasoning_details: NotRequired[List[ReasoningDetailTypedDict]]
|
||||
r"""Reasoning details delta to send reasoning details back to upstream"""
|
||||
annotations: NotRequired[List[AnnotationDetailTypedDict]]
|
||||
r"""Annotations delta to send annotations back to upstream"""
|
||||
|
||||
|
||||
class ChatCompletionMessage(BaseModel):
|
||||
r"""Assistant message in completion response"""
|
||||
|
||||
role: ChatCompletionMessageRole
|
||||
|
||||
content: Nullable[str]
|
||||
r"""Message content"""
|
||||
|
||||
refusal: Nullable[str]
|
||||
r"""Refusal message if content was refused"""
|
||||
|
||||
reasoning: OptionalNullable[str] = UNSET
|
||||
r"""Reasoning output"""
|
||||
|
||||
tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
|
||||
r"""Tool calls made by the assistant"""
|
||||
|
||||
reasoning_details: Optional[List[ReasoningDetail]] = None
|
||||
r"""Reasoning details delta to send reasoning details back to upstream"""
|
||||
|
||||
annotations: Optional[List[AnnotationDetail]] = None
|
||||
r"""Annotations delta to send annotations back to upstream"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = [
|
||||
"reasoning",
|
||||
"tool_calls",
|
||||
"reasoning_details",
|
||||
"annotations",
|
||||
]
|
||||
nullable_fields = ["content", "reasoning", "refusal"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,47 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionassistantmessageparam import (
|
||||
ChatCompletionAssistantMessageParam,
|
||||
ChatCompletionAssistantMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletionsystemmessageparam import (
|
||||
ChatCompletionSystemMessageParam,
|
||||
ChatCompletionSystemMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletiontoolmessageparam import (
|
||||
ChatCompletionToolMessageParam,
|
||||
ChatCompletionToolMessageParamTypedDict,
|
||||
)
|
||||
from .chatcompletionusermessageparam import (
|
||||
ChatCompletionUserMessageParam,
|
||||
ChatCompletionUserMessageParamTypedDict,
|
||||
)
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
ChatCompletionMessageParamTypedDict = TypeAliasType(
|
||||
"ChatCompletionMessageParamTypedDict",
|
||||
Union[
|
||||
ChatCompletionSystemMessageParamTypedDict,
|
||||
ChatCompletionUserMessageParamTypedDict,
|
||||
ChatCompletionToolMessageParamTypedDict,
|
||||
ChatCompletionAssistantMessageParamTypedDict,
|
||||
],
|
||||
)
|
||||
r"""Chat completion message with role-based discrimination"""
|
||||
|
||||
|
||||
ChatCompletionMessageParam = Annotated[
|
||||
Union[
|
||||
Annotated[ChatCompletionSystemMessageParam, Tag("system")],
|
||||
Annotated[ChatCompletionUserMessageParam, Tag("user")],
|
||||
Annotated[ChatCompletionAssistantMessageParam, Tag("assistant")],
|
||||
Annotated[ChatCompletionToolMessageParam, Tag("tool")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "role", "role")),
|
||||
]
|
||||
r"""Chat completion message with role-based discrimination"""
|
||||
@@ -0,0 +1,45 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ChatCompletionMessageToolCallType(str, Enum):
|
||||
FUNCTION = "function"
|
||||
|
||||
|
||||
class ChatCompletionMessageToolCallFunctionTypedDict(TypedDict):
|
||||
name: str
|
||||
r"""Function name to call"""
|
||||
arguments: str
|
||||
r"""Function arguments as JSON string"""
|
||||
|
||||
|
||||
class ChatCompletionMessageToolCallFunction(BaseModel):
|
||||
name: str
|
||||
r"""Function name to call"""
|
||||
|
||||
arguments: str
|
||||
r"""Function arguments as JSON string"""
|
||||
|
||||
|
||||
class ChatCompletionMessageToolCallTypedDict(TypedDict):
|
||||
r"""Tool call made by the assistant"""
|
||||
|
||||
id: str
|
||||
r"""Tool call identifier"""
|
||||
type: ChatCompletionMessageToolCallType
|
||||
function: ChatCompletionMessageToolCallFunctionTypedDict
|
||||
|
||||
|
||||
class ChatCompletionMessageToolCall(BaseModel):
|
||||
r"""Tool call made by the assistant"""
|
||||
|
||||
id: str
|
||||
r"""Tool call identifier"""
|
||||
|
||||
type: ChatCompletionMessageToolCallType
|
||||
|
||||
function: ChatCompletionMessageToolCallFunction
|
||||
@@ -0,0 +1,35 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ChatCompletionNamedToolChoiceType(str, Enum):
|
||||
FUNCTION = "function"
|
||||
|
||||
|
||||
class ChatCompletionNamedToolChoiceFunctionTypedDict(TypedDict):
|
||||
name: str
|
||||
r"""Function name to call"""
|
||||
|
||||
|
||||
class ChatCompletionNamedToolChoiceFunction(BaseModel):
|
||||
name: str
|
||||
r"""Function name to call"""
|
||||
|
||||
|
||||
class ChatCompletionNamedToolChoiceTypedDict(TypedDict):
|
||||
r"""Named tool choice for specific function"""
|
||||
|
||||
type: ChatCompletionNamedToolChoiceType
|
||||
function: ChatCompletionNamedToolChoiceFunctionTypedDict
|
||||
|
||||
|
||||
class ChatCompletionNamedToolChoice(BaseModel):
|
||||
r"""Named tool choice for specific function"""
|
||||
|
||||
type: ChatCompletionNamedToolChoiceType
|
||||
|
||||
function: ChatCompletionNamedToolChoiceFunction
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletioncontentparttext import (
|
||||
ChatCompletionContentPartText,
|
||||
ChatCompletionContentPartTextTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionSystemMessageParamRole(str, Enum):
|
||||
SYSTEM = "system"
|
||||
|
||||
|
||||
ChatCompletionSystemMessageParamContentTypedDict = TypeAliasType(
|
||||
"ChatCompletionSystemMessageParamContentTypedDict",
|
||||
Union[str, List[ChatCompletionContentPartTextTypedDict]],
|
||||
)
|
||||
r"""System message content"""
|
||||
|
||||
|
||||
ChatCompletionSystemMessageParamContent = TypeAliasType(
|
||||
"ChatCompletionSystemMessageParamContent",
|
||||
Union[str, List[ChatCompletionContentPartText]],
|
||||
)
|
||||
r"""System message content"""
|
||||
|
||||
|
||||
class ChatCompletionSystemMessageParamTypedDict(TypedDict):
|
||||
r"""System message for setting behavior"""
|
||||
|
||||
role: ChatCompletionSystemMessageParamRole
|
||||
content: ChatCompletionSystemMessageParamContentTypedDict
|
||||
r"""System message content"""
|
||||
name: NotRequired[str]
|
||||
r"""Optional name for the system message"""
|
||||
|
||||
|
||||
class ChatCompletionSystemMessageParam(BaseModel):
|
||||
r"""System message for setting behavior"""
|
||||
|
||||
role: ChatCompletionSystemMessageParamRole
|
||||
|
||||
content: ChatCompletionSystemMessageParamContent
|
||||
r"""System message content"""
|
||||
|
||||
name: Optional[str] = None
|
||||
r"""Optional name for the system message"""
|
||||
@@ -0,0 +1,111 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import List
|
||||
from typing_extensions import Annotated, TypedDict
|
||||
|
||||
|
||||
class TopLogprobTypedDict(TypedDict):
|
||||
token: str
|
||||
logprob: float
|
||||
bytes_: Nullable[List[float]]
|
||||
|
||||
|
||||
class TopLogprob(BaseModel):
|
||||
token: str
|
||||
|
||||
logprob: float
|
||||
|
||||
bytes_: Annotated[Nullable[List[float]], pydantic.Field(alias="bytes")]
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["bytes"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ChatCompletionTokenLogprobTypedDict(TypedDict):
|
||||
r"""Token log probability information"""
|
||||
|
||||
token: str
|
||||
r"""The token"""
|
||||
logprob: float
|
||||
r"""Log probability of the token"""
|
||||
bytes_: Nullable[List[float]]
|
||||
r"""UTF-8 bytes of the token"""
|
||||
top_logprobs: List[TopLogprobTypedDict]
|
||||
r"""Top alternative tokens with probabilities"""
|
||||
|
||||
|
||||
class ChatCompletionTokenLogprob(BaseModel):
|
||||
r"""Token log probability information"""
|
||||
|
||||
token: str
|
||||
r"""The token"""
|
||||
|
||||
logprob: float
|
||||
r"""Log probability of the token"""
|
||||
|
||||
bytes_: Annotated[Nullable[List[float]], pydantic.Field(alias="bytes")]
|
||||
r"""UTF-8 bytes of the token"""
|
||||
|
||||
top_logprobs: List[TopLogprob]
|
||||
r"""Top alternative tokens with probabilities"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["bytes"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,60 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletiontokenlogprob import (
|
||||
ChatCompletionTokenLogprob,
|
||||
ChatCompletionTokenLogprobTypedDict,
|
||||
)
|
||||
from openrouter.types import BaseModel, Nullable, UNSET_SENTINEL
|
||||
from pydantic import model_serializer
|
||||
from typing import List
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ChatCompletionTokenLogprobsTypedDict(TypedDict):
|
||||
r"""Log probabilities for the completion"""
|
||||
|
||||
content: Nullable[List[ChatCompletionTokenLogprobTypedDict]]
|
||||
r"""Log probabilities for content tokens"""
|
||||
refusal: Nullable[List[ChatCompletionTokenLogprobTypedDict]]
|
||||
r"""Log probabilities for refusal tokens"""
|
||||
|
||||
|
||||
class ChatCompletionTokenLogprobs(BaseModel):
|
||||
r"""Log probabilities for the completion"""
|
||||
|
||||
content: Nullable[List[ChatCompletionTokenLogprob]]
|
||||
r"""Log probabilities for content tokens"""
|
||||
|
||||
refusal: Nullable[List[ChatCompletionTokenLogprob]]
|
||||
r"""Log probabilities for refusal tokens"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = []
|
||||
nullable_fields = ["content", "refusal"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,102 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
from pydantic import model_serializer
|
||||
from typing import Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionToolType(str, Enum):
|
||||
FUNCTION = "function"
|
||||
|
||||
|
||||
class ParametersTypedDict(TypedDict):
|
||||
r"""Function parameters as JSON Schema object"""
|
||||
|
||||
|
||||
class Parameters(BaseModel):
|
||||
r"""Function parameters as JSON Schema object"""
|
||||
|
||||
|
||||
class ChatCompletionToolFunctionTypedDict(TypedDict):
|
||||
r"""Function definition for tool calling"""
|
||||
|
||||
name: str
|
||||
r"""Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)"""
|
||||
description: NotRequired[str]
|
||||
r"""Function description for the model"""
|
||||
parameters: NotRequired[ParametersTypedDict]
|
||||
r"""Function parameters as JSON Schema object"""
|
||||
strict: NotRequired[Nullable[bool]]
|
||||
r"""Enable strict schema adherence"""
|
||||
|
||||
|
||||
class ChatCompletionToolFunction(BaseModel):
|
||||
r"""Function definition for tool calling"""
|
||||
|
||||
name: str
|
||||
r"""Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)"""
|
||||
|
||||
description: Optional[str] = None
|
||||
r"""Function description for the model"""
|
||||
|
||||
parameters: Optional[Parameters] = None
|
||||
r"""Function parameters as JSON Schema object"""
|
||||
|
||||
strict: OptionalNullable[bool] = UNSET
|
||||
r"""Enable strict schema adherence"""
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["description", "parameters", "strict"]
|
||||
nullable_fields = ["strict"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
|
||||
|
||||
class ChatCompletionToolTypedDict(TypedDict):
|
||||
r"""Tool definition for function calling"""
|
||||
|
||||
type: ChatCompletionToolType
|
||||
function: ChatCompletionToolFunctionTypedDict
|
||||
r"""Function definition for tool calling"""
|
||||
|
||||
|
||||
class ChatCompletionTool(BaseModel):
|
||||
r"""Tool definition for function calling"""
|
||||
|
||||
type: ChatCompletionToolType
|
||||
|
||||
function: ChatCompletionToolFunction
|
||||
r"""Function definition for tool calling"""
|
||||
@@ -0,0 +1,46 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionnamedtoolchoice import (
|
||||
ChatCompletionNamedToolChoice,
|
||||
ChatCompletionNamedToolChoiceTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from typing import Union
|
||||
from typing_extensions import TypeAliasType
|
||||
|
||||
|
||||
class ChatCompletionToolChoiceOptionRequired(str, Enum):
|
||||
REQUIRED = "required"
|
||||
|
||||
|
||||
class ChatCompletionToolChoiceOptionAuto(str, Enum):
|
||||
AUTO = "auto"
|
||||
|
||||
|
||||
class ChatCompletionToolChoiceOptionNone(str, Enum):
|
||||
NONE = "none"
|
||||
|
||||
|
||||
ChatCompletionToolChoiceOptionTypedDict = TypeAliasType(
|
||||
"ChatCompletionToolChoiceOptionTypedDict",
|
||||
Union[
|
||||
ChatCompletionNamedToolChoiceTypedDict,
|
||||
ChatCompletionToolChoiceOptionNone,
|
||||
ChatCompletionToolChoiceOptionAuto,
|
||||
ChatCompletionToolChoiceOptionRequired,
|
||||
],
|
||||
)
|
||||
r"""Tool choice configuration"""
|
||||
|
||||
|
||||
ChatCompletionToolChoiceOption = TypeAliasType(
|
||||
"ChatCompletionToolChoiceOption",
|
||||
Union[
|
||||
ChatCompletionNamedToolChoice,
|
||||
ChatCompletionToolChoiceOptionNone,
|
||||
ChatCompletionToolChoiceOptionAuto,
|
||||
ChatCompletionToolChoiceOptionRequired,
|
||||
],
|
||||
)
|
||||
r"""Tool choice configuration"""
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletioncontentpart import (
|
||||
ChatCompletionContentPart,
|
||||
ChatCompletionContentPartTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Union
|
||||
from typing_extensions import TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionToolMessageParamRole(str, Enum):
|
||||
TOOL = "tool"
|
||||
|
||||
|
||||
ChatCompletionToolMessageParamContentTypedDict = TypeAliasType(
|
||||
"ChatCompletionToolMessageParamContentTypedDict",
|
||||
Union[str, List[ChatCompletionContentPartTypedDict]],
|
||||
)
|
||||
r"""Tool response content"""
|
||||
|
||||
|
||||
ChatCompletionToolMessageParamContent = TypeAliasType(
|
||||
"ChatCompletionToolMessageParamContent", Union[str, List[ChatCompletionContentPart]]
|
||||
)
|
||||
r"""Tool response content"""
|
||||
|
||||
|
||||
class ChatCompletionToolMessageParamTypedDict(TypedDict):
|
||||
r"""Tool response message"""
|
||||
|
||||
role: ChatCompletionToolMessageParamRole
|
||||
content: ChatCompletionToolMessageParamContentTypedDict
|
||||
r"""Tool response content"""
|
||||
tool_call_id: str
|
||||
r"""ID of the tool call this message responds to"""
|
||||
|
||||
|
||||
class ChatCompletionToolMessageParam(BaseModel):
|
||||
r"""Tool response message"""
|
||||
|
||||
role: ChatCompletionToolMessageParamRole
|
||||
|
||||
content: ChatCompletionToolMessageParamContent
|
||||
r"""Tool response content"""
|
||||
|
||||
tool_call_id: str
|
||||
r"""ID of the tool call this message responds to"""
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletioncontentpart import (
|
||||
ChatCompletionContentPart,
|
||||
ChatCompletionContentPartTypedDict,
|
||||
)
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class ChatCompletionUserMessageParamRole(str, Enum):
|
||||
USER = "user"
|
||||
|
||||
|
||||
ChatCompletionUserMessageParamContentTypedDict = TypeAliasType(
|
||||
"ChatCompletionUserMessageParamContentTypedDict",
|
||||
Union[str, List[ChatCompletionContentPartTypedDict]],
|
||||
)
|
||||
r"""User message content"""
|
||||
|
||||
|
||||
ChatCompletionUserMessageParamContent = TypeAliasType(
|
||||
"ChatCompletionUserMessageParamContent", Union[str, List[ChatCompletionContentPart]]
|
||||
)
|
||||
r"""User message content"""
|
||||
|
||||
|
||||
class ChatCompletionUserMessageParamTypedDict(TypedDict):
|
||||
r"""User message"""
|
||||
|
||||
role: ChatCompletionUserMessageParamRole
|
||||
content: ChatCompletionUserMessageParamContentTypedDict
|
||||
r"""User message content"""
|
||||
name: NotRequired[str]
|
||||
r"""Optional name for the user"""
|
||||
|
||||
|
||||
class ChatCompletionUserMessageParam(BaseModel):
|
||||
r"""User message"""
|
||||
|
||||
role: ChatCompletionUserMessageParamRole
|
||||
|
||||
content: ChatCompletionUserMessageParamContent
|
||||
r"""User message content"""
|
||||
|
||||
name: Optional[str] = None
|
||||
r"""Optional name for the user"""
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,88 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class CompletionTokensDetailsTypedDict(TypedDict):
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
reasoning_tokens: NotRequired[float]
|
||||
r"""Tokens used for reasoning"""
|
||||
audio_tokens: NotRequired[float]
|
||||
r"""Tokens used for audio output"""
|
||||
accepted_prediction_tokens: NotRequired[float]
|
||||
r"""Accepted prediction tokens"""
|
||||
rejected_prediction_tokens: NotRequired[float]
|
||||
r"""Rejected prediction tokens"""
|
||||
|
||||
|
||||
class CompletionTokensDetails(BaseModel):
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
reasoning_tokens: Optional[float] = None
|
||||
r"""Tokens used for reasoning"""
|
||||
|
||||
audio_tokens: Optional[float] = None
|
||||
r"""Tokens used for audio output"""
|
||||
|
||||
accepted_prediction_tokens: Optional[float] = None
|
||||
r"""Accepted prediction tokens"""
|
||||
|
||||
rejected_prediction_tokens: Optional[float] = None
|
||||
r"""Rejected prediction tokens"""
|
||||
|
||||
|
||||
class PromptTokensDetailsTypedDict(TypedDict):
|
||||
r"""Detailed prompt token usage"""
|
||||
|
||||
cached_tokens: NotRequired[float]
|
||||
r"""Cached prompt tokens"""
|
||||
audio_tokens: NotRequired[float]
|
||||
r"""Audio input tokens"""
|
||||
|
||||
|
||||
class PromptTokensDetails(BaseModel):
|
||||
r"""Detailed prompt token usage"""
|
||||
|
||||
cached_tokens: Optional[float] = None
|
||||
r"""Cached prompt tokens"""
|
||||
|
||||
audio_tokens: Optional[float] = None
|
||||
r"""Audio input tokens"""
|
||||
|
||||
|
||||
class CompletionUsageTypedDict(TypedDict):
|
||||
r"""Token usage statistics"""
|
||||
|
||||
completion_tokens: float
|
||||
r"""Number of tokens in the completion"""
|
||||
prompt_tokens: float
|
||||
r"""Number of tokens in the prompt"""
|
||||
total_tokens: float
|
||||
r"""Total number of tokens"""
|
||||
completion_tokens_details: NotRequired[CompletionTokensDetailsTypedDict]
|
||||
r"""Detailed completion token usage"""
|
||||
prompt_tokens_details: NotRequired[PromptTokensDetailsTypedDict]
|
||||
r"""Detailed prompt token usage"""
|
||||
|
||||
|
||||
class CompletionUsage(BaseModel):
|
||||
r"""Token usage statistics"""
|
||||
|
||||
completion_tokens: float
|
||||
r"""Number of tokens in the completion"""
|
||||
|
||||
prompt_tokens: float
|
||||
r"""Number of tokens in the prompt"""
|
||||
|
||||
total_tokens: float
|
||||
r"""Total number of tokens"""
|
||||
|
||||
completion_tokens_details: Optional[CompletionTokensDetails] = None
|
||||
r"""Detailed completion token usage"""
|
||||
|
||||
prompt_tokens_details: Optional[PromptTokensDetails] = None
|
||||
r"""Detailed prompt token usage"""
|
||||
@@ -0,0 +1,89 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import List, Optional, Union
|
||||
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
||||
|
||||
|
||||
class TypeFile(str, Enum):
|
||||
FILE = "file"
|
||||
|
||||
|
||||
class ContentTypeImageURL(str, Enum):
|
||||
IMAGE_URL = "image_url"
|
||||
|
||||
|
||||
class FileAnnotationDetailImageURLTypedDict(TypedDict):
|
||||
url: str
|
||||
|
||||
|
||||
class FileAnnotationDetailImageURL(BaseModel):
|
||||
url: str
|
||||
|
||||
|
||||
class ContentImageURLTypedDict(TypedDict):
|
||||
type: ContentTypeImageURL
|
||||
image_url: FileAnnotationDetailImageURLTypedDict
|
||||
|
||||
|
||||
class ContentImageURL(BaseModel):
|
||||
type: ContentTypeImageURL
|
||||
|
||||
image_url: FileAnnotationDetailImageURL
|
||||
|
||||
|
||||
class ContentTypeText(str, Enum):
|
||||
TEXT = "text"
|
||||
|
||||
|
||||
class ContentTextTypedDict(TypedDict):
|
||||
type: ContentTypeText
|
||||
text: str
|
||||
|
||||
|
||||
class ContentText(BaseModel):
|
||||
type: ContentTypeText
|
||||
|
||||
text: str
|
||||
|
||||
|
||||
FileAnnotationDetailContentUnionTypedDict = TypeAliasType(
|
||||
"FileAnnotationDetailContentUnionTypedDict",
|
||||
Union[ContentTextTypedDict, ContentImageURLTypedDict],
|
||||
)
|
||||
|
||||
|
||||
FileAnnotationDetailContentUnion = TypeAliasType(
|
||||
"FileAnnotationDetailContentUnion", Union[ContentText, ContentImageURL]
|
||||
)
|
||||
|
||||
|
||||
class FileTypedDict(TypedDict):
|
||||
hash: str
|
||||
content: List[FileAnnotationDetailContentUnionTypedDict]
|
||||
name: NotRequired[str]
|
||||
|
||||
|
||||
class File(BaseModel):
|
||||
hash: str
|
||||
|
||||
content: List[FileAnnotationDetailContentUnion]
|
||||
|
||||
name: Optional[str] = None
|
||||
|
||||
|
||||
class FileAnnotationDetailTypedDict(TypedDict):
|
||||
r"""File annotation with content"""
|
||||
|
||||
type: TypeFile
|
||||
file: FileTypedDict
|
||||
|
||||
|
||||
class FileAnnotationDetail(BaseModel):
|
||||
r"""File annotation with content"""
|
||||
|
||||
type: TypeFile
|
||||
|
||||
file: File
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .reasoningdetailencrypted import (
|
||||
ReasoningDetailEncrypted,
|
||||
ReasoningDetailEncryptedTypedDict,
|
||||
)
|
||||
from .reasoningdetailsummary import (
|
||||
ReasoningDetailSummary,
|
||||
ReasoningDetailSummaryTypedDict,
|
||||
)
|
||||
from .reasoningdetailtext import ReasoningDetailText, ReasoningDetailTextTypedDict
|
||||
from openrouter.utils import get_discriminator
|
||||
from pydantic import Discriminator, Tag
|
||||
from typing import Union
|
||||
from typing_extensions import Annotated, TypeAliasType
|
||||
|
||||
|
||||
ReasoningDetailTypedDict = TypeAliasType(
|
||||
"ReasoningDetailTypedDict",
|
||||
Union[
|
||||
ReasoningDetailSummaryTypedDict,
|
||||
ReasoningDetailEncryptedTypedDict,
|
||||
ReasoningDetailTextTypedDict,
|
||||
],
|
||||
)
|
||||
r"""Reasoning detail information"""
|
||||
|
||||
|
||||
ReasoningDetail = Annotated[
|
||||
Union[
|
||||
Annotated[ReasoningDetailSummary, Tag("reasoning.summary")],
|
||||
Annotated[ReasoningDetailEncrypted, Tag("reasoning.encrypted")],
|
||||
Annotated[ReasoningDetailText, Tag("reasoning.text")],
|
||||
],
|
||||
Discriminator(lambda m: get_discriminator(m, "type", "type")),
|
||||
]
|
||||
r"""Reasoning detail information"""
|
||||
@@ -0,0 +1,81 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ReasoningDetailEncryptedType(str, Enum):
|
||||
REASONING_ENCRYPTED = "reasoning.encrypted"
|
||||
|
||||
|
||||
class ReasoningDetailEncryptedFormat(str, Enum):
|
||||
UNKNOWN = "unknown"
|
||||
OPENAI_RESPONSES_V1 = "openai-responses-v1"
|
||||
ANTHROPIC_CLAUDE_V1 = "anthropic-claude-v1"
|
||||
|
||||
|
||||
class ReasoningDetailEncryptedTypedDict(TypedDict):
|
||||
r"""Encrypted reasoning detail"""
|
||||
|
||||
type: ReasoningDetailEncryptedType
|
||||
data: str
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[ReasoningDetailEncryptedFormat]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class ReasoningDetailEncrypted(BaseModel):
|
||||
r"""Encrypted reasoning detail"""
|
||||
|
||||
type: ReasoningDetailEncryptedType
|
||||
|
||||
data: str
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
OptionalNullable[ReasoningDetailEncryptedFormat], pydantic.Field(alias="format")
|
||||
] = ReasoningDetailEncryptedFormat.ANTHROPIC_CLAUDE_V1
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["id", "format", "index"]
|
||||
nullable_fields = ["id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,81 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ReasoningDetailSummaryType(str, Enum):
|
||||
REASONING_SUMMARY = "reasoning.summary"
|
||||
|
||||
|
||||
class ReasoningDetailSummaryFormat(str, Enum):
|
||||
UNKNOWN = "unknown"
|
||||
OPENAI_RESPONSES_V1 = "openai-responses-v1"
|
||||
ANTHROPIC_CLAUDE_V1 = "anthropic-claude-v1"
|
||||
|
||||
|
||||
class ReasoningDetailSummaryTypedDict(TypedDict):
|
||||
r"""Reasoning summary detail"""
|
||||
|
||||
type: ReasoningDetailSummaryType
|
||||
summary: str
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[ReasoningDetailSummaryFormat]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class ReasoningDetailSummary(BaseModel):
|
||||
r"""Reasoning summary detail"""
|
||||
|
||||
type: ReasoningDetailSummaryType
|
||||
|
||||
summary: str
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
OptionalNullable[ReasoningDetailSummaryFormat], pydantic.Field(alias="format")
|
||||
] = ReasoningDetailSummaryFormat.ANTHROPIC_CLAUDE_V1
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["id", "format", "index"]
|
||||
nullable_fields = ["id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,84 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import (
|
||||
BaseModel,
|
||||
Nullable,
|
||||
OptionalNullable,
|
||||
UNSET,
|
||||
UNSET_SENTINEL,
|
||||
)
|
||||
import pydantic
|
||||
from pydantic import model_serializer
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class ReasoningDetailTextType(str, Enum):
|
||||
REASONING_TEXT = "reasoning.text"
|
||||
|
||||
|
||||
class ReasoningDetailTextFormat(str, Enum):
|
||||
UNKNOWN = "unknown"
|
||||
OPENAI_RESPONSES_V1 = "openai-responses-v1"
|
||||
ANTHROPIC_CLAUDE_V1 = "anthropic-claude-v1"
|
||||
|
||||
|
||||
class ReasoningDetailTextTypedDict(TypedDict):
|
||||
r"""Text reasoning detail"""
|
||||
|
||||
type: ReasoningDetailTextType
|
||||
text: NotRequired[Nullable[str]]
|
||||
signature: NotRequired[Nullable[str]]
|
||||
id: NotRequired[Nullable[str]]
|
||||
format_: NotRequired[Nullable[ReasoningDetailTextFormat]]
|
||||
index: NotRequired[float]
|
||||
|
||||
|
||||
class ReasoningDetailText(BaseModel):
|
||||
r"""Text reasoning detail"""
|
||||
|
||||
type: ReasoningDetailTextType
|
||||
|
||||
text: OptionalNullable[str] = UNSET
|
||||
|
||||
signature: OptionalNullable[str] = UNSET
|
||||
|
||||
id: OptionalNullable[str] = UNSET
|
||||
|
||||
format_: Annotated[
|
||||
OptionalNullable[ReasoningDetailTextFormat], pydantic.Field(alias="format")
|
||||
] = ReasoningDetailTextFormat.ANTHROPIC_CLAUDE_V1
|
||||
|
||||
index: Optional[float] = None
|
||||
|
||||
@model_serializer(mode="wrap")
|
||||
def serialize_model(self, handler):
|
||||
optional_fields = ["text", "signature", "id", "format", "index"]
|
||||
nullable_fields = ["text", "signature", "id", "format"]
|
||||
null_default_fields = []
|
||||
|
||||
serialized = handler(self)
|
||||
|
||||
m = {}
|
||||
|
||||
for n, f in type(self).model_fields.items():
|
||||
k = f.alias or n
|
||||
val = serialized.get(k)
|
||||
serialized.pop(k, None)
|
||||
|
||||
optional_nullable = k in optional_fields and k in nullable_fields
|
||||
is_set = (
|
||||
self.__pydantic_fields_set__.intersection({n})
|
||||
or k in null_default_fields
|
||||
) # pylint: disable=no-member
|
||||
|
||||
if val is not None and val != UNSET_SENTINEL:
|
||||
m[k] = val
|
||||
elif val != UNSET_SENTINEL and (
|
||||
not k in optional_fields or (optional_nullable and is_set)
|
||||
):
|
||||
m[k] = val
|
||||
|
||||
return m
|
||||
@@ -0,0 +1,13 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class ResponseFormatJSONSchemaSchemaTypedDict(TypedDict):
|
||||
r"""The schema for the response format, described as a JSON Schema object"""
|
||||
|
||||
|
||||
class ResponseFormatJSONSchemaSchema(BaseModel):
|
||||
r"""The schema for the response format, described as a JSON Schema object"""
|
||||
@@ -0,0 +1,25 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from openrouter.types import BaseModel
|
||||
from openrouter.utils import FieldMetadata, SecurityMetadata
|
||||
from typing import Optional
|
||||
from typing_extensions import Annotated, NotRequired, TypedDict
|
||||
|
||||
|
||||
class SecurityTypedDict(TypedDict):
|
||||
bearer_auth: NotRequired[str]
|
||||
|
||||
|
||||
class Security(BaseModel):
|
||||
bearer_auth: Annotated[
|
||||
Optional[str],
|
||||
FieldMetadata(
|
||||
security=SecurityMetadata(
|
||||
scheme=True,
|
||||
scheme_type="http",
|
||||
sub_type="bearer",
|
||||
field_name="Authorization",
|
||||
)
|
||||
),
|
||||
] = None
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from .chatcompletionchunk import ChatCompletionChunk, ChatCompletionChunkTypedDict
|
||||
from openrouter.types import BaseModel
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class StreamChatCompletionResponseBodyTypedDict(TypedDict):
|
||||
r"""Successful chat completion response"""
|
||||
|
||||
data: ChatCompletionChunkTypedDict
|
||||
r"""Streaming chat completion chunk"""
|
||||
|
||||
|
||||
class StreamChatCompletionResponseBody(BaseModel):
|
||||
r"""Successful chat completion response"""
|
||||
|
||||
data: ChatCompletionChunk
|
||||
r"""Streaming chat completion chunk"""
|
||||
@@ -0,0 +1,46 @@
|
||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||
|
||||
from __future__ import annotations
|
||||
from enum import Enum
|
||||
from openrouter.types import BaseModel
|
||||
from typing import Optional
|
||||
from typing_extensions import NotRequired, TypedDict
|
||||
|
||||
|
||||
class URLCitationAnnotationDetailType(str, Enum):
|
||||
URL_CITATION = "url_citation"
|
||||
|
||||
|
||||
class URLCitationTypedDict(TypedDict):
|
||||
end_index: float
|
||||
start_index: float
|
||||
title: str
|
||||
url: str
|
||||
content: NotRequired[str]
|
||||
|
||||
|
||||
class URLCitation(BaseModel):
|
||||
end_index: float
|
||||
|
||||
start_index: float
|
||||
|
||||
title: str
|
||||
|
||||
url: str
|
||||
|
||||
content: Optional[str] = None
|
||||
|
||||
|
||||
class URLCitationAnnotationDetailTypedDict(TypedDict):
|
||||
r"""URL citation annotation"""
|
||||
|
||||
type: URLCitationAnnotationDetailType
|
||||
url_citation: URLCitationTypedDict
|
||||
|
||||
|
||||
class URLCitationAnnotationDetail(BaseModel):
|
||||
r"""URL citation annotation"""
|
||||
|
||||
type: URLCitationAnnotationDetailType
|
||||
|
||||
url_citation: URLCitation
|
||||
Reference in New Issue
Block a user