AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.ExecuteThreadChat

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.ExecuteThreadChat
Execute a Chat in a Thread with AnythingLLM API

 

Intention

 

ExecuteThreadChat Command: Engaging in Threaded Conversations
 
The AIN.ExecuteThreadChat command allows you to send a message within a specific thread in a workspace using the AnythingLLM API. It’s designed for threaded conversations, enabling structured and contextual interactions.

This command is part of the AIN - AnythingLLM AI suite, ideal for applications requiring ongoing dialogues tied to specific threads within workspaces.

 

What is the ExecuteThreadChat Command?

 

This command sends a user message to a predefined thread within a workspace, returning the chat ID and response. It leverages the AnythingLLM API to process the input and maintain conversation context.

The response can be stored in a variable or retrieved from the stack, with additional outputs like the chat ID available for tracking.

 

Why Do You Need It?

 

Use AIN.ExecuteThreadChat for:

Threaded Dialogues: Maintain context in conversations tied to specific threads.

Automation: Build bots or scripts that interact within organized threads.

Tracking: Capture chat IDs for further operations or history retrieval.

 

How to Use the ExecuteThreadChat Command?

 

Specify the workspace slug, thread slug, and message, with an optional mode parameter (defaults to "query"). The response and chat ID are returned for further use.

Ensure the API key and endpoint are set (via AIN.SetKey and AIN.SetChatEndpoint) before execution.

 

Illustration

 

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

│ Thread Chat                  │

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

│ Workspace > Thread > Message │

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

Sending a message within a thread in a workspace.

 

Syntax

 

AIN.ExecuteThreadChat|P1|P2|P3[|P4]

AIN.ETC|P1|P2|P3[|P4]

 

Parameter Explanation

 

P1 - (String) The workspace slug identifying the workspace containing the thread.

P2 - (String) The thread slug identifying the specific thread within the workspace.

P3 - (String) The message to send within the thread.

P4 - (String, Optional) The mode of execution (defaults to "query").

 

Example

 

' Set up API key and endpoint

AIN.SetKey|your_api_key_here

AIN.SetChatEndpoint|http://localhost:3001

' Execute a chat in a thread

AIN.ExecuteThreadChat|my-workspace|thread-123|What is AnythingLLM?|query|$$RES

DBP.Response: $$RES

POP.$$CID

DBP.Chat ID: $$CID

ENR.

 

Remarks

 

- Requires a valid API key and endpoint configuration prior to use.

- The response is stored in the specified variable (P5 if provided), with the chat ID and response also pushed to the stack.

- Thread must exist; use AIN.CreateThread to create one if needed.

 

Limitations

 

- Parameter count must be between 4 and 5; otherwise, an error is set.

- Dependent on the AnythingLLM API’s availability and correct thread/workspace setup.

 

See also:

 

AIN.CreateThread

AIN.GetThreadChats

AIN.DeleteThread

AIN.ExecuteChat

Operations