@openrouter/sdk 0.0.1-beta.10 → 0.0.1-beta.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/esm/funcs/chatSend.d.ts +7 -0
- package/esm/funcs/chatSend.js +1 -7
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/chatgenerationparams.d.ts +2 -2
- package/esm/models/chatgenerationparams.js +2 -2
- package/esm/models/completioncreateparams.d.ts +2 -2
- package/esm/models/completioncreateparams.js +2 -2
- package/esm/sdk/chat.d.ts +7 -0
- package/esm/sdk/chat.js +0 -6
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/vitest.config.ts +11 -0
package/esm/funcs/chatSend.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
2
3
|
import { RequestOptions } from "../lib/sdks.js";
|
|
3
4
|
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
5
|
import * as errors from "../models/errors/index.js";
|
|
@@ -15,5 +16,11 @@ import { Result } from "../types/fp.js";
|
|
|
15
16
|
* @remarks
|
|
16
17
|
* Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
17
18
|
*/
|
|
19
|
+
export declare function chatSend(client: OpenRouterCore, request: models.ChatGenerationParams & {
|
|
20
|
+
stream?: false;
|
|
21
|
+
}, options?: RequestOptions): APIPromise<Result<models.ChatResponse, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
22
|
+
export declare function chatSend(client: OpenRouterCore, request: models.ChatGenerationParams & {
|
|
23
|
+
stream: true;
|
|
24
|
+
}, options?: RequestOptions): APIPromise<Result<EventStream<models.ChatStreamingResponseChunk>, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
18
25
|
export declare function chatSend(client: OpenRouterCore, request: models.ChatGenerationParams, options?: RequestOptions): APIPromise<Result<operations.SendChatCompletionRequestResponse, errors.ChatError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
26
|
//# sourceMappingURL=chatSend.d.ts.map
|
package/esm/funcs/chatSend.js
CHANGED
|
@@ -11,12 +11,6 @@ import * as errors from "../models/errors/index.js";
|
|
|
11
11
|
import * as models from "../models/index.js";
|
|
12
12
|
import * as operations from "../models/operations/index.js";
|
|
13
13
|
import { APIPromise } from "../types/async.js";
|
|
14
|
-
/**
|
|
15
|
-
* Create a chat completion
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
19
|
-
*/
|
|
20
14
|
export function chatSend(client, request, options) {
|
|
21
15
|
return new APIPromise($do(client, request, options));
|
|
22
16
|
}
|
|
@@ -30,7 +24,7 @@ async function $do(client, request, options) {
|
|
|
30
24
|
const path = pathToFunc("/chat/completions")();
|
|
31
25
|
const headers = new Headers(compactMap({
|
|
32
26
|
"Content-Type": "application/json",
|
|
33
|
-
Accept: "
|
|
27
|
+
Accept: request?.stream ? "text/event-stream" : "application/json",
|
|
34
28
|
}));
|
|
35
29
|
const secConfig = await extractSecurity(client._options.apiKey);
|
|
36
30
|
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
37
37
|
export declare const SDK_METADATA: {
|
|
38
38
|
readonly language: "typescript";
|
|
39
39
|
readonly openapiDocVersion: "1.0.0";
|
|
40
|
-
readonly sdkVersion: "0.0.1-beta.
|
|
41
|
-
readonly genVersion: "2.
|
|
42
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.0.1-beta.
|
|
40
|
+
readonly sdkVersion: "0.0.1-beta.11";
|
|
41
|
+
readonly genVersion: "2.731.4";
|
|
42
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.0.1-beta.11 2.731.4 1.0.0 @openrouter/sdk";
|
|
43
43
|
};
|
|
44
44
|
//# 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.0.1-beta.
|
|
29
|
-
genVersion: "2.
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.0.1-beta.
|
|
28
|
+
sdkVersion: "0.0.1-beta.11",
|
|
29
|
+
genVersion: "2.731.4",
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.0.1-beta.11 2.731.4 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
|
@@ -49,7 +49,7 @@ export type ChatGenerationParams = {
|
|
|
49
49
|
responseFormat?: ResponseFormatJSONSchema | ResponseFormatTextGrammar | ChatGenerationParamsResponseFormatText | ChatGenerationParamsResponseFormatJSONObject | ChatGenerationParamsResponseFormatPython | undefined;
|
|
50
50
|
seed?: number | null | undefined;
|
|
51
51
|
stop?: string | Array<string> | null | undefined;
|
|
52
|
-
stream?: boolean |
|
|
52
|
+
stream?: boolean | undefined;
|
|
53
53
|
streamOptions?: ChatStreamOptions | null | undefined;
|
|
54
54
|
temperature?: number | null | undefined;
|
|
55
55
|
toolChoice?: any | undefined;
|
|
@@ -222,7 +222,7 @@ export type ChatGenerationParams$Outbound = {
|
|
|
222
222
|
response_format?: ResponseFormatJSONSchema$Outbound | ResponseFormatTextGrammar$Outbound | ChatGenerationParamsResponseFormatText$Outbound | ChatGenerationParamsResponseFormatJSONObject$Outbound | ChatGenerationParamsResponseFormatPython$Outbound | undefined;
|
|
223
223
|
seed?: number | null | undefined;
|
|
224
224
|
stop?: string | Array<string> | null | undefined;
|
|
225
|
-
stream
|
|
225
|
+
stream: boolean;
|
|
226
226
|
stream_options?: ChatStreamOptions$Outbound | null | undefined;
|
|
227
227
|
temperature?: number | null | undefined;
|
|
228
228
|
tool_choice?: any | undefined;
|
|
@@ -217,7 +217,7 @@ export const ChatGenerationParams$inboundSchema = z.object({
|
|
|
217
217
|
]).optional(),
|
|
218
218
|
seed: z.nullable(z.number().int()).optional(),
|
|
219
219
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
220
|
-
stream: z.
|
|
220
|
+
stream: z.boolean().default(false),
|
|
221
221
|
stream_options: z.nullable(ChatStreamOptions$inboundSchema).optional(),
|
|
222
222
|
temperature: z.nullable(z.number()).optional(),
|
|
223
223
|
tool_choice: z.any().optional(),
|
|
@@ -260,7 +260,7 @@ export const ChatGenerationParams$outboundSchema = z.object({
|
|
|
260
260
|
]).optional(),
|
|
261
261
|
seed: z.nullable(z.number().int()).optional(),
|
|
262
262
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
263
|
-
stream: z.
|
|
263
|
+
stream: z.boolean().default(false),
|
|
264
264
|
streamOptions: z.nullable(ChatStreamOptions$outboundSchema).optional(),
|
|
265
265
|
temperature: z.nullable(z.number()).optional(),
|
|
266
266
|
toolChoice: z.any().optional(),
|
|
@@ -33,7 +33,7 @@ export type CompletionCreateParams = {
|
|
|
33
33
|
presencePenalty?: number | null | undefined;
|
|
34
34
|
seed?: number | null | undefined;
|
|
35
35
|
stop?: string | Array<string> | null | undefined;
|
|
36
|
-
stream?: boolean |
|
|
36
|
+
stream?: boolean | undefined;
|
|
37
37
|
streamOptions?: StreamOptions | null | undefined;
|
|
38
38
|
suffix?: string | null | undefined;
|
|
39
39
|
temperature?: number | null | undefined;
|
|
@@ -210,7 +210,7 @@ export type CompletionCreateParams$Outbound = {
|
|
|
210
210
|
presence_penalty?: number | null | undefined;
|
|
211
211
|
seed?: number | null | undefined;
|
|
212
212
|
stop?: string | Array<string> | null | undefined;
|
|
213
|
-
stream
|
|
213
|
+
stream: boolean;
|
|
214
214
|
stream_options?: StreamOptions$Outbound | null | undefined;
|
|
215
215
|
suffix?: string | null | undefined;
|
|
216
216
|
temperature?: number | null | undefined;
|
|
@@ -220,7 +220,7 @@ export const CompletionCreateParams$inboundSchema = z.object({
|
|
|
220
220
|
presence_penalty: z.nullable(z.number()).optional(),
|
|
221
221
|
seed: z.nullable(z.number().int()).optional(),
|
|
222
222
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
223
|
-
stream: z.
|
|
223
|
+
stream: z.boolean().default(false),
|
|
224
224
|
stream_options: z.nullable(z.lazy(() => StreamOptions$inboundSchema))
|
|
225
225
|
.optional(),
|
|
226
226
|
suffix: z.nullable(z.string()).optional(),
|
|
@@ -266,7 +266,7 @@ export const CompletionCreateParams$outboundSchema = z.object({
|
|
|
266
266
|
presencePenalty: z.nullable(z.number()).optional(),
|
|
267
267
|
seed: z.nullable(z.number().int()).optional(),
|
|
268
268
|
stop: z.nullable(z.union([z.string(), z.array(z.string())])).optional(),
|
|
269
|
-
stream: z.
|
|
269
|
+
stream: z.boolean().default(false),
|
|
270
270
|
streamOptions: z.nullable(z.lazy(() => StreamOptions$outboundSchema))
|
|
271
271
|
.optional(),
|
|
272
272
|
suffix: z.nullable(z.string()).optional(),
|
package/esm/sdk/chat.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventStream } from "../lib/event-streams.js";
|
|
1
2
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
3
|
import * as models from "../models/index.js";
|
|
3
4
|
import * as operations from "../models/operations/index.js";
|
|
@@ -8,6 +9,12 @@ export declare class Chat extends ClientSDK {
|
|
|
8
9
|
* @remarks
|
|
9
10
|
* Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
10
11
|
*/
|
|
12
|
+
send(request: models.ChatGenerationParams & {
|
|
13
|
+
stream?: false | undefined;
|
|
14
|
+
}, options?: RequestOptions): Promise<models.ChatResponse>;
|
|
15
|
+
send(request: models.ChatGenerationParams & {
|
|
16
|
+
stream: true;
|
|
17
|
+
}, options?: RequestOptions): Promise<EventStream<models.ChatStreamingResponseChunk>>;
|
|
11
18
|
send(request: models.ChatGenerationParams, options?: RequestOptions): Promise<operations.SendChatCompletionRequestResponse>;
|
|
12
19
|
}
|
|
13
20
|
//# sourceMappingURL=chat.d.ts.map
|
package/esm/sdk/chat.js
CHANGED
|
@@ -5,12 +5,6 @@ import { chatSend } from "../funcs/chatSend.js";
|
|
|
5
5
|
import { ClientSDK } from "../lib/sdks.js";
|
|
6
6
|
import { unwrapAsync } from "../types/fp.js";
|
|
7
7
|
export class Chat extends ClientSDK {
|
|
8
|
-
/**
|
|
9
|
-
* Create a chat completion
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
|
|
13
|
-
*/
|
|
14
8
|
async send(request, options) {
|
|
15
9
|
return unwrapAsync(chatSend(this, request, options));
|
|
16
10
|
}
|
package/jsr.json
CHANGED
package/package.json
CHANGED