AIN. - AnythingLLM AI

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

AIN. - AnythingLLM AI

AIN.Ask

Previous Top Next


MiniRobotLanguage (MRL)

 

AIN.Ask
Perform a Text Chat Completion with AnythingLLM API

 

Intention

 

Ask Command: Text-Based Chat Completion
 
AIN.Ask sends a text prompt to the AnythingLLM API (/api/chat) for a chat completion response.

Supports LLMs like LLaMA, GPT-4, or Grok, with RAG capabilities when tied to a workspace.

 

What is the Ask Command?

 

Performs text-only chat completions using the configured LLM (default: http://localhost:3001/api/chat).

Returns responses in a variable or on the stack; supports workspace-specific contexts.

 

Why Do You Need It?

 

Ideal for:

Natural Language Tasks: Q&A with models like Claude or Gemini Pro.

RAG Integration: Query workspace documents via LanceDB embeddings.

Automation: Scripted text generation workflows.

 

How to Use the Ask Command?

 

Requires AIN.SetKey; specify a prompt, optional response variable, and clipboard flag.

Default model is LLaMA unless overridden (e.g., AIN.SetModel|openai/gpt-4).

 

Example Usage

AIN.SetKey|your_api_key_here

AIN.SetModel|anthropic/claude-3-sonnet

AIN.Ask|Summarize this doc|$$RES|1

DBP.Response (on clipboard): $$RES

Summarizes a workspace document using Claude 3 Sonnet.

 

Syntax

AIN.Ask|P1[|P2][|P3]

 

Parameter Explanation

P1 - (Required) Text prompt for the LLM.

P2 - (Optional) Variable for response; defaults to stack if omitted.

P3 - (Optional) 1 to copy to clipboard; default is 0.

 

Remarks

- Workspace context requires document embeddings (e.g., via LanceDB).

- Response is JSON-parsed; use AIN.SetResponseFormat for customization.

 

Limitations

- Text-only; use AIN.AskV for images.

- Requires running AnythingLLM instance.

 

See also:

AIN.

AIN.AskV