@inworld/cli 0.2.16 → 0.3.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.
@@ -1,5 +1,4 @@
1
1
  import {
2
- LLMChatRequestBuilderNode,
3
2
  RemoteLLMChatNode,
4
3
  RemoteTTSNode,
5
4
  SequentialGraphBuilder,
@@ -9,18 +8,17 @@ import {
9
8
  const graphBuilder = new SequentialGraphBuilder({
10
9
  id: 'llm-tts-graph',
11
10
  nodes: [
12
- new LLMChatRequestBuilderNode({
13
- messages: [
11
+ new RemoteLLMChatNode({
12
+ provider: 'openai',
13
+ modelName: 'gpt-4o-mini',
14
+ stream: true,
15
+ messageTemplates: [
14
16
  {
15
17
  role: 'user',
16
18
  content: { type: 'template', template: '{{user_input}}' },
17
19
  },
18
20
  ],
19
- }),
20
- new RemoteLLMChatNode({
21
- provider: 'openai',
22
- modelName: 'gpt-4o-mini',
23
- stream: true,
21
+
24
22
  }),
25
23
  new TextChunkingNode(),
26
24
  new RemoteTTSNode(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inworld/cli",
3
- "version": "0.2.16",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -15,8 +15,7 @@
15
15
  "dev": "tsx src/index.ts"
16
16
  },
17
17
  "files": [
18
- "dist/**/*",
19
- "src/templates/**/*"
18
+ "dist/**/*"
20
19
  ],
21
20
  "author": "Inworld AI",
22
21
  "license": "MIT",
@@ -32,6 +31,7 @@
32
31
  },
33
32
  "dependencies": {
34
33
  "@zowe/secrets-for-zowe-sdk": "^8.27.0",
34
+ "adm-zip": "^0.5.16",
35
35
  "archiver": "^7.0.1",
36
36
  "chalk": "^5.3.0",
37
37
  "commander": "^12.0.0",
@@ -1,155 +0,0 @@
1
- # LLM + TTS Pipeline Graph
2
-
3
- This is an Inworld Runtime graph that creates a complete conversational AI pipeline with LLM chat and text-to-speech capabilities.
4
-
5
- ## Overview
6
-
7
- This template provides a production-ready pipeline that:
8
-
9
- - Accepts user input and formats it for LLM processing
10
- - Sends requests to an LLM provider (OpenAI GPT-4o-mini by default)
11
- - Streams responses for better user experience
12
- - Chunks text for optimal TTS processing
13
- - Converts text responses to speech using TTS
14
-
15
- ## Getting Started
16
-
17
- ### Installation
18
-
19
- ```bash
20
- npm install
21
- ```
22
-
23
- ### Configuration
24
-
25
- Before running, you'll need to set up your API keys:
26
-
27
- ```bash
28
- # Set your Inworld API key
29
- export INWORLD_API_KEY="your-inworld-api-key"
30
- ```
31
-
32
- ### Running the Graph
33
-
34
- #### As a server (recommended):
35
-
36
- ```bash
37
- npm start
38
- # or
39
- npx inworld serve {{graphFileName}}
40
- ```
41
-
42
- #### Direct execution:
43
-
44
- ```bash
45
- npm run run
46
- # or
47
- npx inworld run {{graphFileName}}
48
- ```
49
-
50
- ## Project Structure
51
-
52
- - **`{{graphFileName}}`** - Main graph file with the LLM-TTS pipeline
53
- - **`package.json`** - Project dependencies and scripts
54
- - **`README.md`** - This file
55
-
56
- ## Pipeline Architecture
57
-
58
- The graph uses a `SequentialGraphBuilder` with the following nodes in order:
59
-
60
- 1. **LLMChatRequestBuilderNode**: Formats user input into LLM chat messages
61
- 2. **RemoteLLMChatNode**: Sends requests to the LLM provider and receives responses
62
- 3. **TextChunkingNode**: Breaks text into optimal chunks for TTS processing
63
- 4. **RemoteTTSNode**: Converts text chunks to speech
64
-
65
- ## Customization
66
-
67
- ### Changing the LLM Provider
68
-
69
- Edit the `RemoteLLMChatNode` configuration in `{{graphFileName}}`:
70
-
71
- ```typescript
72
- new RemoteLLMChatNode({
73
- provider: 'anthropic', // Change to 'anthropic', 'google', etc.
74
- modelName: 'claude-3-sonnet', // Change to desired model
75
- stream: true,
76
- // Add other provider-specific options
77
- });
78
- ```
79
-
80
- ### Modifying the System Prompt
81
-
82
- Add system messages to the `LLMChatRequestBuilderNode`:
83
-
84
- ```typescript
85
- new LLMChatRequestBuilderNode({
86
- messages: [
87
- {
88
- role: 'system',
89
- content: { type: 'text', text: 'You are a helpful assistant...' },
90
- },
91
- {
92
- role: 'user',
93
- content: { type: 'template', template: '{{user_input}}' },
94
- },
95
- ],
96
- });
97
- ```
98
-
99
- ### Customizing TTS Settings
100
-
101
- Configure the TTS node for different voices or providers:
102
-
103
- ```typescript
104
- new RemoteTTSNode({
105
- speakerId: 'Dennis',
106
- modelId: 'inworld-tts-1-max',
107
- });
108
- ```
109
-
110
- ### Adding Additional Processing
111
-
112
- You can insert additional nodes into the pipeline:
113
-
114
- ```typescript
115
- const graphBuilder = new SequentialGraphBuilder({
116
- id: 'custom-text-node-llm',
117
- nodes: [
118
- new LLMChatRequestBuilderNode({...}),
119
- new RemoteLLMChatNode({...}),
120
- new CustomProcessingNode(), // Your custom node
121
- new TextChunkingNode(),
122
- new RemoteTTSNode(),
123
- ],
124
- });
125
- ```
126
-
127
- ## Environment Variables
128
-
129
- The following environment variables can be configured:
130
-
131
- - `INWORLD_API_KEY`: API key for OpenAI (required for GPT models)
132
-
133
- ## Deployment
134
-
135
- To package your graph for deployment:
136
-
137
- ```bash
138
- npx inworld deploy {{graphFileName}}
139
- ```
140
-
141
- This will create a deployment package that can be uploaded to Inworld Cloud.
142
-
143
- ## Documentation
144
-
145
- For more information about:
146
-
147
- - Inworld Runtime: Visit the [documentation](https://docs.inworld.ai/)
148
- - LLM providers: Check provider-specific documentation
149
- - TTS options: See the TTS provider documentation
150
-
151
- ## Requirements
152
-
153
- - Node.js >= 18.0.0
154
- - @inworld/cli package
155
- - Valid Inworld API key
@@ -1,31 +0,0 @@
1
- import {
2
- LLMChatRequestBuilderNode,
3
- RemoteLLMChatNode,
4
- RemoteTTSNode,
5
- SequentialGraphBuilder,
6
- TextChunkingNode,
7
- } from '@inworld/runtime/graph';
8
-
9
- const graphBuilder = new SequentialGraphBuilder({
10
- id: 'llm-tts-graph',
11
- nodes: [
12
- new LLMChatRequestBuilderNode({
13
- messages: [
14
- {
15
- role: 'user',
16
- content: { type: 'template', template: '{{user_input}}' },
17
- },
18
- ],
19
- }),
20
- new RemoteLLMChatNode({
21
- provider: 'openai',
22
- modelName: 'gpt-4o-mini',
23
- stream: true,
24
- }),
25
- new TextChunkingNode(),
26
- new RemoteTTSNode(),
27
- ],
28
- enableRemoteConfig: false
29
- });
30
-
31
- export const graph = graphBuilder.build();
@@ -1,41 +0,0 @@
1
- {
2
- "name": "LLM + TTS Pipeline",
3
- "displayName": "LLM Chat with Text-to-Speech",
4
- "description": "A production-ready pipeline that processes user input through an LLM (GPT-4o-mini by default) and converts the response to speech using TTS. Includes streaming support for better user experience.",
5
- "tags": ["llm", "tts", "openai", "voice", "streaming"],
6
- "defaultProjectName": "llm-tts-graph",
7
- "examples": {
8
- "curlCommand": "curl http://localhost:3000/v1/graph:start -X POST -H 'Content-Type: application/json' -d '{\"input\": {\"user_input\":\"What is the weather like today?\"}}'",
9
- "inputExample": {
10
- "user_input": "What is the weather like today?"
11
- },
12
- "outputExample": {
13
- "text": "I don't have access to real-time weather data...",
14
- "audio": "base64_encoded_audio_data..."
15
- }
16
- },
17
- "features": [
18
- "LLM integration (OpenAI GPT-4o-mini)",
19
- "Text-to-Speech conversion",
20
- "Streaming responses",
21
- "Text chunking for optimal TTS",
22
- "Configurable providers"
23
- ],
24
- "requirements": {
25
- "node": ">=18.0.0",
26
- "dependencies": ["@inworld/runtime"],
27
- "apiKeys": ["INWORLD_API_KEY"],
28
- "optionalApiKeys": []
29
- },
30
- "configuration": {
31
- "llm": {
32
- "provider": "openai",
33
- "model": "gpt-4o-mini",
34
- "streaming": true
35
- },
36
- "tts": {
37
- "provider": "default",
38
- "voice": "default"
39
- }
40
- }
41
- }