> ## 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):

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

## 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 \
  --namespace "" \
  --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)
