@combycode/llm-sdk 1.6.1 → 1.7.0
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/CHANGELOG.md +88 -0
- package/dist/bus/hook-map.d.ts +11 -0
- package/dist/index.browser.js +177 -63
- package/dist/index.js +177 -63
- package/dist/llm/moderation/native.d.ts +5 -4
- package/dist/llm/providers/google/constants.d.ts +17 -2
- package/dist/llm/providers/openai/completions.d.ts +9 -2
- package/dist/llm/providers/xai/completions.d.ts +2 -2
- package/dist/llm/providers/xai/media.d.ts +8 -0
- package/dist/llm/types/request.d.ts +8 -0
- package/dist/llm/types/tools.d.ts +10 -1
- package/dist/plugins/media/source-image.d.ts +9 -0
- package/dist/plugins/media/types.d.ts +21 -0
- package/dist/plugins/model-catalog/catalog.d.ts +3 -0
- package/package.json +1 -1
|
@@ -18,6 +18,9 @@ export interface MediaMeta {
|
|
|
18
18
|
durationMs?: number;
|
|
19
19
|
sampleRate?: number;
|
|
20
20
|
params?: Record<string, unknown>;
|
|
21
|
+
/** Provider-hosted URL (async video). Present when the bytes live remotely —
|
|
22
|
+
* the browser renders from this since a cross-origin byte-fetch is CORS-blocked. */
|
|
23
|
+
sourceUrl?: string;
|
|
21
24
|
}
|
|
22
25
|
export interface MediaStore {
|
|
23
26
|
save(id: string, data: Uint8Array, meta: MediaMeta): Promise<void>;
|
|
@@ -76,13 +79,22 @@ export interface VideoGenRequest {
|
|
|
76
79
|
provider: string;
|
|
77
80
|
model?: string;
|
|
78
81
|
prompt: string;
|
|
82
|
+
/** First-frame image → image-to-video. */
|
|
79
83
|
sourceImage?: DataSource;
|
|
84
|
+
/** Input video → extend or edit an existing clip (see `params.videoMode`).
|
|
85
|
+
* The adapter routes to the provider's extension/edit endpoint instead of
|
|
86
|
+
* plain generation. */
|
|
87
|
+
sourceVideo?: DataSource;
|
|
80
88
|
params?: {
|
|
81
89
|
duration?: number;
|
|
82
90
|
aspectRatio?: string;
|
|
83
91
|
resolution?: string;
|
|
84
92
|
/** OpenAI Sora literal pixel `size` (e.g. "720x1280"). */
|
|
85
93
|
size?: string;
|
|
94
|
+
/** When `sourceVideo` is set, which operation to run. `extend` (default)
|
|
95
|
+
* continues the clip from its last frame; `edit` modifies it in place per
|
|
96
|
+
* the prompt. Ignored without `sourceVideo`. */
|
|
97
|
+
videoMode?: 'extend' | 'edit';
|
|
86
98
|
};
|
|
87
99
|
}
|
|
88
100
|
export interface MediaResult {
|
|
@@ -94,6 +106,12 @@ export interface MediaResult {
|
|
|
94
106
|
export interface RawMediaResult {
|
|
95
107
|
data: Uint8Array;
|
|
96
108
|
mimeType: string;
|
|
109
|
+
/** Provider-hosted URL for the asset, when it exists (async video). In the
|
|
110
|
+
* browser, cross-origin buckets (e.g. xAI vidgen) block a programmatic
|
|
111
|
+
* byte-fetch via CORS, so `data` may be empty and this URL is the only way
|
|
112
|
+
* to render (`<video src>` plays cross-origin without CORS) or to re-submit
|
|
113
|
+
* as a `sourceVideo`. */
|
|
114
|
+
sourceUrl?: string;
|
|
97
115
|
width?: number;
|
|
98
116
|
height?: number;
|
|
99
117
|
durationMs?: number;
|
|
@@ -116,6 +134,9 @@ export interface MediaCapabilities {
|
|
|
116
134
|
audioGeneration: boolean;
|
|
117
135
|
videoGeneration: boolean;
|
|
118
136
|
audioStreaming: boolean;
|
|
137
|
+
/** Provider can extend/edit an existing video (`sourceVideo` on the request).
|
|
138
|
+
* Undefined/false → passing `sourceVideo` throws. */
|
|
139
|
+
videoExtension?: boolean;
|
|
119
140
|
}
|
|
120
141
|
/** All MediaProviderAdapter HTTP calls now go through the NetworkEngine
|
|
121
142
|
* queue (rate limits, retries, hooks, observability) instead of holding a
|
|
@@ -39,6 +39,9 @@ export interface ModelCapabilities {
|
|
|
39
39
|
imageGeneration: boolean;
|
|
40
40
|
audioGeneration: boolean;
|
|
41
41
|
videoGeneration: boolean;
|
|
42
|
+
/** Model accepts an existing video as input to extend/edit it (xAI
|
|
43
|
+
* grok-imagine-video). Undefined/false → generation only. */
|
|
44
|
+
videoExtension?: boolean;
|
|
42
45
|
}
|
|
43
46
|
/** One generation parameter a media model accepts, with its allowed values.
|
|
44
47
|
* Either an enum (`values` + `default`) or a numeric range (`min`/`max`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combycode/llm-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Unified, pluggable AI SDK for accessing the LLMs of every major provider (Anthropic, OpenAI, Google, xAI, OpenRouter) through one API. Cross-environment: Node, Bun, and the browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|