Skip to main content
This demo showcases how to use the LLMNode.

Run the Template

  1. Go to Assets/InworldRuntime/Scenes/Nodes and play the LLMNode scene. LLMNode00
  2. Enter your request. The AI agent will respond.
LLMNode01

Understanding the Graph

You can find the graph on the InworldGraphExecutor of LLMNodeCanvas. LLMNode02 The graph is very simple. It contains a single node, LLMNode, with no edges. LLMNode is both the StartNode and the EndNode. LLMNode03

InworldController

The InworldController is also simple; it contains only one primitive module: LLM. LLMNode04
For details about the primitive module, see the LLM Primitive Demo.

Workflow

  1. When the game starts, InworldController initializes its only module, LLMModule, which creates the LLMInterface.
  2. Next, InworldGraphExecutor initializes its graph asset by calling each component’s CreateRuntime(). In this case, only LLMNode.CreateRuntime() is called, using the created LLMInterface as input.
  3. After initialization, the graph calls Compile() and returns the executor handle.
  4. After compilation, the OnGraphCompiled event is invoked. In this demo, LLMNodeTemplate subscribes to it and enables the UI components. Users can then interact with the graph system.
LLMNodeTemplate.cs
  1. When the user sends text, this demo wraps the message into an LLMChatRequest and sends it to the LLM as raw input.
LLMNodeTemplate.cs
  1. Calling ExecuteGraphAsync() eventually produces a result and invokes OnGraphResult(), which LLMCanvas subscribes to in order to receive the data.