@sogni-ai/sogni-client 4.2.0-alpha.3 → 4.2.0-alpha.5
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 +14 -0
- package/README.md +16 -9
- package/dist/Chat/ChatTools.d.ts +5 -49
- package/dist/Chat/ChatTools.js +357 -82
- package/dist/Chat/ChatTools.js.map +1 -1
- package/dist/Chat/index.js +36 -2
- package/dist/Chat/index.js.map +1 -1
- package/dist/Chat/tools.d.ts +8 -55
- package/dist/Chat/tools.js +316 -98
- package/dist/Chat/tools.js.map +1 -1
- package/dist/Chat/types.d.ts +1 -1
- package/dist/lib/mediaValidation.d.ts +16 -0
- package/dist/lib/mediaValidation.js +283 -0
- package/dist/lib/mediaValidation.js.map +1 -0
- package/llms-full.txt +32 -10
- package/llms.txt +25 -6
- package/package.json +1 -1
- package/src/Chat/ChatTools.ts +433 -85
- package/src/Chat/index.ts +48 -2
- package/src/Chat/tools.ts +373 -102
- package/src/Chat/types.ts +1 -1
- package/src/lib/mediaValidation.ts +355 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [4.2.0-alpha.5](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.4...v4.2.0-alpha.5) (2026-04-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* validate inline media inputs for tools and vision requests ([c4bd7c1](https://github.com/Sogni-AI/sogni-client/commit/c4bd7c15cd530896065cf5ed41cd280b5db63938))
|
|
7
|
+
|
|
8
|
+
# [4.2.0-alpha.4](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.3...v4.2.0-alpha.4) (2026-04-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* expand chat sogni media tools ([fb0d6c7](https://github.com/Sogni-AI/sogni-client/commit/fb0d6c77e4b73fbbe57d8b64b4a37bb610eb8c68))
|
|
14
|
+
|
|
1
15
|
# [4.2.0-alpha.3](https://github.com/Sogni-AI/sogni-client/compare/v4.2.0-alpha.2...v4.2.0-alpha.3) (2026-04-20)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Behind the scenes this SDK uses a WebSocket connection for communication between
|
|
|
18
18
|
- 🎯 **Advanced Controls** - Fine-tune generation with samplers, schedulers, ControlNets, and more
|
|
19
19
|
- 🤖 **LLM Text Generation** - Chat completions with streaming, multi-turn conversations, and thinking/reasoning mode via OpenAI-compatible API
|
|
20
20
|
- 🔧 **LLM Tool Calling** - Define custom tools (functions) that the LLM can invoke during conversations for real-time data and actions
|
|
21
|
-
- 🎨🎬🎵 **Sogni Platform Tools** - Generate images,
|
|
21
|
+
- 🎨🎬🎵 **Sogni Platform Tools** - Generate images, reference-guided image edits, videos, audio-driven videos, video transforms, and music through natural language chat
|
|
22
22
|
- 👁️ **Vision Chat** - Multimodal image understanding with scene description, OCR, object detection, visual analysis, and multi-image comparison via Qwen3.6 VLM
|
|
23
23
|
## Migration notes
|
|
24
24
|
### v3.x.x to v4.x.x
|
|
@@ -691,13 +691,20 @@ const response = await sogni.chat.completions.create({
|
|
|
691
691
|
|
|
692
692
|
### Sogni Platform Tools — Generate Media via Chat
|
|
693
693
|
|
|
694
|
-
Combine LLM intelligence with Sogni's media generation capabilities. The
|
|
694
|
+
Combine LLM intelligence with Sogni's media generation capabilities. The SDK exposes six built-in public platform tools for chat completions:
|
|
695
695
|
|
|
696
|
-
-
|
|
697
|
-
-
|
|
698
|
-
-
|
|
696
|
+
- **`sogni_generate_image`** — text-to-image generation
|
|
697
|
+
- **`sogni_edit_image`** — reference-guided image editing using `source_image_url` and `reference_image_urls`
|
|
698
|
+
- **`sogni_generate_video`** — text-to-video and image-to-video generation
|
|
699
|
+
- **`sogni_sound_to_video`** — audio-driven video generation using `reference_audio_url`
|
|
700
|
+
- **`sogni_video_to_video`** — video transformation / motion transfer using `reference_video_url`
|
|
701
|
+
- **`sogni_generate_music`** — music generation with optional lyrics and advanced controls
|
|
699
702
|
|
|
700
|
-
|
|
703
|
+
Use `SogniTools.all` to expose the full tool surface, then execute tool calls with `sogni.chat.tools.execute()` / `executeAll()` or `autoExecuteTools: true` for non-streaming flows.
|
|
704
|
+
|
|
705
|
+
Media-conditioned workflows use explicit inline base64 `data:` URIs, including `source_image_url`, `reference_image_url`, `reference_audio_url`, `reference_audio_identity_url`, and `reference_video_url`. Remote `http(s)` URLs are not allowed for these tool inputs. Tool image inputs accept PNG or JPEG only, tool audio inputs accept MP3/M4A/WAV only, and tool video inputs accept MP4 or MOV/QuickTime only.
|
|
706
|
+
|
|
707
|
+
The `workflow_text_chat_sogni_tools.mjs` example demonstrates the core text-to-image, text-to-video, and text-to-music composition flows. Dedicated workflow examples like `workflow_image_edit.mjs`, `workflow_sound_to_video.mjs`, and `workflow_video_to_video.mjs` cover the asset-backed workflows directly.
|
|
701
708
|
|
|
702
709
|
## Code Examples
|
|
703
710
|
|
|
@@ -719,7 +726,7 @@ The [examples](https://github.com/Sogni-AI/sogni-client/tree/main/examples) dire
|
|
|
719
726
|
- **`workflow_text_chat_multi_turn.mjs`** - Multi-turn conversation with history, in-chat commands, and session stats
|
|
720
727
|
- **`workflow_text_chat_vision.mjs`** - Vision chat with multimodal image understanding (scene description, OCR, object detection, visual analysis, multi-image comparison)
|
|
721
728
|
- **`workflow_text_chat_tool_calling.mjs`** - LLM tool calling with built-in tools (weather, time, unit conversion, math)
|
|
722
|
-
- **`workflow_text_chat_sogni_tools.mjs`** -
|
|
729
|
+
- **`workflow_text_chat_sogni_tools.mjs`** - Core image/video/music generation through natural language via LLM tool calling
|
|
723
730
|
|
|
724
731
|
### Basic Examples
|
|
725
732
|
- **`promise_based.mjs`** - Image generation using promises/async-await
|
|
@@ -777,8 +784,8 @@ When helping users generate images, videos, or use LLM features with Sogni:
|
|
|
777
784
|
2. **Video generation**: Use `type: 'video'` with `network: 'fast'` (required)
|
|
778
785
|
3. **Audio generation**: Use `type: 'audio'` with ACE-Step 1.5 models
|
|
779
786
|
4. **LLM text chat**: Use `sogni.projects.chatCompletion()` for text generation with streaming and tool calling
|
|
780
|
-
5. **Sogni Platform Tools**: Combine LLM tool calling with Sogni media generation to create images, videos, and music from natural language
|
|
781
|
-
6. **Vision chat**: Use `qwen3.6-35b-a3b-gguf-iq4xs` VLM for multimodal image understanding with `image_url` content
|
|
787
|
+
5. **Sogni Platform Tools**: Combine LLM tool calling with Sogni media generation to create images, image edits, videos, audio-driven videos, video transforms, and music from natural language
|
|
788
|
+
6. **Vision chat**: Use `qwen3.6-35b-a3b-gguf-iq4xs` VLM for multimodal image understanding with `image_url` content parts carrying inline base64 JPEG/PNG `data:` URIs. Vision requests allow up to 20 images, 10MB each, with longest side capped at 1024px. This 1024px dimension cap applies only to the vision `image_url` path, not to media-generation tool image inputs.
|
|
782
789
|
7. **WAN 2.2 vs LTX-2.3**: These model families have different FPS behaviors - see `llms-full.txt` for details
|
|
783
790
|
|
|
784
791
|
## API Documentation
|
package/dist/Chat/ChatTools.d.ts
CHANGED
|
@@ -1,65 +1,21 @@
|
|
|
1
1
|
import type ProjectsApi from '../Projects';
|
|
2
2
|
import { ToolCall, ToolExecutionOptions, ToolExecutionProgress, ToolExecutionResult } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* API for executing Sogni platform tool calls (image, video, music generation).
|
|
5
|
-
*
|
|
6
|
-
* Accessed via `sogni.chat.tools`. Provides methods to execute tool calls returned
|
|
7
|
-
* by the LLM, mapping them to `sogni.projects.create()` calls automatically.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* // Execute a single tool call
|
|
12
|
-
* const result = await sogni.chat.tools.execute(toolCall, {
|
|
13
|
-
* tokenType: 'sogni',
|
|
14
|
-
* onProgress: (p) => console.log(`${p.status}: ${p.percent}%`),
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // Execute all tool calls from a completion
|
|
18
|
-
* const results = await sogni.chat.tools.executeAll(result.tool_calls, {
|
|
19
|
-
* onToolCall: async (tc) => myCustomHandler(tc), // for non-Sogni tools
|
|
20
|
-
* });
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
3
|
declare class ChatToolsApi {
|
|
24
4
|
private projects;
|
|
25
5
|
constructor(projects: ProjectsApi);
|
|
26
|
-
/**
|
|
27
|
-
* Execute a single Sogni platform tool call.
|
|
28
|
-
*
|
|
29
|
-
* Maps tool call arguments to `sogni.projects.create()`, waits for the media
|
|
30
|
-
* generation to complete, and returns the result URLs.
|
|
31
|
-
*
|
|
32
|
-
* @throws Error if the tool call is not a Sogni tool (use `isSogniToolCall()` to check first)
|
|
33
|
-
*/
|
|
34
6
|
execute(toolCall: ToolCall, options?: ToolExecutionOptions): Promise<ToolExecutionResult>;
|
|
35
|
-
/**
|
|
36
|
-
* Execute multiple tool calls from a single LLM response.
|
|
37
|
-
*
|
|
38
|
-
* Sogni tool calls (prefixed with `sogni_`) are executed automatically via
|
|
39
|
-
* `projects.create()`. Non-Sogni tool calls are delegated to the `onToolCall`
|
|
40
|
-
* callback if provided, or returned as errors.
|
|
41
|
-
*
|
|
42
|
-
* @param toolCalls - Array of tool calls from `result.tool_calls`
|
|
43
|
-
* @param options - Execution options plus optional handler for non-Sogni tools
|
|
44
|
-
*/
|
|
45
7
|
executeAll(toolCalls: ToolCall[], options?: ToolExecutionOptions & {
|
|
46
|
-
/** Handler for non-Sogni tool calls. Must return the tool result content string. */
|
|
47
8
|
onToolCall?: (toolCall: ToolCall) => Promise<string>;
|
|
48
|
-
/** Per-tool progress callback (wraps the per-tool onProgress with tool identity). */
|
|
49
9
|
onToolProgress?: (toolCall: ToolCall, progress: ToolExecutionProgress) => void;
|
|
50
10
|
}): Promise<ToolExecutionResult[]>;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* Falls back to the model with the most available workers.
|
|
54
|
-
*/
|
|
55
|
-
private getDefaultModel;
|
|
56
|
-
/**
|
|
57
|
-
* Create a project, wait for completion with timeout, track per-job progress,
|
|
58
|
-
* and clean up on failure or timeout.
|
|
59
|
-
*/
|
|
11
|
+
private getAvailableModels;
|
|
12
|
+
private selectModel;
|
|
60
13
|
private executeProject;
|
|
61
14
|
private executeImageGeneration;
|
|
15
|
+
private executeImageEdit;
|
|
62
16
|
private executeVideoGeneration;
|
|
17
|
+
private executeSoundToVideo;
|
|
18
|
+
private executeVideoToVideo;
|
|
63
19
|
private executeMusicGeneration;
|
|
64
20
|
private makeErrorResult;
|
|
65
21
|
}
|