> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moorcheh.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# moorcheh answer

> Generate an AI answer via POST /answer.

## Usage

```bash theme={null}
moorcheh answer --query "What is Moorcheh?" --namespace my-documents
```

Direct LLM (no RAG) - omit `--namespace` (default is direct mode):

```bash theme={null}
moorcheh answer --query "Explain ITS scoring"
```

On **PowerShell**, `--namespace ""` often fails (empty argument). Omit the flag or use `--namespace $null`.

Default Ollama LLM from `moorcheh configure` is **`qwen2.5`** (\~7B). Use `--ai-model qwen2.5:1.5b` for the 1.5B build.

## Options

| Flag | Description |
| - | - |
| `--base-url` | API base URL (default `http://localhost:8080`) |
| `--query` | **Required.** User question |
| `--namespace` | Text namespace for RAG; default `""` (direct LLM) |
| `--top-k` | Number of chunks to retrieve |
| `--temperature` | LLM temperature (`0.0`–`2.0`) |
| `--ai-model` | Override configured LLM model |
| `--header-prompt` | System instruction |
| `--footer-prompt` | Trailing instruction |
| `--threshold` | Relevance threshold (with `--kiosk-mode`) |
| `--kiosk-mode` | Filter chunks below threshold |
| `--chat-history-json` | JSON array of prior turns |
| `--structured` | Enable default structured JSON schema |

## Examples

```bash theme={null}
# RAG over a text namespace
moorcheh answer \
  --namespace product-docs \
  --query "How do I reset my password?" \
  --top-k 5

# Direct OpenAI/Cohere/Ollama call
moorcheh answer \
  --query "Write a haiku about vector search" \
  --temperature 0.9

# Structured output
moorcheh answer \
  --namespace docs \
  --query "List key features" \
  --structured
```

## Prerequisites

* Moorcheh server running (`moorcheh up`)
* LLM configured in `~/.moorcheh/config.json` (run `moorcheh configure`)
* For Search Mode: text namespace with uploaded documents

## Related

* [API: Generate AI Answer](/on-prem/api-references/ai/generate)
* [Python: answer.generate()](/on-prem/python-client/ai/generate)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.