KnowledgeModule | Inherits from: InworldFrameworkModule
Module for managing knowledge bases and information retrieval within the Inworld framework. Provides functionality for compiling, storing, and querying knowledge content for AI interactions. Integrates with text embedding services for semantic search and knowledge matching.
Properties
Events
Methods
Reference
CompileConfig
Gets the compile configuration for knowledge processing. Returns null if the module is not properly configured.Returns
Type:KnowledgeCompileConfig
Description: The knowledge compilation configuration instance, or null if not configured.
MaxCharsPerChunk
Gets or sets the maximum number of characters per knowledge chunk. Affects how knowledge content is divided during compilation.Returns
Type:int
Description: The maximum characters per chunk setting.
MaxChunksPerDoc
Gets or sets the maximum number of chunks per document. Limits the granularity of knowledge segmentation during compilation.Returns
Type:int
Description: The maximum chunks per document setting.
OnKnowledgeRemoved
Event triggered when knowledge content has been removed from the knowledge base.Parameters
| Parameter | Type | Description |
|---|---|---|
| knowledgeID | string | The unique identifier of the removed knowledge. |
OnKnowledgeCompiled
Event triggered when knowledge content has been compiled and chunked. Provides the knowledge ID and the resulting list of compiled chunks.Parameters
| Parameter | Type | Description |
|---|---|---|
| knowledgeID | string | The unique identifier of the compiled knowledge. |
| chunks | List<string> | The resulting list of compiled knowledge chunks. |
OnKnowledgeRespond
Event triggered when knowledge retrieval responds with relevant information. Provides the list of knowledge chunks that match the query.Parameters
| Parameter | Type | Description |
|---|---|---|
| chunks | List<string> | The list of relevant knowledge chunks. |
SetupEmbedder
Sets up the text embedder interface for semantic knowledge processing. Required for advanced knowledge matching and retrieval operations.Parameters
| Parameter | Type | Description |
|---|---|---|
| textEmbedderInterface | TextEmbedderInterface | The text embedder interface to use for knowledge processing. |
Returns
Type:void
RemoveKnowledge
Removes knowledge content from the knowledge base. Triggers OnKnowledgeRemoved event if the removal is successful.Parameters
| Parameter | Type | Description |
|---|---|---|
| knowledgeID | string | The unique identifier of the knowledge to remove. |
Returns
Type:bool
Description: True if the knowledge was successfully removed, false otherwise.
CompileKnowledges
Compiles raw knowledge content into processable chunks. Breaks down large knowledge documents into smaller, searchable segments. Triggers OnKnowledgeCompiled event with the resulting chunks.Parameters
| Parameter | Type | Description |
|---|---|---|
| knowledgeID | string | The unique identifier for this knowledge set. |
| knowledges | List<string> | List of raw knowledge strings to compile. |
Returns
Type:List<string>
Description: List of compiled knowledge chunks, or null if compilation failed.
GetKnowledges
Retrieves relevant knowledge content based on provided knowledge IDs and optional event history. Performs semantic matching to find the most relevant knowledge for the current context. Triggers OnKnowledgeRespond event with the retrieved knowledge.Parameters
| Parameter | Type | Description |
|---|---|---|
| knowledgeIDs | List<string> | List of knowledge identifiers to search within. |
| eventHistory | List<InworldEvent> | Optional conversation history to provide context for knowledge retrieval. |
Returns
Type:List<string>
Description: List of relevant knowledge strings, or null if retrieval failed.
Serialized Fields
The following fields are configurable in the Unity Inspector:- m_MaxCharsPerChunk (
int) - Maximum number of characters per knowledge chunk (default: 200) - m_MaxChunksPerDoc (
int) - Maximum number of chunks per document (default: 100)