Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview > KnowledgeData Class: KnowledgeData | Inherits from: ScriptableObject ScriptableObject that manages a collection of knowledge entries for AI character systems. Use this to define factual information and context your character can reference.

Usage (Editor-Only Knowledge Management)

Knowledge is now compiled to the remote server from the Unity Editor rather than at runtime. You must compile your knowledge entries at least once before attempting to retrieve them at runtime.

1. Create a Knowledge Asset

In the Unity Editor, go to Create > Inworld > Create Data > Knowledges to create a new KnowledgeData asset. Add entries to the knowledges list in the Inspector, giving each a title and one or more content strings.

2. Compile to Remote

Select your KnowledgeData asset in the Inspector. The custom editor displays a Knowledge Remote Management panel: KnowledgeRemote
  • Compile All — Compiles every knowledge entry in the asset to the remote server.
  • Fetch All Status — Checks the remote status of all entries.
  • Clean Orphans — Removes remote entries that no longer exist locally.
  • Compile (per entry) — Compiles a single knowledge entry to the remote.
  • Fetch (per entry) — Fetches the remote status for a single entry.
  • Delete Remote (per entry) — Deletes a single entry from the remote server.
You must compile your knowledge at least once, and again whenever you update entries. If a knowledge entry shows Remote: Not Found, it has not been compiled yet.
Important: If you attempt to retrieve knowledge at runtime before compiling it to the remote, you will receive the error: [InworldFramework DLL]: Error: gRPC call failed: Failed to retrieve knowledge due to validation errors

3. Access Knowledge at Runtime

There are two ways to access knowledge at runtime. They serve different purposes.

Local access (no remote compilation required)

The following properties and methods read directly from the ScriptableObject asset in memory. They return the raw strings you entered in the Inspector and do not contact the remote server:
// Get all knowledge IDs
InworldVector<string> ids = knowledgeData.KnowledgeIDs;

// Look up a specific entry by title
InworldVector<string> content = knowledgeData.GetKnowledgesByID("knowledge/lore");

// Quick access to the first entry (useful for single-knowledge assets)
string defaultTitle = knowledgeData.DefaultID;
List<string> defaultContent = knowledgeData.DefaultKnowledges;
Use these when you need the knowledge text itself — for example, to populate a UI or inject content into a prompt.

Remote retrieval (requires prior editor-side compilation)

When you use the Knowledge node in a graph or the Knowledge primitive (InworldController.Knowledge), the framework queries the remote knowledge server to perform semantic search and retrieval. This path requires that you have compiled the knowledge to the remote from the editor (step 2 above). If the knowledge has not been compiled, these calls will fail with: [InworldFramework DLL]: Error: gRPC call failed: Failed to retrieve knowledge due to validation errors See the Knowledge Primitive Demo for a working example of remote retrieval.

Nested Types

Properties

Methods

Reference

Knowledges

Represents a knowledge entry with title and content.

Fields

  • title (string): Identifier for this knowledge entry.
  • content (List<string>): Content lines for this knowledge entry.

Methods

  • CompileKnowledge()List<string>: Deprecated. Knowledge is now managed offline (editor only). Previously compiled this entry using the framework’s knowledge system.

knowledges (collection)

The collection of knowledge entries managed by this asset.

Type

List<Knowledges>

IDs

List of all knowledge identifiers (titles) contained in this asset.

Type

List<string> (read-only)

KnowledgeIDs

All knowledge identifiers (titles) in this asset, returned as an InworldVector<string> for use with the framework’s data layer.

Type

InworldVector<string> (read-only)

DefaultID

The title of the first knowledge entry in the collection, or an empty string if the collection is empty.

Type

string (read-only)

DefaultKnowledges (property)

The content list of the first knowledge entry, or an empty list if the collection is empty.

Type

List<string> (read-only)

GetKnowledgesByID

Retrieves the content of a specific knowledge entry by its title, directly from the ScriptableObject data.

Parameters

ParameterTypeDescription
inputIDstringThe title identifier of the knowledge entry to retrieve.

Returns

InworldVector<string> — The content strings for the matching entry, or null if inputID is empty or no entry matches.

GetDefaultKnowledges

Retrieves the content of the first knowledge entry in the collection, directly from the ScriptableObject data.

Returns

InworldVector<string> — The content strings of the first entry, or null if the collection is empty.

CompileKnowledges

Deprecated. Knowledge is now managed offline (editor only). This method will be removed in a future release.
Compiles all knowledge entries into a unified knowledge base.

Returns

List<string> — The compiled knowledge strings, or null if the knowledge system is unavailable.

AddKnowledge (Knowledges)

Adds a new knowledge entry to the collection and recompiles the knowledge base.

Parameters

ParameterTypeDescription
newKnowledgeKnowledgesThe new knowledge entry to add.

Returns

List<string> — The compiled knowledge strings after the addition.

AddKnowledge (id, content)

Adds or updates a single content item for a specific knowledge identifier. If the ID is empty, it defaults to knowledge/new. If the ID has no knowledge/ prefix, one will be added.

Parameters

ParameterTypeDescription
knowledgeIDstringIdentifier for the knowledge entry.
contentstringContent string to add.

Returns

List<string> — The compiled knowledge strings after the update.

AddKnowledge (id, contents)

Adds or updates multiple content items for a specific knowledge identifier. Applies the same prefix rules as above.

Parameters

ParameterTypeDescription
knowledgeIDstringIdentifier for the knowledge entry.
contentList<string>Content strings to add.

Returns

List<string> — The compiled knowledge strings after the update.

RemoveKnowledge

Removes a knowledge entry from the collection by its title identifier and also removes it from the framework’s knowledge system if available.

Parameters

ParameterTypeDescription
titlestringTitle identifier of the knowledge entry to remove.

GetKnowledges

Deprecated. Runtime compilation is no longer supported. Remote knowledge retrieval now happens through the Knowledge node or Knowledge primitive after compiling from the editor. For local asset access, use GetKnowledgesByID or GetDefaultKnowledges.
Retrieves the compiled knowledge data for all knowledge entries managed by this asset.

Returns

List<string> — The compiled knowledge strings for all entries, or null if the knowledge system is unavailable.