@rouvanpm/rouva 0.2.1 → 0.2.2
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/dist/index.d.mts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8,12 +8,12 @@ interface Message {
|
|
|
8
8
|
role: 'system' | 'user' | 'assistant';
|
|
9
9
|
content: string;
|
|
10
10
|
}
|
|
11
|
-
type RouvaProvider = 'anthropic' | 'openai' | 'gemini' | 'deepseek' | 'mistral' | (string & {});
|
|
11
|
+
type RouvaProvider = 'anthropic' | 'openai' | 'gemini' | 'deepseek' | 'mistral' | 'moonshot' | 'xai' | 'zai' | (string & {});
|
|
12
12
|
/**
|
|
13
13
|
* Supported models across all providers.
|
|
14
14
|
* Omit `model` entirely to let Rouva route to the cheapest capable model automatically.
|
|
15
15
|
*/
|
|
16
|
-
type RouvaModel = 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-haiku-4-5-20251001' | 'claude-fable-5' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.
|
|
16
|
+
type RouvaModel = 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-sonnet-5' | 'claude-haiku-4-5-20251001' | 'claude-fable-5' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.6' | 'gpt-4.1-nano' | 'gpt-4.1-mini' | 'gpt-4.1' | 'gpt-4o' | 'gpt-4o-mini' | 'gemini-2.5-flash' | 'gemini-2.5-pro' | 'deepseek-v4-flash' | 'deepseek-v4-flash-think' | 'deepseek-v4-pro' | 'mistral-small-latest' | 'mistral-large-latest' | 'kimi-k2.6' | 'grok-4.3' | 'grok-4.20-0309-reasoning' | 'grok-4.5' | 'glm-4.7-flash' | 'glm-5.2' | (string & {});
|
|
17
17
|
/** Anthropic-style text block — the array form of the `system` param */
|
|
18
18
|
interface SystemTextBlock {
|
|
19
19
|
type: 'text';
|
|
@@ -40,9 +40,17 @@ interface ChatCompletionParams {
|
|
|
40
40
|
provider?: RouvaProvider;
|
|
41
41
|
/** Maximum tokens to generate */
|
|
42
42
|
max_tokens?: number;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Sampling temperature 0–1.
|
|
45
|
+
* Note: reasoning models (gpt-5 family) only support their default
|
|
46
|
+
* temperature, so the gateway omits it for those.
|
|
47
|
+
*/
|
|
44
48
|
temperature?: number;
|
|
45
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Stream the response. Client-side only — controls whether `create()`
|
|
51
|
+
* returns a ReadableStream or a buffered ChatCompletion; never sent to
|
|
52
|
+
* the gateway.
|
|
53
|
+
*/
|
|
46
54
|
stream?: boolean;
|
|
47
55
|
}
|
|
48
56
|
interface ChatCompletionChoice {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ interface Message {
|
|
|
8
8
|
role: 'system' | 'user' | 'assistant';
|
|
9
9
|
content: string;
|
|
10
10
|
}
|
|
11
|
-
type RouvaProvider = 'anthropic' | 'openai' | 'gemini' | 'deepseek' | 'mistral' | (string & {});
|
|
11
|
+
type RouvaProvider = 'anthropic' | 'openai' | 'gemini' | 'deepseek' | 'mistral' | 'moonshot' | 'xai' | 'zai' | (string & {});
|
|
12
12
|
/**
|
|
13
13
|
* Supported models across all providers.
|
|
14
14
|
* Omit `model` entirely to let Rouva route to the cheapest capable model automatically.
|
|
15
15
|
*/
|
|
16
|
-
type RouvaModel = 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-haiku-4-5-20251001' | 'claude-fable-5' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.
|
|
16
|
+
type RouvaModel = 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-sonnet-5' | 'claude-haiku-4-5-20251001' | 'claude-fable-5' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.6' | 'gpt-4.1-nano' | 'gpt-4.1-mini' | 'gpt-4.1' | 'gpt-4o' | 'gpt-4o-mini' | 'gemini-2.5-flash' | 'gemini-2.5-pro' | 'deepseek-v4-flash' | 'deepseek-v4-flash-think' | 'deepseek-v4-pro' | 'mistral-small-latest' | 'mistral-large-latest' | 'kimi-k2.6' | 'grok-4.3' | 'grok-4.20-0309-reasoning' | 'grok-4.5' | 'glm-4.7-flash' | 'glm-5.2' | (string & {});
|
|
17
17
|
/** Anthropic-style text block — the array form of the `system` param */
|
|
18
18
|
interface SystemTextBlock {
|
|
19
19
|
type: 'text';
|
|
@@ -40,9 +40,17 @@ interface ChatCompletionParams {
|
|
|
40
40
|
provider?: RouvaProvider;
|
|
41
41
|
/** Maximum tokens to generate */
|
|
42
42
|
max_tokens?: number;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Sampling temperature 0–1.
|
|
45
|
+
* Note: reasoning models (gpt-5 family) only support their default
|
|
46
|
+
* temperature, so the gateway omits it for those.
|
|
47
|
+
*/
|
|
44
48
|
temperature?: number;
|
|
45
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Stream the response. Client-side only — controls whether `create()`
|
|
51
|
+
* returns a ReadableStream or a buffered ChatCompletion; never sent to
|
|
52
|
+
* the gateway.
|
|
53
|
+
*/
|
|
46
54
|
stream?: boolean;
|
|
47
55
|
}
|
|
48
56
|
interface ChatCompletionChoice {
|
package/dist/index.js
CHANGED
|
@@ -309,17 +309,18 @@ var Rouva = class {
|
|
|
309
309
|
}
|
|
310
310
|
async _createChatCompletion(params) {
|
|
311
311
|
const url = `${this.baseURL}/api/gateway/messages`;
|
|
312
|
+
const { stream: _stream, ...body } = params;
|
|
312
313
|
const res = await fetch(url, {
|
|
313
314
|
method: "POST",
|
|
314
315
|
headers: {
|
|
315
316
|
"Content-Type": "application/json",
|
|
316
317
|
"Authorization": `Bearer ${this.apiKey}`
|
|
317
318
|
},
|
|
318
|
-
body: JSON.stringify(
|
|
319
|
+
body: JSON.stringify(body)
|
|
319
320
|
});
|
|
320
321
|
if (!res.ok) {
|
|
321
|
-
const
|
|
322
|
-
throw new Error(`[Rouva] Gateway error ${res.status}: ${
|
|
322
|
+
const body2 = await res.text().catch(() => res.statusText);
|
|
323
|
+
throw new Error(`[Rouva] Gateway error ${res.status}: ${body2}`);
|
|
323
324
|
}
|
|
324
325
|
if (!res.body) throw new Error("[Rouva] No response body from gateway");
|
|
325
326
|
const normalizedStream = normalizeGatewayStream(res.body);
|
package/dist/index.mjs
CHANGED
|
@@ -283,17 +283,18 @@ var Rouva = class {
|
|
|
283
283
|
}
|
|
284
284
|
async _createChatCompletion(params) {
|
|
285
285
|
const url = `${this.baseURL}/api/gateway/messages`;
|
|
286
|
+
const { stream: _stream, ...body } = params;
|
|
286
287
|
const res = await fetch(url, {
|
|
287
288
|
method: "POST",
|
|
288
289
|
headers: {
|
|
289
290
|
"Content-Type": "application/json",
|
|
290
291
|
"Authorization": `Bearer ${this.apiKey}`
|
|
291
292
|
},
|
|
292
|
-
body: JSON.stringify(
|
|
293
|
+
body: JSON.stringify(body)
|
|
293
294
|
});
|
|
294
295
|
if (!res.ok) {
|
|
295
|
-
const
|
|
296
|
-
throw new Error(`[Rouva] Gateway error ${res.status}: ${
|
|
296
|
+
const body2 = await res.text().catch(() => res.statusText);
|
|
297
|
+
throw new Error(`[Rouva] Gateway error ${res.status}: ${body2}`);
|
|
297
298
|
}
|
|
298
299
|
if (!res.body) throw new Error("[Rouva] No response body from gateway");
|
|
299
300
|
const normalizedStream = normalizeGatewayStream(res.body);
|
package/package.json
CHANGED