node-llm-chat template illustrates how to make LLM calls using the LLM node with support for streaming, tool calling, and multimodal inputs.
Architecture
- Backend: Inworld Runtime
- Frontend: N/A (CLI example)
Run the Template
- Download and extract the Inworld Templates.
- 
Install the Runtime SDK inside the clidirectory.
- 
Set up your Base64 Runtime API key by copying the .env-samplefile into a.envfile in theclifolder and adding your API key..env
- 
Run a basic example of calling the LLM with a text prompt:
- 
Now try changing the model and requiring JSON outputs. See Models > Chat Completion for models supported.
- 
Now let’s try with tool calling.
- 
Now let’s try with image inputs:
- Finally, check out your captured traces in Portal!
Understanding the Template
The main functionality of the template is contained in the run function, which demonstrates how to use the Inworld Runtime to generate text using the LLM node. Let’s break it down into more detail:1) Initialize LLM node
First, we initialize the LLM node- provider: The LLM service provider (inworld, openai, etc.) as specified here
- modelName: Any model from Chat Completion
- stream: Whether to enable streaming responses
- textGenerationConfig: LLM generation parameters. You can learn more about these configurations here.
createRemoteLLMChatNode does not require registering the component explicitly, before use in the node, but you can also register the component and reference it when creating the node as shown in the node_llm_chat_explicit_components.ts example. This allows you to reuse the same component across multiple nodes (for example, if you want to make multiple LLM calls with the same model).
2) Graph initialization
Next we create a new graph and add the LLM node, setting it as the start and end node. In more complex applications, you could connect multiple LLM nodes to create a processing pipeline.- id: A unique identifier for the graph
- enableRemoteConfig: Whether to enable remote configuration (set to false for local execution)
- apiKey: Your Inworld API key