AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.CreateThread

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.CreateThread
Create a New Thread in a Workspace

 

Intention

 

CreateThread Command: Creating a New Thread
 
The CreateThread command allows you to create a new thread within a specified workspace in the AnythingLLM API, enabling organized conversations or tasks.

This is essential for managing multiple discussion threads or workflows within a workspace, enhancing collaboration and context management.

It’s part of the AIN - AnythingLLM AI suite.

 

What is the CreateThread Command?

 

The CreateThread command sends a request to the AnythingLLM API to establish a new thread within a workspace, identified by its slug.

It requires a workspace slug, user ID, thread slug, and thread name, returning a unique thread ID upon success, which can be stored in a variable or accessed via the stack.

 

Why Do You Need It?

 

Creating threads is crucial for:

Organization: Keep conversations or tasks separate within a workspace.

Context Management: Maintain context for specific topics or users.

Collaboration: Enable multiple users to interact within defined threads.

 

How to Use the CreateThread Command?

 

Use this command by providing the required parameters: workspace slug, user ID, thread slug, and thread name, with an optional variable to store the response.

The thread ID is returned on the stack, and the full response can be stored in a variable if specified.

 

Example Usage

 

AIN.CreateThread|my-workspace|user123|thread-001|My Thread|$$RES

DBP.Thread Creation Response: $$RES

POP.$$TID

DBP.Thread ID: $$TID

 

This creates a thread named "My Thread" in "my-workspace" for "user123" with slug "thread-001".

 

Illustration

 

┌──────────────────┐

│ Thread Creation  │

├──────────────────┤

│ ID: thread-123   │

└──────────────────┘

A new thread is created and its ID returned.

 

Syntax

 

AIN.CreateThread|P1|P2|P3|P4[|P5]

 

Parameter Explanation

 

P1 - Workspace slug (required) - Identifies the workspace where the thread will be created.

P2 - User ID (required) - Specifies the user creating the thread.

P3 - Thread slug (required) - A unique identifier for the thread.

P4 - Thread name (required) - The human-readable name of the thread.

P5 - (Optional) Variable to store the full response; thread ID is always on the stack.

 

Example

 

AIN.CreateThread|my-workspace|user123|thread-001|My Thread|$$RES

DBP.Response: $$RES

POP.$$TID

DBP.Thread ID: $$TID

ENR.

 

Remarks

 

- Requires a valid API key set via AIN.SetKey.

- Thread slug must be unique within the workspace.

 

Limitations

 

- Fails if the workspace does not exist or if parameters are invalid.

- Limited to 5 or 6 parameters as per the code constraints.

 

See also:

 

AIN.GetThreadChats

AIN.ExecuteThreadChat

AIN.DeleteThread

AIN.CreateWorkspace