@openrouter/sdk 0.5.1 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FUNCTIONS.md +5 -1
- package/esm/funcs/analyticsGetUserActivity.d.ts +1 -1
- package/esm/funcs/analyticsGetUserActivity.js +4 -2
- package/esm/funcs/apiKeysCreate.d.ts +1 -1
- package/esm/funcs/apiKeysCreate.js +5 -3
- package/esm/funcs/apiKeysDelete.d.ts +1 -1
- package/esm/funcs/apiKeysDelete.js +3 -1
- package/esm/funcs/apiKeysGet.d.ts +1 -1
- package/esm/funcs/apiKeysGet.js +3 -1
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.d.ts +1 -1
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +14 -3
- package/esm/funcs/apiKeysList.d.ts +1 -1
- package/esm/funcs/apiKeysList.js +4 -2
- package/esm/funcs/apiKeysUpdate.d.ts +1 -1
- package/esm/funcs/apiKeysUpdate.js +3 -1
- package/esm/funcs/betaResponsesSend.d.ts +9 -5
- package/esm/funcs/betaResponsesSend.js +10 -5
- package/esm/funcs/chatSend.d.ts +11 -7
- package/esm/funcs/chatSend.js +28 -7
- package/esm/funcs/creditsCreateCoinbaseCharge.d.ts +1 -2
- package/esm/funcs/creditsCreateCoinbaseCharge.js +7 -4
- package/esm/funcs/creditsGetCredits.d.ts +2 -2
- package/esm/funcs/creditsGetCredits.js +15 -4
- package/esm/funcs/embeddingsGenerate.js +4 -2
- package/esm/funcs/embeddingsListModels.d.ts +2 -1
- package/esm/funcs/embeddingsListModels.js +15 -3
- package/esm/funcs/endpointsList.js +2 -0
- package/esm/funcs/endpointsListZdrEndpoints.d.ts +1 -1
- package/esm/funcs/endpointsListZdrEndpoints.js +14 -3
- package/esm/funcs/generationsGetGeneration.js +3 -1
- package/esm/funcs/guardrailsBulkAssignKeys.d.ts +1 -1
- package/esm/funcs/guardrailsBulkAssignKeys.js +3 -1
- package/esm/funcs/guardrailsBulkAssignMembers.d.ts +1 -1
- package/esm/funcs/guardrailsBulkAssignMembers.js +3 -1
- package/esm/funcs/guardrailsBulkUnassignKeys.d.ts +1 -1
- package/esm/funcs/guardrailsBulkUnassignKeys.js +3 -1
- package/esm/funcs/guardrailsBulkUnassignMembers.d.ts +1 -1
- package/esm/funcs/guardrailsBulkUnassignMembers.js +3 -1
- package/esm/funcs/guardrailsCreate.d.ts +1 -1
- package/esm/funcs/guardrailsCreate.js +5 -3
- package/esm/funcs/guardrailsDelete.d.ts +1 -1
- package/esm/funcs/guardrailsDelete.js +3 -1
- package/esm/funcs/guardrailsGet.d.ts +1 -1
- package/esm/funcs/guardrailsGet.js +3 -1
- package/esm/funcs/guardrailsList.d.ts +1 -1
- package/esm/funcs/guardrailsList.js +4 -2
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +3 -1
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +3 -1
- package/esm/funcs/guardrailsListKeyAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListKeyAssignments.js +4 -2
- package/esm/funcs/guardrailsListMemberAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListMemberAssignments.js +4 -2
- package/esm/funcs/guardrailsUpdate.d.ts +1 -1
- package/esm/funcs/guardrailsUpdate.js +3 -1
- package/esm/funcs/modelsCount.d.ts +2 -1
- package/esm/funcs/modelsCount.js +15 -3
- package/esm/funcs/modelsList.js +3 -1
- package/esm/funcs/modelsListForUser.d.ts +1 -1
- package/esm/funcs/modelsListForUser.js +15 -3
- package/esm/funcs/oAuthCreateAuthCode.js +4 -2
- package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +4 -2
- package/esm/funcs/providersList.d.ts +1 -1
- package/esm/funcs/providersList.js +14 -3
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/model-result.d.ts +3 -5
- package/esm/lib/model-result.js +98 -46
- package/esm/models/assistantmessage.d.ts +47 -36
- package/esm/models/assistantmessage.js +35 -47
- package/esm/models/assistantmessageimages.d.ts +33 -0
- package/esm/models/assistantmessageimages.js +44 -0
- package/esm/models/chatgenerationparams.d.ts +318 -182
- package/esm/models/chatgenerationparams.js +157 -143
- package/esm/models/chatgenerationtokenusage.d.ts +48 -0
- package/esm/models/chatmessagecontentitem.d.ts +15 -10
- package/esm/models/chatmessagecontentitem.js +25 -4
- package/esm/models/chatmessagecontentitemaudio.d.ts +20 -2
- package/esm/models/chatmessagecontentitemaudio.js +9 -2
- package/esm/models/chatmessagecontentitemcachecontrol.d.ts +14 -3
- package/esm/models/chatmessagecontentitemcachecontrol.js +9 -2
- package/esm/models/chatmessagecontentitemimage.d.ts +26 -3
- package/esm/models/chatmessagecontentitemimage.js +12 -2
- package/esm/models/chatmessagecontentitemtext.d.ts +17 -2
- package/esm/models/chatmessagecontentitemtext.js +9 -2
- package/esm/models/chatmessagecontentitemvideo.d.ts +12 -55
- package/esm/models/chatmessagecontentitemvideo.js +5 -72
- package/esm/models/chatmessagecontentitemvideolegacy.d.ts +28 -0
- package/esm/models/chatmessagecontentitemvideolegacy.js +33 -0
- package/esm/models/chatmessagetokenlogprob.d.ts +15 -0
- package/esm/models/chatmessagetokenlogprobs.d.ts +9 -0
- package/esm/models/chatmessagetoolcall.d.ts +23 -2
- package/esm/models/chatmessagetoolcall.js +9 -2
- package/esm/models/chatresponse.d.ts +29 -1
- package/esm/models/chatresponse.js +6 -1
- package/esm/models/chatresponsechoice.d.ts +13 -2
- package/esm/models/chatresponsechoice.js +1 -2
- package/esm/models/chatstreamingchoice.d.ts +13 -2
- package/esm/models/chatstreamingchoice.js +1 -2
- package/esm/models/chatstreamingmessagechunk.d.ts +29 -2
- package/esm/models/chatstreamingmessagechunk.js +5 -2
- package/esm/models/chatstreamingmessagetoolcall.d.ts +38 -1
- package/esm/models/chatstreamingmessagetoolcall.js +9 -1
- package/esm/models/chatstreamingresponsechunk.d.ts +45 -11
- package/esm/models/chatstreamingresponsechunk.js +11 -25
- package/esm/models/chatstreamoptions.d.ts +8 -0
- package/esm/models/debugoptions.d.ts +18 -0
- package/esm/models/debugoptions.js +18 -0
- package/esm/models/developermessage.d.ts +35 -0
- package/esm/models/developermessage.js +24 -0
- package/esm/models/errors/index.d.ts +0 -1
- package/esm/models/errors/index.js +0 -1
- package/esm/models/index.d.ts +13 -5
- package/esm/models/index.js +13 -5
- package/esm/models/jsonschemaconfig.d.ts +17 -2
- package/esm/models/jsonschemaconfig.js +1 -1
- package/esm/models/message.d.ts +10 -23
- package/esm/models/message.js +3 -20
- package/esm/models/modelscountresponse.d.ts +4 -4
- package/esm/models/modelscountresponse.js +4 -4
- package/esm/models/namedtoolchoice.d.ts +15 -2
- package/esm/models/namedtoolchoice.js +6 -1
- package/esm/models/openairesponsesreasoningconfig.d.ts +1 -1
- package/esm/models/openairesponsesreasoningconfig.js +1 -1
- package/esm/models/openresponsesnonstreamingresponse.d.ts +4 -4
- package/esm/models/openresponsesnonstreamingresponse.js +3 -3
- package/esm/models/openresponsesreasoning.d.ts +2 -2
- package/esm/models/openresponsesreasoning.js +1 -1
- package/esm/models/openresponsesreasoningconfig.d.ts +2 -2
- package/esm/models/openresponsesreasoningconfig.js +1 -1
- package/esm/models/openresponsesrequest.d.ts +31 -13
- package/esm/models/openresponsesrequest.js +25 -0
- package/esm/models/operations/bulkassignkeystoguardrail.d.ts +30 -0
- package/esm/models/operations/bulkassignkeystoguardrail.js +4 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +30 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.js +4 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +30 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.js +4 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +30 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.js +4 -0
- package/esm/models/operations/createauthkeyscode.d.ts +66 -2
- package/esm/models/operations/createauthkeyscode.js +30 -1
- package/esm/models/operations/createcoinbasecharge.d.ts +41 -0
- package/esm/models/operations/createcoinbasecharge.js +16 -0
- package/esm/models/operations/createembeddings.d.ts +42 -2
- package/esm/models/operations/createembeddings.js +16 -1
- package/esm/models/operations/createguardrail.d.ts +42 -2
- package/esm/models/operations/createguardrail.js +16 -1
- package/esm/models/operations/createkeys.d.ts +42 -2
- package/esm/models/operations/createkeys.js +16 -1
- package/esm/models/operations/createresponses.d.ts +40 -0
- package/esm/models/operations/createresponses.js +16 -0
- package/esm/models/operations/deleteguardrail.d.ts +30 -0
- package/esm/models/operations/deleteguardrail.js +8 -0
- package/esm/models/operations/deletekeys.d.ts +30 -0
- package/esm/models/operations/deletekeys.js +8 -0
- package/esm/models/operations/exchangeauthcodeforapikey.d.ts +42 -2
- package/esm/models/operations/exchangeauthcodeforapikey.js +16 -1
- package/esm/models/operations/getcredits.d.ts +38 -0
- package/esm/models/operations/getcredits.js +13 -0
- package/esm/models/operations/getcurrentkey.d.ts +45 -1
- package/esm/models/operations/getcurrentkey.js +15 -0
- package/esm/models/operations/getgeneration.d.ts +153 -0
- package/esm/models/operations/getgeneration.js +135 -0
- package/esm/models/operations/getguardrail.d.ts +30 -0
- package/esm/models/operations/getguardrail.js +7 -0
- package/esm/models/operations/getkey.d.ts +30 -0
- package/esm/models/operations/getkey.js +7 -0
- package/esm/models/operations/getmodels.d.ts +30 -0
- package/esm/models/operations/getmodels.js +4 -0
- package/esm/models/operations/getuseractivity.d.ts +30 -0
- package/esm/models/operations/getuseractivity.js +8 -0
- package/esm/models/operations/index.d.ts +2 -0
- package/esm/models/operations/index.js +2 -0
- package/esm/models/operations/list.d.ts +30 -0
- package/esm/models/operations/list.js +4 -0
- package/esm/models/operations/listembeddingsmodels.d.ts +40 -0
- package/esm/models/operations/listembeddingsmodels.js +20 -0
- package/esm/models/operations/listendpoints.d.ts +30 -0
- package/esm/models/operations/listendpoints.js +8 -0
- package/esm/models/operations/listendpointszdr.d.ts +38 -0
- package/esm/models/operations/listendpointszdr.js +14 -0
- package/esm/models/operations/listguardrailkeyassignments.d.ts +30 -0
- package/esm/models/operations/listguardrailkeyassignments.js +7 -0
- package/esm/models/operations/listguardrailmemberassignments.d.ts +30 -0
- package/esm/models/operations/listguardrailmemberassignments.js +7 -0
- package/esm/models/operations/listguardrails.d.ts +30 -0
- package/esm/models/operations/listguardrails.js +7 -0
- package/esm/models/operations/listkeyassignments.d.ts +30 -0
- package/esm/models/operations/listkeyassignments.js +7 -0
- package/esm/models/operations/listmemberassignments.d.ts +30 -0
- package/esm/models/operations/listmemberassignments.js +7 -0
- package/esm/models/operations/listmodelscount.d.ts +40 -0
- package/esm/models/operations/listmodelscount.js +20 -0
- package/esm/models/operations/listmodelsuser.d.ts +38 -0
- package/esm/models/operations/listmodelsuser.js +14 -0
- package/esm/models/operations/listproviders.d.ts +38 -0
- package/esm/models/operations/listproviders.js +13 -0
- package/esm/models/operations/sendchatcompletionrequest.d.ts +53 -1
- package/esm/models/operations/sendchatcompletionrequest.js +36 -2
- package/esm/models/operations/updateguardrail.d.ts +30 -0
- package/esm/models/operations/updateguardrail.js +4 -0
- package/esm/models/operations/updatekeys.d.ts +30 -0
- package/esm/models/operations/updatekeys.js +4 -0
- package/esm/models/providername.d.ts +4 -0
- package/esm/models/providername.js +4 -0
- package/esm/models/providerpreferences.d.ts +46 -27
- package/esm/models/providerpreferences.js +29 -15
- package/esm/models/providersort.d.ts +6 -0
- package/esm/models/providersort.js +3 -0
- package/esm/models/providersortconfig.d.ts +30 -2
- package/esm/models/providersortconfig.js +15 -2
- package/esm/models/publicendpoint.d.ts +0 -39
- package/esm/models/publicpricing.d.ts +0 -39
- package/esm/models/reasoningdetailencrypted.d.ts +42 -0
- package/esm/models/reasoningdetailencrypted.js +42 -0
- package/esm/models/reasoningdetailsummary.d.ts +42 -0
- package/esm/models/reasoningdetailsummary.js +42 -0
- package/esm/models/reasoningdetailtext.d.ts +44 -0
- package/esm/models/reasoningdetailtext.js +44 -0
- package/esm/models/reasoningdetailunion.d.ts +19 -0
- package/esm/models/reasoningdetailunion.js +28 -0
- package/esm/models/responseformatjsonobject.d.ts +20 -0
- package/esm/models/responseformatjsonobject.js +21 -0
- package/esm/models/responseformatjsonschema.d.ts +6 -0
- package/esm/models/responseformattext.d.ts +15 -0
- package/esm/models/responseformattext.js +13 -0
- package/esm/models/responseformattextconfig.d.ts +3 -3
- package/esm/models/responseformattextconfig.js +3 -3
- package/esm/models/responseformattextgrammar.d.ts +6 -0
- package/esm/models/responseformattextpython.d.ts +15 -0
- package/esm/models/responseformattextpython.js +13 -0
- package/esm/models/responseserrorfield.d.ts +4 -4
- package/esm/models/responseserrorfield.js +4 -4
- package/esm/models/responsesoutputitemreasoning.d.ts +2 -2
- package/esm/models/responsesoutputitemreasoning.js +2 -2
- package/esm/models/systemmessage.d.ts +12 -0
- package/esm/models/toolchoiceoption.d.ts +31 -0
- package/esm/models/toolchoiceoption.js +32 -0
- package/esm/models/tooldefinitionjson.d.ts +38 -4
- package/esm/models/tooldefinitionjson.js +14 -2
- package/esm/models/toolresponsemessage.d.ts +12 -0
- package/esm/models/usermessage.d.ts +12 -0
- package/esm/models/videoinput.d.ts +23 -0
- package/esm/models/videoinput.js +22 -0
- package/esm/sdk/analytics.d.ts +1 -1
- package/esm/sdk/analytics.js +1 -1
- package/esm/sdk/apikeys.d.ts +6 -6
- package/esm/sdk/apikeys.js +7 -7
- package/esm/sdk/chat.d.ts +10 -6
- package/esm/sdk/credits.d.ts +3 -4
- package/esm/sdk/credits.js +3 -3
- package/esm/sdk/embeddings.d.ts +1 -1
- package/esm/sdk/embeddings.js +2 -2
- package/esm/sdk/endpoints.d.ts +1 -1
- package/esm/sdk/endpoints.js +2 -2
- package/esm/sdk/guardrails.d.ts +13 -13
- package/esm/sdk/guardrails.js +13 -13
- package/esm/sdk/models.d.ts +2 -2
- package/esm/sdk/models.js +4 -4
- package/esm/sdk/providers.d.ts +1 -1
- package/esm/sdk/providers.js +2 -2
- package/esm/sdk/responses.d.ts +9 -5
- package/esm/sdk/sdk.d.ts +2 -2
- package/esm/sdk/sdk.js +3 -3
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/esm/models/chaterror.d.ts +0 -17
- package/esm/models/chaterror.js +0 -25
- package/esm/models/errors/chaterror.d.ts +0 -19
- package/esm/models/errors/chaterror.js +0 -32
- package/esm/models/providersortunion.d.ts +0 -10
- package/esm/models/providersortunion.js +0 -13
- package/esm/models/responsesformatjsonobject.d.ts +0 -20
- package/esm/models/responsesformatjsonobject.js +0 -21
- package/esm/models/schema0.d.ts +0 -84
- package/esm/models/schema0.js +0 -87
- package/esm/models/schema2.d.ts +0 -92
- package/esm/models/schema2.js +0 -109
|
@@ -6,41 +6,58 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
8
|
import { ChatStreamOptions$outboundSchema, } from "./chatstreamoptions.js";
|
|
9
|
+
import { DataCollection$outboundSchema, } from "./datacollection.js";
|
|
10
|
+
import { DebugOptions$outboundSchema, } from "./debugoptions.js";
|
|
9
11
|
import { Message$outboundSchema, } from "./message.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
+
import { PDFParserOptions$outboundSchema, } from "./pdfparseroptions.js";
|
|
13
|
+
import { PreferredMaxLatency$outboundSchema, } from "./preferredmaxlatency.js";
|
|
14
|
+
import { PreferredMinThroughput$outboundSchema, } from "./preferredminthroughput.js";
|
|
15
|
+
import { ProviderName$outboundSchema } from "./providername.js";
|
|
16
|
+
import { Quantization$outboundSchema } from "./quantization.js";
|
|
17
|
+
import { ResponseFormatJSONObject$outboundSchema, } from "./responseformatjsonobject.js";
|
|
12
18
|
import { ResponseFormatJSONSchema$outboundSchema, } from "./responseformatjsonschema.js";
|
|
19
|
+
import { ResponseFormatText$outboundSchema, } from "./responseformattext.js";
|
|
13
20
|
import { ResponseFormatTextGrammar$outboundSchema, } from "./responseformattextgrammar.js";
|
|
14
|
-
import {
|
|
21
|
+
import { ResponseFormatTextPython$outboundSchema, } from "./responseformattextpython.js";
|
|
22
|
+
import { ToolChoiceOption$outboundSchema, } from "./toolchoiceoption.js";
|
|
15
23
|
import { ToolDefinitionJson$outboundSchema, } from "./tooldefinitionjson.js";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
import { WebSearchEngine$outboundSchema, } from "./websearchengine.js";
|
|
25
|
+
export const ChatGenerationParamsSortEnum = {
|
|
26
|
+
Price: "price",
|
|
27
|
+
Throughput: "throughput",
|
|
28
|
+
Latency: "latency",
|
|
19
29
|
};
|
|
20
|
-
export const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Fp6: "fp6",
|
|
25
|
-
Fp8: "fp8",
|
|
26
|
-
Fp16: "fp16",
|
|
27
|
-
Bf16: "bf16",
|
|
28
|
-
Fp32: "fp32",
|
|
29
|
-
Unknown: "unknown",
|
|
30
|
+
export const ChatGenerationParamsProviderSortConfigEnum = {
|
|
31
|
+
Price: "price",
|
|
32
|
+
Throughput: "throughput",
|
|
33
|
+
Latency: "latency",
|
|
30
34
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
37
|
+
*/
|
|
38
|
+
export const ChatGenerationParamsBy = {
|
|
39
|
+
Price: "price",
|
|
40
|
+
Throughput: "throughput",
|
|
41
|
+
Latency: "latency",
|
|
35
42
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model.
|
|
45
|
+
*/
|
|
46
|
+
export const ChatGenerationParamsPartition = {
|
|
47
|
+
Model: "model",
|
|
48
|
+
None: "none",
|
|
39
49
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The provider sorting strategy (price, throughput, latency)
|
|
52
|
+
*/
|
|
53
|
+
export const ChatGenerationParamsProviderSort = {
|
|
54
|
+
Price: "price",
|
|
55
|
+
Throughput: "throughput",
|
|
56
|
+
Latency: "latency",
|
|
43
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Constrains effort on reasoning for reasoning models
|
|
60
|
+
*/
|
|
44
61
|
export const Effort = {
|
|
45
62
|
Xhigh: "xhigh",
|
|
46
63
|
High: "high",
|
|
@@ -54,79 +71,97 @@ export const Modality = {
|
|
|
54
71
|
Image: "image",
|
|
55
72
|
};
|
|
56
73
|
/** @internal */
|
|
57
|
-
export const
|
|
74
|
+
export const ChatGenerationParamsOrder$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
75
|
+
export function chatGenerationParamsOrderToJSON(chatGenerationParamsOrder) {
|
|
76
|
+
return JSON.stringify(ChatGenerationParamsOrder$outboundSchema.parse(chatGenerationParamsOrder));
|
|
77
|
+
}
|
|
58
78
|
/** @internal */
|
|
59
|
-
export const
|
|
79
|
+
export const ChatGenerationParamsOnly$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
80
|
+
export function chatGenerationParamsOnlyToJSON(chatGenerationParamsOnly) {
|
|
81
|
+
return JSON.stringify(ChatGenerationParamsOnly$outboundSchema.parse(chatGenerationParamsOnly));
|
|
82
|
+
}
|
|
60
83
|
/** @internal */
|
|
61
|
-
export const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
image: z.any().optional(),
|
|
65
|
-
audio: z.any().optional(),
|
|
66
|
-
request: z.any().optional(),
|
|
67
|
-
});
|
|
68
|
-
export function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice) {
|
|
69
|
-
return JSON.stringify(ChatGenerationParamsMaxPrice$outboundSchema.parse(chatGenerationParamsMaxPrice));
|
|
84
|
+
export const ChatGenerationParamsIgnore$outboundSchema = z.union([ProviderName$outboundSchema, z.string()]);
|
|
85
|
+
export function chatGenerationParamsIgnoreToJSON(chatGenerationParamsIgnore) {
|
|
86
|
+
return JSON.stringify(ChatGenerationParamsIgnore$outboundSchema.parse(chatGenerationParamsIgnore));
|
|
70
87
|
}
|
|
71
88
|
/** @internal */
|
|
72
|
-
export const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
89
|
+
export const ChatGenerationParamsSortEnum$outboundSchema = openEnums.outboundSchema(ChatGenerationParamsSortEnum);
|
|
90
|
+
/** @internal */
|
|
91
|
+
export const ChatGenerationParamsProviderSortConfigEnum$outboundSchema = z.enum(ChatGenerationParamsProviderSortConfigEnum);
|
|
92
|
+
/** @internal */
|
|
93
|
+
export const ChatGenerationParamsBy$outboundSchema = openEnums.outboundSchema(ChatGenerationParamsBy);
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const ChatGenerationParamsPartition$outboundSchema = openEnums.outboundSchema(ChatGenerationParamsPartition);
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const ChatGenerationParamsProviderSortConfig$outboundSchema = z.object({
|
|
98
|
+
by: z.nullable(ChatGenerationParamsBy$outboundSchema).optional(),
|
|
99
|
+
partition: z.nullable(ChatGenerationParamsPartition$outboundSchema)
|
|
100
|
+
.optional(),
|
|
77
101
|
});
|
|
78
|
-
export function
|
|
79
|
-
return JSON.stringify(
|
|
102
|
+
export function chatGenerationParamsProviderSortConfigToJSON(chatGenerationParamsProviderSortConfig) {
|
|
103
|
+
return JSON.stringify(ChatGenerationParamsProviderSortConfig$outboundSchema.parse(chatGenerationParamsProviderSortConfig));
|
|
80
104
|
}
|
|
81
105
|
/** @internal */
|
|
82
|
-
export const
|
|
83
|
-
z.
|
|
84
|
-
|
|
106
|
+
export const ChatGenerationParamsProviderSortConfigUnion$outboundSchema = z.union([
|
|
107
|
+
z.lazy(() => ChatGenerationParamsProviderSortConfig$outboundSchema),
|
|
108
|
+
ChatGenerationParamsProviderSortConfigEnum$outboundSchema,
|
|
85
109
|
]);
|
|
86
|
-
export function
|
|
87
|
-
return JSON.stringify(
|
|
110
|
+
export function chatGenerationParamsProviderSortConfigUnionToJSON(chatGenerationParamsProviderSortConfigUnion) {
|
|
111
|
+
return JSON.stringify(ChatGenerationParamsProviderSortConfigUnion$outboundSchema.parse(chatGenerationParamsProviderSortConfigUnion));
|
|
88
112
|
}
|
|
89
113
|
/** @internal */
|
|
90
|
-
export const
|
|
91
|
-
p50: z.nullable(z.number()).optional(),
|
|
92
|
-
p75: z.nullable(z.number()).optional(),
|
|
93
|
-
p90: z.nullable(z.number()).optional(),
|
|
94
|
-
p99: z.nullable(z.number()).optional(),
|
|
95
|
-
});
|
|
96
|
-
export function chatGenerationParamsPreferredMaxLatencyToJSON(chatGenerationParamsPreferredMaxLatency) {
|
|
97
|
-
return JSON.stringify(ChatGenerationParamsPreferredMaxLatency$outboundSchema.parse(chatGenerationParamsPreferredMaxLatency));
|
|
98
|
-
}
|
|
114
|
+
export const ChatGenerationParamsProviderSort$outboundSchema = openEnums.outboundSchema(ChatGenerationParamsProviderSort);
|
|
99
115
|
/** @internal */
|
|
100
|
-
export const
|
|
101
|
-
|
|
102
|
-
z.
|
|
116
|
+
export const ChatGenerationParamsSortUnion$outboundSchema = z.union([
|
|
117
|
+
ChatGenerationParamsProviderSort$outboundSchema,
|
|
118
|
+
z.union([
|
|
119
|
+
z.lazy(() => ChatGenerationParamsProviderSortConfig$outboundSchema),
|
|
120
|
+
ChatGenerationParamsProviderSortConfigEnum$outboundSchema,
|
|
121
|
+
]),
|
|
122
|
+
ChatGenerationParamsSortEnum$outboundSchema,
|
|
103
123
|
]);
|
|
104
|
-
export function
|
|
105
|
-
return JSON.stringify(
|
|
124
|
+
export function chatGenerationParamsSortUnionToJSON(chatGenerationParamsSortUnion) {
|
|
125
|
+
return JSON.stringify(ChatGenerationParamsSortUnion$outboundSchema.parse(chatGenerationParamsSortUnion));
|
|
126
|
+
}
|
|
127
|
+
/** @internal */
|
|
128
|
+
export const ChatGenerationParamsMaxPrice$outboundSchema = z.object({
|
|
129
|
+
prompt: z.string().optional(),
|
|
130
|
+
completion: z.string().optional(),
|
|
131
|
+
image: z.string().optional(),
|
|
132
|
+
audio: z.string().optional(),
|
|
133
|
+
request: z.string().optional(),
|
|
134
|
+
});
|
|
135
|
+
export function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice) {
|
|
136
|
+
return JSON.stringify(ChatGenerationParamsMaxPrice$outboundSchema.parse(chatGenerationParamsMaxPrice));
|
|
106
137
|
}
|
|
107
138
|
/** @internal */
|
|
108
139
|
export const ChatGenerationParamsProvider$outboundSchema = z.object({
|
|
109
140
|
allowFallbacks: z.nullable(z.boolean()).optional(),
|
|
110
141
|
requireParameters: z.nullable(z.boolean()).optional(),
|
|
111
|
-
dataCollection: z.nullable(
|
|
112
|
-
.optional(),
|
|
142
|
+
dataCollection: z.nullable(DataCollection$outboundSchema).optional(),
|
|
113
143
|
zdr: z.nullable(z.boolean()).optional(),
|
|
114
144
|
enforceDistillableText: z.nullable(z.boolean()).optional(),
|
|
115
|
-
order: z.nullable(z.array(
|
|
116
|
-
only: z.nullable(z.array(Schema0$outboundSchema)).optional(),
|
|
117
|
-
ignore: z.nullable(z.array(Schema0$outboundSchema)).optional(),
|
|
118
|
-
quantizations: z.nullable(z.array(Quantizations$outboundSchema)).optional(),
|
|
119
|
-
sort: z.nullable(ProviderSortUnion$outboundSchema).optional(),
|
|
120
|
-
maxPrice: z.lazy(() => ChatGenerationParamsMaxPrice$outboundSchema)
|
|
145
|
+
order: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
|
|
121
146
|
.optional(),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
z.
|
|
147
|
+
only: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()])))
|
|
148
|
+
.optional(),
|
|
149
|
+
ignore: z.nullable(z.array(z.union([ProviderName$outboundSchema, z.string()]))).optional(),
|
|
150
|
+
quantizations: z.nullable(z.array(Quantization$outboundSchema)).optional(),
|
|
151
|
+
sort: z.nullable(z.union([
|
|
152
|
+
ChatGenerationParamsProviderSort$outboundSchema,
|
|
153
|
+
z.union([
|
|
154
|
+
z.lazy(() => ChatGenerationParamsProviderSortConfig$outboundSchema),
|
|
155
|
+
ChatGenerationParamsProviderSortConfigEnum$outboundSchema,
|
|
156
|
+
]),
|
|
157
|
+
ChatGenerationParamsSortEnum$outboundSchema,
|
|
129
158
|
])).optional(),
|
|
159
|
+
maxPrice: z.lazy(() => ChatGenerationParamsMaxPrice$outboundSchema)
|
|
160
|
+
.optional(),
|
|
161
|
+
preferredMinThroughput: z.nullable(PreferredMinThroughput$outboundSchema)
|
|
162
|
+
.optional(),
|
|
163
|
+
preferredMaxLatency: z.nullable(PreferredMaxLatency$outboundSchema)
|
|
164
|
+
.optional(),
|
|
130
165
|
}).transform((v) => {
|
|
131
166
|
return remap$(v, {
|
|
132
167
|
allowFallbacks: "allow_fallbacks",
|
|
@@ -150,34 +185,21 @@ export function chatGenerationParamsPluginResponseHealingToJSON(chatGenerationPa
|
|
|
150
185
|
return JSON.stringify(ChatGenerationParamsPluginResponseHealing$outboundSchema.parse(chatGenerationParamsPluginResponseHealing));
|
|
151
186
|
}
|
|
152
187
|
/** @internal */
|
|
153
|
-
export const PdfEngine$outboundSchema = openEnums
|
|
154
|
-
.outboundSchema(PdfEngine);
|
|
155
|
-
/** @internal */
|
|
156
|
-
export const Pdf$outboundSchema = z.object({
|
|
157
|
-
engine: PdfEngine$outboundSchema.optional(),
|
|
158
|
-
});
|
|
159
|
-
export function pdfToJSON(pdf) {
|
|
160
|
-
return JSON.stringify(Pdf$outboundSchema.parse(pdf));
|
|
161
|
-
}
|
|
162
|
-
/** @internal */
|
|
163
188
|
export const ChatGenerationParamsPluginFileParser$outboundSchema = z.object({
|
|
164
189
|
id: z.literal("file-parser"),
|
|
165
190
|
enabled: z.boolean().optional(),
|
|
166
|
-
pdf:
|
|
191
|
+
pdf: PDFParserOptions$outboundSchema.optional(),
|
|
167
192
|
});
|
|
168
193
|
export function chatGenerationParamsPluginFileParserToJSON(chatGenerationParamsPluginFileParser) {
|
|
169
194
|
return JSON.stringify(ChatGenerationParamsPluginFileParser$outboundSchema.parse(chatGenerationParamsPluginFileParser));
|
|
170
195
|
}
|
|
171
196
|
/** @internal */
|
|
172
|
-
export const Engine$outboundSchema = openEnums
|
|
173
|
-
.outboundSchema(Engine);
|
|
174
|
-
/** @internal */
|
|
175
197
|
export const ChatGenerationParamsPluginWeb$outboundSchema = z.object({
|
|
176
198
|
id: z.literal("web"),
|
|
177
199
|
enabled: z.boolean().optional(),
|
|
178
200
|
maxResults: z.number().optional(),
|
|
179
201
|
searchPrompt: z.string().optional(),
|
|
180
|
-
engine:
|
|
202
|
+
engine: WebSearchEngine$outboundSchema.optional(),
|
|
181
203
|
}).transform((v) => {
|
|
182
204
|
return remap$(v, {
|
|
183
205
|
maxResults: "max_results",
|
|
@@ -219,47 +241,47 @@ export function chatGenerationParamsPluginUnionToJSON(chatGenerationParamsPlugin
|
|
|
219
241
|
return JSON.stringify(ChatGenerationParamsPluginUnion$outboundSchema.parse(chatGenerationParamsPluginUnion));
|
|
220
242
|
}
|
|
221
243
|
/** @internal */
|
|
222
|
-
export const
|
|
223
|
-
.
|
|
244
|
+
export const ChatGenerationParamsTrace$outboundSchema = z.object({
|
|
245
|
+
traceId: z.string().optional(),
|
|
246
|
+
traceName: z.string().optional(),
|
|
247
|
+
spanName: z.string().optional(),
|
|
248
|
+
generationName: z.string().optional(),
|
|
249
|
+
parentSpanId: z.string().optional(),
|
|
250
|
+
additionalProperties: z.record(z.string(), z.nullable(z.any())).optional(),
|
|
251
|
+
}).transform((v) => {
|
|
252
|
+
return {
|
|
253
|
+
...v.additionalProperties,
|
|
254
|
+
...remap$(v, {
|
|
255
|
+
traceId: "trace_id",
|
|
256
|
+
traceName: "trace_name",
|
|
257
|
+
spanName: "span_name",
|
|
258
|
+
generationName: "generation_name",
|
|
259
|
+
parentSpanId: "parent_span_id",
|
|
260
|
+
additionalProperties: null,
|
|
261
|
+
}),
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
export function chatGenerationParamsTraceToJSON(chatGenerationParamsTrace) {
|
|
265
|
+
return JSON.stringify(ChatGenerationParamsTrace$outboundSchema.parse(chatGenerationParamsTrace));
|
|
266
|
+
}
|
|
224
267
|
/** @internal */
|
|
225
268
|
export const Effort$outboundSchema = openEnums
|
|
226
269
|
.outboundSchema(Effort);
|
|
227
270
|
/** @internal */
|
|
228
271
|
export const Reasoning$outboundSchema = z.object({
|
|
229
272
|
effort: z.nullable(Effort$outboundSchema).optional(),
|
|
230
|
-
summary: z.nullable(
|
|
273
|
+
summary: z.nullable(z.any()).optional(),
|
|
231
274
|
});
|
|
232
275
|
export function reasoningToJSON(reasoning) {
|
|
233
276
|
return JSON.stringify(Reasoning$outboundSchema.parse(reasoning));
|
|
234
277
|
}
|
|
235
278
|
/** @internal */
|
|
236
|
-
export const ResponseFormatPython$outboundSchema = z.object({
|
|
237
|
-
type: z.literal("python"),
|
|
238
|
-
});
|
|
239
|
-
export function responseFormatPythonToJSON(responseFormatPython) {
|
|
240
|
-
return JSON.stringify(ResponseFormatPython$outboundSchema.parse(responseFormatPython));
|
|
241
|
-
}
|
|
242
|
-
/** @internal */
|
|
243
|
-
export const ResponseFormatJSONObject$outboundSchema = z.object({
|
|
244
|
-
type: z.literal("json_object"),
|
|
245
|
-
});
|
|
246
|
-
export function responseFormatJSONObjectToJSON(responseFormatJSONObject) {
|
|
247
|
-
return JSON.stringify(ResponseFormatJSONObject$outboundSchema.parse(responseFormatJSONObject));
|
|
248
|
-
}
|
|
249
|
-
/** @internal */
|
|
250
|
-
export const ResponseFormatText$outboundSchema = z.object({
|
|
251
|
-
type: z.literal("text"),
|
|
252
|
-
});
|
|
253
|
-
export function responseFormatTextToJSON(responseFormatText) {
|
|
254
|
-
return JSON.stringify(ResponseFormatText$outboundSchema.parse(responseFormatText));
|
|
255
|
-
}
|
|
256
|
-
/** @internal */
|
|
257
279
|
export const ResponseFormat$outboundSchema = z.union([
|
|
258
|
-
|
|
259
|
-
|
|
280
|
+
ResponseFormatText$outboundSchema,
|
|
281
|
+
ResponseFormatJSONObject$outboundSchema,
|
|
260
282
|
ResponseFormatJSONSchema$outboundSchema,
|
|
261
283
|
ResponseFormatTextGrammar$outboundSchema,
|
|
262
|
-
|
|
284
|
+
ResponseFormatTextPython$outboundSchema,
|
|
263
285
|
]);
|
|
264
286
|
export function responseFormatToJSON(responseFormat) {
|
|
265
287
|
return JSON.stringify(ResponseFormat$outboundSchema.parse(responseFormat));
|
|
@@ -268,23 +290,13 @@ export function responseFormatToJSON(responseFormat) {
|
|
|
268
290
|
export const Stop$outboundSchema = z.union([
|
|
269
291
|
z.string(),
|
|
270
292
|
z.array(z.string()),
|
|
293
|
+
z.any(),
|
|
271
294
|
]);
|
|
272
295
|
export function stopToJSON(stop) {
|
|
273
296
|
return JSON.stringify(Stop$outboundSchema.parse(stop));
|
|
274
297
|
}
|
|
275
298
|
/** @internal */
|
|
276
|
-
export const
|
|
277
|
-
echoUpstreamBody: z.boolean().optional(),
|
|
278
|
-
}).transform((v) => {
|
|
279
|
-
return remap$(v, {
|
|
280
|
-
echoUpstreamBody: "echo_upstream_body",
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
export function debugToJSON(debug) {
|
|
284
|
-
return JSON.stringify(Debug$outboundSchema.parse(debug));
|
|
285
|
-
}
|
|
286
|
-
/** @internal */
|
|
287
|
-
export const ChatGenerationParamsImageConfig$outboundSchema = z.union([z.string(), z.number()]);
|
|
299
|
+
export const ChatGenerationParamsImageConfig$outboundSchema = z.union([z.string(), z.number(), z.array(z.nullable(z.any()))]);
|
|
288
300
|
export function chatGenerationParamsImageConfigToJSON(chatGenerationParamsImageConfig) {
|
|
289
301
|
return JSON.stringify(ChatGenerationParamsImageConfig$outboundSchema.parse(chatGenerationParamsImageConfig));
|
|
290
302
|
}
|
|
@@ -301,9 +313,9 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
301
313
|
z.lazy(() => ChatGenerationParamsPluginFileParser$outboundSchema),
|
|
302
314
|
z.lazy(() => ChatGenerationParamsPluginResponseHealing$outboundSchema),
|
|
303
315
|
])).optional(),
|
|
304
|
-
route: z.nullable(Route$outboundSchema).optional(),
|
|
305
316
|
user: z.string().optional(),
|
|
306
317
|
sessionId: z.string().optional(),
|
|
318
|
+
trace: z.lazy(() => ChatGenerationParamsTrace$outboundSchema).optional(),
|
|
307
319
|
messages: z.array(Message$outboundSchema),
|
|
308
320
|
model: z.string().optional(),
|
|
309
321
|
models: z.array(z.string()).optional(),
|
|
@@ -317,23 +329,24 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
317
329
|
presencePenalty: z.nullable(z.number()).optional(),
|
|
318
330
|
reasoning: z.lazy(() => Reasoning$outboundSchema).optional(),
|
|
319
331
|
responseFormat: z.union([
|
|
320
|
-
|
|
321
|
-
|
|
332
|
+
ResponseFormatText$outboundSchema,
|
|
333
|
+
ResponseFormatJSONObject$outboundSchema,
|
|
322
334
|
ResponseFormatJSONSchema$outboundSchema,
|
|
323
335
|
ResponseFormatTextGrammar$outboundSchema,
|
|
324
|
-
|
|
336
|
+
ResponseFormatTextPython$outboundSchema,
|
|
325
337
|
]).optional(),
|
|
326
338
|
seed: z.nullable(z.int()).optional(),
|
|
327
|
-
stop: z.nullable(z.union([z.string(), z.array(z.string())]))
|
|
339
|
+
stop: z.nullable(z.union([z.string(), z.array(z.string()), z.any()]))
|
|
340
|
+
.optional(),
|
|
328
341
|
stream: z.boolean().default(false),
|
|
329
342
|
streamOptions: z.nullable(ChatStreamOptions$outboundSchema).optional(),
|
|
330
|
-
temperature: z.nullable(z.number()
|
|
331
|
-
|
|
343
|
+
temperature: z.nullable(z.number().default(1)),
|
|
344
|
+
parallelToolCalls: z.nullable(z.boolean()).optional(),
|
|
345
|
+
toolChoice: ToolChoiceOption$outboundSchema.optional(),
|
|
332
346
|
tools: z.array(ToolDefinitionJson$outboundSchema).optional(),
|
|
333
|
-
topP: z.nullable(z.number()
|
|
334
|
-
debug:
|
|
335
|
-
imageConfig: z.record(z.string(), z.union([z.string(), z.number()]))
|
|
336
|
-
.optional(),
|
|
347
|
+
topP: z.nullable(z.number().default(1)),
|
|
348
|
+
debug: DebugOptions$outboundSchema.optional(),
|
|
349
|
+
imageConfig: z.record(z.string(), z.union([z.string(), z.number(), z.array(z.nullable(z.any()))])).optional(),
|
|
337
350
|
modalities: z.array(Modality$outboundSchema).optional(),
|
|
338
351
|
}).transform((v) => {
|
|
339
352
|
return remap$(v, {
|
|
@@ -346,6 +359,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
346
359
|
presencePenalty: "presence_penalty",
|
|
347
360
|
responseFormat: "response_format",
|
|
348
361
|
streamOptions: "stream_options",
|
|
362
|
+
parallelToolCalls: "parallel_tool_calls",
|
|
349
363
|
toolChoice: "tool_choice",
|
|
350
364
|
topP: "top_p",
|
|
351
365
|
imageConfig: "image_config",
|
|
@@ -1,23 +1,71 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Detailed completion token usage
|
|
6
|
+
*/
|
|
4
7
|
export type CompletionTokensDetails = {
|
|
8
|
+
/**
|
|
9
|
+
* Tokens used for reasoning
|
|
10
|
+
*/
|
|
5
11
|
reasoningTokens?: number | null | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Tokens used for audio output
|
|
14
|
+
*/
|
|
6
15
|
audioTokens?: number | null | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Accepted prediction tokens
|
|
18
|
+
*/
|
|
7
19
|
acceptedPredictionTokens?: number | null | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Rejected prediction tokens
|
|
22
|
+
*/
|
|
8
23
|
rejectedPredictionTokens?: number | null | undefined;
|
|
9
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Detailed prompt token usage
|
|
27
|
+
*/
|
|
10
28
|
export type PromptTokensDetails = {
|
|
29
|
+
/**
|
|
30
|
+
* Cached prompt tokens
|
|
31
|
+
*/
|
|
11
32
|
cachedTokens?: number | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Tokens written to cache. Only returned for models with explicit caching and cache write pricing.
|
|
35
|
+
*/
|
|
12
36
|
cacheWriteTokens?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Audio input tokens
|
|
39
|
+
*/
|
|
13
40
|
audioTokens?: number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Video input tokens
|
|
43
|
+
*/
|
|
14
44
|
videoTokens?: number | undefined;
|
|
15
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Token usage statistics
|
|
48
|
+
*/
|
|
16
49
|
export type ChatGenerationTokenUsage = {
|
|
50
|
+
/**
|
|
51
|
+
* Number of tokens in the completion
|
|
52
|
+
*/
|
|
17
53
|
completionTokens: number;
|
|
54
|
+
/**
|
|
55
|
+
* Number of tokens in the prompt
|
|
56
|
+
*/
|
|
18
57
|
promptTokens: number;
|
|
58
|
+
/**
|
|
59
|
+
* Total number of tokens
|
|
60
|
+
*/
|
|
19
61
|
totalTokens: number;
|
|
62
|
+
/**
|
|
63
|
+
* Detailed completion token usage
|
|
64
|
+
*/
|
|
20
65
|
completionTokensDetails?: CompletionTokensDetails | null | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Detailed prompt token usage
|
|
68
|
+
*/
|
|
21
69
|
promptTokensDetails?: PromptTokensDetails | null | undefined;
|
|
22
70
|
};
|
|
23
71
|
/** @internal */
|
|
@@ -4,20 +4,25 @@ import { ChatMessageContentItemAudio, ChatMessageContentItemAudio$Outbound } fro
|
|
|
4
4
|
import { ChatMessageContentItemImage, ChatMessageContentItemImage$Outbound } from "./chatmessagecontentitemimage.js";
|
|
5
5
|
import { ChatMessageContentItemText, ChatMessageContentItemText$Outbound } from "./chatmessagecontentitemtext.js";
|
|
6
6
|
import { ChatMessageContentItemVideo, ChatMessageContentItemVideo$Outbound } from "./chatmessagecontentitemvideo.js";
|
|
7
|
+
import { ChatMessageContentItemVideoLegacy, ChatMessageContentItemVideoLegacy$Outbound } from "./chatmessagecontentitemvideolegacy.js";
|
|
7
8
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
8
|
-
export type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export type ChatMessageContentItem1 = ChatMessageContentItemVideoLegacy | ChatMessageContentItemVideo;
|
|
10
|
+
/**
|
|
11
|
+
* Content part for chat completion messages
|
|
12
|
+
*/
|
|
13
|
+
export type ChatMessageContentItem = ChatMessageContentItemText | ChatMessageContentItemImage | ChatMessageContentItemAudio | ChatMessageContentItemVideoLegacy | ChatMessageContentItemVideo;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare const ChatMessageContentItem1$inboundSchema: z.ZodType<ChatMessageContentItem1, unknown>;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export type ChatMessageContentItem1$Outbound = ChatMessageContentItemVideoLegacy$Outbound | ChatMessageContentItemVideo$Outbound;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare const ChatMessageContentItem1$outboundSchema: z.ZodType<ChatMessageContentItem1$Outbound, ChatMessageContentItem1>;
|
|
20
|
+
export declare function chatMessageContentItem1ToJSON(chatMessageContentItem1: ChatMessageContentItem1): string;
|
|
21
|
+
export declare function chatMessageContentItem1FromJSON(jsonString: string): SafeParseResult<ChatMessageContentItem1, SDKValidationError>;
|
|
13
22
|
/** @internal */
|
|
14
23
|
export declare const ChatMessageContentItem$inboundSchema: z.ZodType<ChatMessageContentItem, unknown>;
|
|
15
24
|
/** @internal */
|
|
16
|
-
export type ChatMessageContentItem$Outbound = ChatMessageContentItemText$Outbound | ChatMessageContentItemImage$Outbound | ChatMessageContentItemAudio$Outbound |
|
|
17
|
-
type: "input_video";
|
|
18
|
-
}) | (ChatMessageContentItemVideo$Outbound & {
|
|
19
|
-
type: "video_url";
|
|
20
|
-
});
|
|
25
|
+
export type ChatMessageContentItem$Outbound = ChatMessageContentItemText$Outbound | ChatMessageContentItemImage$Outbound | ChatMessageContentItemAudio$Outbound | ChatMessageContentItemVideoLegacy$Outbound | ChatMessageContentItemVideo$Outbound;
|
|
21
26
|
/** @internal */
|
|
22
27
|
export declare const ChatMessageContentItem$outboundSchema: z.ZodType<ChatMessageContentItem$Outbound, ChatMessageContentItem>;
|
|
23
28
|
export declare function chatMessageContentItemToJSON(chatMessageContentItem: ChatMessageContentItem): string;
|
|
@@ -8,21 +8,42 @@ import { ChatMessageContentItemAudio$inboundSchema, ChatMessageContentItemAudio$
|
|
|
8
8
|
import { ChatMessageContentItemImage$inboundSchema, ChatMessageContentItemImage$outboundSchema, } from "./chatmessagecontentitemimage.js";
|
|
9
9
|
import { ChatMessageContentItemText$inboundSchema, ChatMessageContentItemText$outboundSchema, } from "./chatmessagecontentitemtext.js";
|
|
10
10
|
import { ChatMessageContentItemVideo$inboundSchema, ChatMessageContentItemVideo$outboundSchema, } from "./chatmessagecontentitemvideo.js";
|
|
11
|
+
import { ChatMessageContentItemVideoLegacy$inboundSchema, ChatMessageContentItemVideoLegacy$outboundSchema, } from "./chatmessagecontentitemvideolegacy.js";
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const ChatMessageContentItem1$inboundSchema = z.union([
|
|
14
|
+
ChatMessageContentItemVideoLegacy$inboundSchema,
|
|
15
|
+
ChatMessageContentItemVideo$inboundSchema,
|
|
16
|
+
]);
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const ChatMessageContentItem1$outboundSchema = z.union([
|
|
19
|
+
ChatMessageContentItemVideoLegacy$outboundSchema,
|
|
20
|
+
ChatMessageContentItemVideo$outboundSchema,
|
|
21
|
+
]);
|
|
22
|
+
export function chatMessageContentItem1ToJSON(chatMessageContentItem1) {
|
|
23
|
+
return JSON.stringify(ChatMessageContentItem1$outboundSchema.parse(chatMessageContentItem1));
|
|
24
|
+
}
|
|
25
|
+
export function chatMessageContentItem1FromJSON(jsonString) {
|
|
26
|
+
return safeParse(jsonString, (x) => ChatMessageContentItem1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItem1' from JSON`);
|
|
27
|
+
}
|
|
11
28
|
/** @internal */
|
|
12
29
|
export const ChatMessageContentItem$inboundSchema = z.union([
|
|
13
30
|
ChatMessageContentItemText$inboundSchema,
|
|
14
31
|
ChatMessageContentItemImage$inboundSchema,
|
|
15
32
|
ChatMessageContentItemAudio$inboundSchema,
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
z.union([
|
|
34
|
+
ChatMessageContentItemVideoLegacy$inboundSchema,
|
|
35
|
+
ChatMessageContentItemVideo$inboundSchema,
|
|
36
|
+
]),
|
|
18
37
|
]);
|
|
19
38
|
/** @internal */
|
|
20
39
|
export const ChatMessageContentItem$outboundSchema = z.union([
|
|
21
40
|
ChatMessageContentItemText$outboundSchema,
|
|
22
41
|
ChatMessageContentItemImage$outboundSchema,
|
|
23
42
|
ChatMessageContentItemAudio$outboundSchema,
|
|
24
|
-
|
|
25
|
-
|
|
43
|
+
z.union([
|
|
44
|
+
ChatMessageContentItemVideoLegacy$outboundSchema,
|
|
45
|
+
ChatMessageContentItemVideo$outboundSchema,
|
|
46
|
+
]),
|
|
26
47
|
]);
|
|
27
48
|
export function chatMessageContentItemToJSON(chatMessageContentItem) {
|
|
28
49
|
return JSON.stringify(ChatMessageContentItem$outboundSchema.parse(chatMessageContentItem));
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
2
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
3
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
+
export declare const ChatMessageContentItemAudioType: {
|
|
6
|
+
readonly InputAudio: "input_audio";
|
|
7
|
+
};
|
|
8
|
+
export type ChatMessageContentItemAudioType = ClosedEnum<typeof ChatMessageContentItemAudioType>;
|
|
4
9
|
export type ChatMessageContentItemAudioInputAudio = {
|
|
10
|
+
/**
|
|
11
|
+
* Base64 encoded audio data
|
|
12
|
+
*/
|
|
5
13
|
data: string;
|
|
14
|
+
/**
|
|
15
|
+
* Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider.
|
|
16
|
+
*/
|
|
6
17
|
format: string;
|
|
7
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Audio input content part. Supported audio formats vary by provider.
|
|
21
|
+
*/
|
|
8
22
|
export type ChatMessageContentItemAudio = {
|
|
9
|
-
type:
|
|
23
|
+
type: ChatMessageContentItemAudioType;
|
|
10
24
|
inputAudio: ChatMessageContentItemAudioInputAudio;
|
|
11
25
|
};
|
|
12
26
|
/** @internal */
|
|
27
|
+
export declare const ChatMessageContentItemAudioType$inboundSchema: z.ZodEnum<typeof ChatMessageContentItemAudioType>;
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const ChatMessageContentItemAudioType$outboundSchema: z.ZodEnum<typeof ChatMessageContentItemAudioType>;
|
|
30
|
+
/** @internal */
|
|
13
31
|
export declare const ChatMessageContentItemAudioInputAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown>;
|
|
14
32
|
/** @internal */
|
|
15
33
|
export type ChatMessageContentItemAudioInputAudio$Outbound = {
|
|
@@ -24,7 +42,7 @@ export declare function chatMessageContentItemAudioInputAudioFromJSON(jsonString
|
|
|
24
42
|
export declare const ChatMessageContentItemAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudio, unknown>;
|
|
25
43
|
/** @internal */
|
|
26
44
|
export type ChatMessageContentItemAudio$Outbound = {
|
|
27
|
-
type:
|
|
45
|
+
type: string;
|
|
28
46
|
input_audio: ChatMessageContentItemAudioInputAudio$Outbound;
|
|
29
47
|
};
|
|
30
48
|
/** @internal */
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
export const ChatMessageContentItemAudioType = {
|
|
9
|
+
InputAudio: "input_audio",
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const ChatMessageContentItemAudioType$inboundSchema = z.enum(ChatMessageContentItemAudioType);
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const ChatMessageContentItemAudioType$outboundSchema = ChatMessageContentItemAudioType$inboundSchema;
|
|
8
15
|
/** @internal */
|
|
9
16
|
export const ChatMessageContentItemAudioInputAudio$inboundSchema = z.object({
|
|
10
17
|
data: z.string(),
|
|
@@ -23,7 +30,7 @@ export function chatMessageContentItemAudioInputAudioFromJSON(jsonString) {
|
|
|
23
30
|
}
|
|
24
31
|
/** @internal */
|
|
25
32
|
export const ChatMessageContentItemAudio$inboundSchema = z.object({
|
|
26
|
-
type:
|
|
33
|
+
type: ChatMessageContentItemAudioType$inboundSchema,
|
|
27
34
|
input_audio: z.lazy(() => ChatMessageContentItemAudioInputAudio$inboundSchema),
|
|
28
35
|
}).transform((v) => {
|
|
29
36
|
return remap$(v, {
|
|
@@ -32,7 +39,7 @@ export const ChatMessageContentItemAudio$inboundSchema = z.object({
|
|
|
32
39
|
});
|
|
33
40
|
/** @internal */
|
|
34
41
|
export const ChatMessageContentItemAudio$outboundSchema = z.object({
|
|
35
|
-
type:
|
|
42
|
+
type: ChatMessageContentItemAudioType$outboundSchema,
|
|
36
43
|
inputAudio: z.lazy(() => ChatMessageContentItemAudioInputAudio$outboundSchema),
|
|
37
44
|
}).transform((v) => {
|
|
38
45
|
return remap$(v, {
|