AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.ExportChats

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.ExportChats
Export All Chats from the System

 

Intention

 

ExportChats Command: Archiving Chat History
 
The ExportChats command retrieves all chat histories from the AnythingLLM system in a specified format, such as JSON or CSV, for archiving or analysis.

This is perfect for backing up conversations or processing them externally.

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

 

What is the ExportChats Command?

 

The ExportChats command exports all chats stored in the AnythingLLM system in a user-specified format, returning the data as a string for further use.

It supports JSON (default) and CSV formats, making it versatile for different applications.

 

Why Do You Need It?

 

Exporting chats is useful for:

Backup: Save chat histories for safekeeping.

Analysis: Process conversations in external tools.

Documentation: Record interactions for reference or reporting.

 

How to Use the ExportChats Command?

 

Specify the export format ("json" or "csv") and optionally a variable to store the result. The API key must be set prior to use.

The exported data can then be saved to a file or processed directly.

 

Example Usage

 

AIN.SetKey|your_api_key_here

AIN.ExportChats|json|$$DAT

DBP.Exported Chats: $$DAT

 

This exports all chats in JSON format and displays the result.

 

Illustration

 

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

│ Export Chats  │

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

│ Format: JSON  │

│ Output: $$DAT │

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

Exporting chat data in a structured format.

 

Syntax

 

AIN.ExportChats|P1[|P2]

 

Parameter Explanation

 

P1 - Export format (required). "json" or "csv" to specify the output format.

P2 - Result variable (optional). Stores the exported data; if omitted, it’s placed on the stack.

 

Example

 

AIN.SetKey|your_api_key_here

AIN.ExportChats|csv|$$CSV

DBP.CSV Export: $$CSV

ENR.

 

Remarks

 

- Accepts 2 to 3 parameters; fewer or more will cause an error.

- Exports all chats system-wide, not just from a specific workspace.

 

Limitations

 

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

- Only supports "json" and "csv" formats; other formats will fail.

 

See also:

 

AIN.ExecuteChat

AIN.GetWorkspaceChats

AIN.ListWorkspaces

Operations