@openrouter/sdk 0.2.6 → 0.2.9
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/esm/funcs/embeddingsGenerate.js +2 -4
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/response-wrapper.d.ts +12 -0
- package/esm/lib/response-wrapper.js +45 -15
- package/esm/lib/tool-orchestrator.js +33 -11
- package/esm/models/chatgenerationparams.d.ts +12 -0
- package/esm/models/chatgenerationparams.js +12 -0
- package/esm/models/chatmessagecontentitemaudio.d.ts +1 -16
- package/esm/models/chatmessagecontentitemaudio.js +2 -16
- package/esm/models/operations/createembeddings.d.ts +1 -5
- package/esm/models/operations/createembeddings.js +1 -9
- package/jsr.json +1 -1
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ async function $do(client, request, options) {
|
|
|
29
29
|
const path = pathToFunc("/embeddings")();
|
|
30
30
|
const headers = new Headers(compactMap({
|
|
31
31
|
"Content-Type": "application/json",
|
|
32
|
-
Accept: "application/json
|
|
32
|
+
Accept: "application/json",
|
|
33
33
|
}));
|
|
34
34
|
const secConfig = await extractSecurity(client._options.apiKey);
|
|
35
35
|
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
@@ -86,9 +86,7 @@ async function $do(client, request, options) {
|
|
|
86
86
|
const responseFields = {
|
|
87
87
|
HttpMeta: { Response: response, Request: req },
|
|
88
88
|
};
|
|
89
|
-
const [result] = await M.match(M.json(200, operations.CreateEmbeddingsResponse$inboundSchema), M.
|
|
90
|
-
ctype: "text/event-stream",
|
|
91
|
-
}), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
89
|
+
const [result] = await M.match(M.json(200, operations.CreateEmbeddingsResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
92
90
|
if (!result.ok) {
|
|
93
91
|
return [result, { status: "complete", request: req, response }];
|
|
94
92
|
}
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
45
45
|
export declare const SDK_METADATA: {
|
|
46
46
|
readonly language: "typescript";
|
|
47
47
|
readonly openapiDocVersion: "1.0.0";
|
|
48
|
-
readonly sdkVersion: "0.2.
|
|
48
|
+
readonly sdkVersion: "0.2.9";
|
|
49
49
|
readonly genVersion: "2.768.0";
|
|
50
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.2.
|
|
50
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.2.9 2.768.0 1.0.0 @openrouter/sdk";
|
|
51
51
|
};
|
|
52
52
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
|
|
|
25
25
|
export const SDK_METADATA = {
|
|
26
26
|
language: "typescript",
|
|
27
27
|
openapiDocVersion: "1.0.0",
|
|
28
|
-
sdkVersion: "0.2.
|
|
28
|
+
sdkVersion: "0.2.9",
|
|
29
29
|
genVersion: "2.768.0",
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.2.9 2.768.0 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
|
@@ -34,6 +34,10 @@ export declare class ResponseWrapper {
|
|
|
34
34
|
private preliminaryResults;
|
|
35
35
|
private allToolExecutionRounds;
|
|
36
36
|
constructor(options: GetResponseOptions);
|
|
37
|
+
/**
|
|
38
|
+
* Type guard to check if a value is a non-streaming response
|
|
39
|
+
*/
|
|
40
|
+
private isNonStreamingResponse;
|
|
37
41
|
/**
|
|
38
42
|
* Initialize the stream if not already started
|
|
39
43
|
* This is idempotent - multiple calls will return the same promise
|
|
@@ -44,6 +48,14 @@ export declare class ResponseWrapper {
|
|
|
44
48
|
* This is idempotent - multiple calls will return the same promise
|
|
45
49
|
*/
|
|
46
50
|
private executeToolsIfNeeded;
|
|
51
|
+
/**
|
|
52
|
+
* Internal helper to get the message after tool execution
|
|
53
|
+
*/
|
|
54
|
+
private getMessageInternal;
|
|
55
|
+
/**
|
|
56
|
+
* Internal helper to get the text after tool execution
|
|
57
|
+
*/
|
|
58
|
+
private getTextInternal;
|
|
47
59
|
/**
|
|
48
60
|
* Get the completed message from the response.
|
|
49
61
|
* This will consume the stream until completion, execute any tools, and extract the first message.
|
|
@@ -29,6 +29,17 @@ export class ResponseWrapper {
|
|
|
29
29
|
this.allToolExecutionRounds = [];
|
|
30
30
|
this.options = options;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Type guard to check if a value is a non-streaming response
|
|
34
|
+
*/
|
|
35
|
+
isNonStreamingResponse(value) {
|
|
36
|
+
return (value !== null &&
|
|
37
|
+
typeof value === "object" &&
|
|
38
|
+
"id" in value &&
|
|
39
|
+
"object" in value &&
|
|
40
|
+
"output" in value &&
|
|
41
|
+
!("toReadableStream" in value));
|
|
42
|
+
}
|
|
32
43
|
/**
|
|
33
44
|
* Initialize the stream if not already started
|
|
34
45
|
* This is idempotent - multiple calls will return the same promise
|
|
@@ -201,15 +212,46 @@ export class ResponseWrapper {
|
|
|
201
212
|
const stream = new ReusableReadableStream(value);
|
|
202
213
|
currentResponse = await consumeStreamForCompletion(stream);
|
|
203
214
|
}
|
|
204
|
-
else {
|
|
215
|
+
else if (this.isNonStreamingResponse(value)) {
|
|
205
216
|
currentResponse = value;
|
|
206
217
|
}
|
|
218
|
+
else {
|
|
219
|
+
throw new Error("Unexpected response type from API");
|
|
220
|
+
}
|
|
207
221
|
currentRound++;
|
|
208
222
|
}
|
|
223
|
+
// Validate the final response has required fields
|
|
224
|
+
if (!currentResponse || !currentResponse.id || !currentResponse.output) {
|
|
225
|
+
throw new Error("Invalid final response: missing required fields");
|
|
226
|
+
}
|
|
227
|
+
// Ensure the response is in a completed state (has output content)
|
|
228
|
+
if (!Array.isArray(currentResponse.output) || currentResponse.output.length === 0) {
|
|
229
|
+
throw new Error("Invalid final response: empty or invalid output");
|
|
230
|
+
}
|
|
209
231
|
this.finalResponse = currentResponse;
|
|
210
232
|
})();
|
|
211
233
|
return this.toolExecutionPromise;
|
|
212
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Internal helper to get the message after tool execution
|
|
237
|
+
*/
|
|
238
|
+
async getMessageInternal() {
|
|
239
|
+
await this.executeToolsIfNeeded();
|
|
240
|
+
if (!this.finalResponse) {
|
|
241
|
+
throw new Error("Response not available");
|
|
242
|
+
}
|
|
243
|
+
return extractMessageFromResponse(this.finalResponse);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Internal helper to get the text after tool execution
|
|
247
|
+
*/
|
|
248
|
+
async getTextInternal() {
|
|
249
|
+
await this.executeToolsIfNeeded();
|
|
250
|
+
if (!this.finalResponse) {
|
|
251
|
+
throw new Error("Response not available");
|
|
252
|
+
}
|
|
253
|
+
return extractTextFromResponse(this.finalResponse);
|
|
254
|
+
}
|
|
213
255
|
/**
|
|
214
256
|
* Get the completed message from the response.
|
|
215
257
|
* This will consume the stream until completion, execute any tools, and extract the first message.
|
|
@@ -219,13 +261,7 @@ export class ResponseWrapper {
|
|
|
219
261
|
if (this.messagePromise) {
|
|
220
262
|
return this.messagePromise;
|
|
221
263
|
}
|
|
222
|
-
this.messagePromise = (
|
|
223
|
-
await this.executeToolsIfNeeded();
|
|
224
|
-
if (!this.finalResponse) {
|
|
225
|
-
throw new Error('Response not available');
|
|
226
|
-
}
|
|
227
|
-
return extractMessageFromResponse(this.finalResponse);
|
|
228
|
-
})();
|
|
264
|
+
this.messagePromise = this.getMessageInternal();
|
|
229
265
|
return this.messagePromise;
|
|
230
266
|
}
|
|
231
267
|
/**
|
|
@@ -236,13 +272,7 @@ export class ResponseWrapper {
|
|
|
236
272
|
if (this.textPromise) {
|
|
237
273
|
return this.textPromise;
|
|
238
274
|
}
|
|
239
|
-
this.textPromise = (
|
|
240
|
-
await this.executeToolsIfNeeded();
|
|
241
|
-
if (!this.finalResponse) {
|
|
242
|
-
throw new Error('Response not available');
|
|
243
|
-
}
|
|
244
|
-
return extractTextFromResponse(this.finalResponse);
|
|
245
|
-
})();
|
|
275
|
+
this.textPromise = this.getTextInternal();
|
|
246
276
|
return this.textPromise;
|
|
247
277
|
}
|
|
248
278
|
/**
|
|
@@ -40,23 +40,21 @@ export async function executeToolLoop(sendRequest, initialInput, tools, apiTools
|
|
|
40
40
|
if (!hasExecutableTools) {
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
|
-
// Execute all tool calls
|
|
44
|
-
const
|
|
45
|
-
for (const toolCall of toolCalls) {
|
|
43
|
+
// Execute all tool calls in parallel (parallel tool calling)
|
|
44
|
+
const toolCallPromises = toolCalls.map(async (toolCall) => {
|
|
46
45
|
const tool = findToolByName(tools, toolCall.name);
|
|
47
46
|
if (!tool) {
|
|
48
47
|
// Tool not found in definitions
|
|
49
|
-
|
|
48
|
+
return {
|
|
50
49
|
toolCallId: toolCall.id,
|
|
51
50
|
toolName: toolCall.name,
|
|
52
51
|
result: null,
|
|
53
52
|
error: new Error(`Tool "${toolCall.name}" not found in tool definitions`),
|
|
54
|
-
}
|
|
55
|
-
continue;
|
|
53
|
+
};
|
|
56
54
|
}
|
|
57
55
|
if (!hasExecuteFunction(tool)) {
|
|
58
|
-
// Tool has no execute function -
|
|
59
|
-
|
|
56
|
+
// Tool has no execute function - return null to filter out
|
|
57
|
+
return null;
|
|
60
58
|
}
|
|
61
59
|
// Build turn context
|
|
62
60
|
const turnContext = {
|
|
@@ -64,9 +62,33 @@ export async function executeToolLoop(sendRequest, initialInput, tools, apiTools
|
|
|
64
62
|
messageHistory: conversationInput,
|
|
65
63
|
};
|
|
66
64
|
// Execute the tool
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
return executeTool(tool, toolCall, turnContext, onPreliminaryResult);
|
|
66
|
+
});
|
|
67
|
+
// Wait for all tool executions to complete in parallel
|
|
68
|
+
const settledResults = await Promise.allSettled(toolCallPromises);
|
|
69
|
+
// Process settled results, handling both fulfilled and rejected promises
|
|
70
|
+
const roundResults = [];
|
|
71
|
+
settledResults.forEach((settled, i) => {
|
|
72
|
+
const toolCall = toolCalls[i];
|
|
73
|
+
if (!toolCall)
|
|
74
|
+
return;
|
|
75
|
+
if (settled.status === "fulfilled") {
|
|
76
|
+
if (settled.value !== null) {
|
|
77
|
+
roundResults.push(settled.value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// Promise rejected - create error result
|
|
82
|
+
roundResults.push({
|
|
83
|
+
toolCallId: toolCall.id,
|
|
84
|
+
toolName: toolCall.name,
|
|
85
|
+
result: null,
|
|
86
|
+
error: settled.reason instanceof Error
|
|
87
|
+
? settled.reason
|
|
88
|
+
: new Error(String(settled.reason)),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
70
92
|
toolExecutionResults.push(...roundResults);
|
|
71
93
|
// Build array input with all output from previous response plus tool results
|
|
72
94
|
// The API expects continuation via previousResponseId, not by including outputs
|
|
@@ -29,6 +29,9 @@ export type ChatGenerationParamsResponseFormatText = {
|
|
|
29
29
|
};
|
|
30
30
|
export type ChatGenerationParamsResponseFormatUnion = ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatPython;
|
|
31
31
|
export type ChatGenerationParamsStop = string | Array<string>;
|
|
32
|
+
export type Debug = {
|
|
33
|
+
echoUpstreamBody?: boolean | undefined;
|
|
34
|
+
};
|
|
32
35
|
export type ChatGenerationParams = {
|
|
33
36
|
messages: Array<Message>;
|
|
34
37
|
model?: string | undefined;
|
|
@@ -56,6 +59,7 @@ export type ChatGenerationParams = {
|
|
|
56
59
|
tools?: Array<ToolDefinitionJson> | undefined;
|
|
57
60
|
topP?: number | null | undefined;
|
|
58
61
|
user?: string | undefined;
|
|
62
|
+
debug?: Debug | undefined;
|
|
59
63
|
};
|
|
60
64
|
/** @internal */
|
|
61
65
|
export declare const Effort$outboundSchema: z.ZodType<string, Effort>;
|
|
@@ -99,6 +103,13 @@ export type ChatGenerationParamsStop$Outbound = string | Array<string>;
|
|
|
99
103
|
export declare const ChatGenerationParamsStop$outboundSchema: z.ZodType<ChatGenerationParamsStop$Outbound, ChatGenerationParamsStop>;
|
|
100
104
|
export declare function chatGenerationParamsStopToJSON(chatGenerationParamsStop: ChatGenerationParamsStop): string;
|
|
101
105
|
/** @internal */
|
|
106
|
+
export type Debug$Outbound = {
|
|
107
|
+
echo_upstream_body?: boolean | undefined;
|
|
108
|
+
};
|
|
109
|
+
/** @internal */
|
|
110
|
+
export declare const Debug$outboundSchema: z.ZodType<Debug$Outbound, Debug>;
|
|
111
|
+
export declare function debugToJSON(debug: Debug): string;
|
|
112
|
+
/** @internal */
|
|
102
113
|
export type ChatGenerationParams$Outbound = {
|
|
103
114
|
messages: Array<Message$Outbound>;
|
|
104
115
|
model?: string | undefined;
|
|
@@ -126,6 +137,7 @@ export type ChatGenerationParams$Outbound = {
|
|
|
126
137
|
tools?: Array<ToolDefinitionJson$Outbound> | undefined;
|
|
127
138
|
top_p?: number | null | undefined;
|
|
128
139
|
user?: string | undefined;
|
|
140
|
+
debug?: Debug$Outbound | undefined;
|
|
129
141
|
};
|
|
130
142
|
/** @internal */
|
|
131
143
|
export declare const ChatGenerationParams$outboundSchema: z.ZodType<ChatGenerationParams$Outbound, ChatGenerationParams>;
|
|
@@ -66,6 +66,17 @@ export function chatGenerationParamsStopToJSON(chatGenerationParamsStop) {
|
|
|
66
66
|
return JSON.stringify(ChatGenerationParamsStop$outboundSchema.parse(chatGenerationParamsStop));
|
|
67
67
|
}
|
|
68
68
|
/** @internal */
|
|
69
|
+
export const Debug$outboundSchema = z.object({
|
|
70
|
+
echoUpstreamBody: z.boolean().optional(),
|
|
71
|
+
}).transform((v) => {
|
|
72
|
+
return remap$(v, {
|
|
73
|
+
echoUpstreamBody: "echo_upstream_body",
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
export function debugToJSON(debug) {
|
|
77
|
+
return JSON.stringify(Debug$outboundSchema.parse(debug));
|
|
78
|
+
}
|
|
79
|
+
/** @internal */
|
|
69
80
|
export const ChatGenerationParams$outboundSchema = z.object({
|
|
70
81
|
messages: z.array(Message$outboundSchema),
|
|
71
82
|
model: z.string().optional(),
|
|
@@ -95,6 +106,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
95
106
|
tools: z.array(ToolDefinitionJson$outboundSchema).optional(),
|
|
96
107
|
topP: z.nullable(z.number()).optional(),
|
|
97
108
|
user: z.string().optional(),
|
|
109
|
+
debug: z.lazy(() => Debug$outboundSchema).optional(),
|
|
98
110
|
}).transform((v) => {
|
|
99
111
|
return remap$(v, {
|
|
100
112
|
frequencyPenalty: "frequency_penalty",
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
|
-
import { OpenEnum } from "../types/enums.js";
|
|
3
2
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
|
-
export declare const ChatMessageContentItemAudioFormat: {
|
|
6
|
-
readonly Wav: "wav";
|
|
7
|
-
readonly Mp3: "mp3";
|
|
8
|
-
readonly Flac: "flac";
|
|
9
|
-
readonly M4a: "m4a";
|
|
10
|
-
readonly Ogg: "ogg";
|
|
11
|
-
readonly Pcm16: "pcm16";
|
|
12
|
-
readonly Pcm24: "pcm24";
|
|
13
|
-
};
|
|
14
|
-
export type ChatMessageContentItemAudioFormat = OpenEnum<typeof ChatMessageContentItemAudioFormat>;
|
|
15
4
|
export type ChatMessageContentItemAudioInputAudio = {
|
|
16
5
|
data: string;
|
|
17
|
-
format:
|
|
6
|
+
format: string;
|
|
18
7
|
};
|
|
19
8
|
export type ChatMessageContentItemAudio = {
|
|
20
9
|
type: "input_audio";
|
|
21
10
|
inputAudio: ChatMessageContentItemAudioInputAudio;
|
|
22
11
|
};
|
|
23
12
|
/** @internal */
|
|
24
|
-
export declare const ChatMessageContentItemAudioFormat$inboundSchema: z.ZodType<ChatMessageContentItemAudioFormat, unknown>;
|
|
25
|
-
/** @internal */
|
|
26
|
-
export declare const ChatMessageContentItemAudioFormat$outboundSchema: z.ZodType<string, ChatMessageContentItemAudioFormat>;
|
|
27
|
-
/** @internal */
|
|
28
13
|
export declare const ChatMessageContentItemAudioInputAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown>;
|
|
29
14
|
/** @internal */
|
|
30
15
|
export type ChatMessageContentItemAudioInputAudio$Outbound = {
|
|
@@ -4,29 +4,15 @@
|
|
|
4
4
|
import * as z from "zod/v4";
|
|
5
5
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
|
-
import * as openEnums from "../types/enums.js";
|
|
8
|
-
export const ChatMessageContentItemAudioFormat = {
|
|
9
|
-
Wav: "wav",
|
|
10
|
-
Mp3: "mp3",
|
|
11
|
-
Flac: "flac",
|
|
12
|
-
M4a: "m4a",
|
|
13
|
-
Ogg: "ogg",
|
|
14
|
-
Pcm16: "pcm16",
|
|
15
|
-
Pcm24: "pcm24",
|
|
16
|
-
};
|
|
17
|
-
/** @internal */
|
|
18
|
-
export const ChatMessageContentItemAudioFormat$inboundSchema = openEnums.inboundSchema(ChatMessageContentItemAudioFormat);
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const ChatMessageContentItemAudioFormat$outboundSchema = openEnums.outboundSchema(ChatMessageContentItemAudioFormat);
|
|
21
7
|
/** @internal */
|
|
22
8
|
export const ChatMessageContentItemAudioInputAudio$inboundSchema = z.object({
|
|
23
9
|
data: z.string(),
|
|
24
|
-
format:
|
|
10
|
+
format: z.string(),
|
|
25
11
|
});
|
|
26
12
|
/** @internal */
|
|
27
13
|
export const ChatMessageContentItemAudioInputAudio$outboundSchema = z.object({
|
|
28
14
|
data: z.string(),
|
|
29
|
-
format:
|
|
15
|
+
format: z.string(),
|
|
30
16
|
});
|
|
31
17
|
export function chatMessageContentItemAudioInputAudioToJSON(chatMessageContentItemAudioInputAudio) {
|
|
32
18
|
return JSON.stringify(ChatMessageContentItemAudioInputAudio$outboundSchema.parse(chatMessageContentItemAudioInputAudio));
|
|
@@ -138,14 +138,13 @@ export type Usage = {
|
|
|
138
138
|
/**
|
|
139
139
|
* Embedding response
|
|
140
140
|
*/
|
|
141
|
-
export type
|
|
141
|
+
export type CreateEmbeddingsResponse = {
|
|
142
142
|
id?: string | undefined;
|
|
143
143
|
object: ObjectT;
|
|
144
144
|
data: Array<CreateEmbeddingsData>;
|
|
145
145
|
model: string;
|
|
146
146
|
usage?: Usage | undefined;
|
|
147
147
|
};
|
|
148
|
-
export type CreateEmbeddingsResponse = CreateEmbeddingsResponseBody | string;
|
|
149
148
|
/** @internal */
|
|
150
149
|
export type ImageUrl$Outbound = {
|
|
151
150
|
url: string;
|
|
@@ -258,9 +257,6 @@ export declare function createEmbeddingsDataFromJSON(jsonString: string): SafePa
|
|
|
258
257
|
export declare const Usage$inboundSchema: z.ZodType<Usage, unknown>;
|
|
259
258
|
export declare function usageFromJSON(jsonString: string): SafeParseResult<Usage, SDKValidationError>;
|
|
260
259
|
/** @internal */
|
|
261
|
-
export declare const CreateEmbeddingsResponseBody$inboundSchema: z.ZodType<CreateEmbeddingsResponseBody, unknown>;
|
|
262
|
-
export declare function createEmbeddingsResponseBodyFromJSON(jsonString: string): SafeParseResult<CreateEmbeddingsResponseBody, SDKValidationError>;
|
|
263
|
-
/** @internal */
|
|
264
260
|
export declare const CreateEmbeddingsResponse$inboundSchema: z.ZodType<CreateEmbeddingsResponse, unknown>;
|
|
265
261
|
export declare function createEmbeddingsResponseFromJSON(jsonString: string): SafeParseResult<CreateEmbeddingsResponse, SDKValidationError>;
|
|
266
262
|
//# sourceMappingURL=createembeddings.d.ts.map
|
|
@@ -196,21 +196,13 @@ export function usageFromJSON(jsonString) {
|
|
|
196
196
|
return safeParse(jsonString, (x) => Usage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Usage' from JSON`);
|
|
197
197
|
}
|
|
198
198
|
/** @internal */
|
|
199
|
-
export const
|
|
199
|
+
export const CreateEmbeddingsResponse$inboundSchema = z.object({
|
|
200
200
|
id: z.string().optional(),
|
|
201
201
|
object: ObjectT$inboundSchema,
|
|
202
202
|
data: z.array(z.lazy(() => CreateEmbeddingsData$inboundSchema)),
|
|
203
203
|
model: z.string(),
|
|
204
204
|
usage: z.lazy(() => Usage$inboundSchema).optional(),
|
|
205
205
|
});
|
|
206
|
-
export function createEmbeddingsResponseBodyFromJSON(jsonString) {
|
|
207
|
-
return safeParse(jsonString, (x) => CreateEmbeddingsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateEmbeddingsResponseBody' from JSON`);
|
|
208
|
-
}
|
|
209
|
-
/** @internal */
|
|
210
|
-
export const CreateEmbeddingsResponse$inboundSchema = z.union([
|
|
211
|
-
z.lazy(() => CreateEmbeddingsResponseBody$inboundSchema),
|
|
212
|
-
z.string(),
|
|
213
|
-
]);
|
|
214
206
|
export function createEmbeddingsResponseFromJSON(jsonString) {
|
|
215
207
|
return safeParse(jsonString, (x) => CreateEmbeddingsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateEmbeddingsResponse' from JSON`);
|
|
216
208
|
}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrouter/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"author": "OpenRouter",
|
|
5
5
|
"description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 300+ language models through a unified API.",
|
|
6
6
|
"keywords": [
|