import { GraphBuilder, RemoteLLMChatNode, TextChunkingNode, RemoteTTSNode } from '@inworld/runtime/graph';
// Create multiple nodes
const llmNode = new RemoteLLMChatNode({
id: 'llm_node',
provider: 'openai',
modelName: 'gpt-4o-mini',
stream: false,
});
const textChunkingNode = new TextChunkingNode({
id: 'text_chunking_node',
});
const ttsNode = new RemoteTTSNode({
id: 'tts_node',
speakerId: 'Dennis',
modelId: 'inworld-tts-1-max',
sampleRate: 24000,
temperature: 0.7,
speakingRate: 1.0,
});
// Build the graph with multiple nodes and edges
const graph = new GraphBuilder({ id: 'llm-tts-graph', apiKey: process.env.INWORLD_API_KEY, enableRemoteConfig: false })
.addNode(llmNode)
.addNode(textChunkingNode)
.addNode(ttsNode)
.addEdge(llmNode, textChunkingNode)
.addEdge(textChunkingNode, ttsNode)
.setStartNode(llmNode)
.setEndNode(ttsNode)
.build();