> ## 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.

# answer

> RAG: embed a question, search the store, and generate an answer.

## SDK - answer\_text()

Embeds the query locally, then calls **`POST /answer`**. LLM model: **`qwen2.5:0.5b-instruct`** (via Ollama on the host).

```python theme={null}
result = edge.answer_text(
    "Who won the football match?",
    top_k=5,
    threshold=0.0,
    kiosk_mode=False,
    temperature=0.2,
)
print(result["answer"])
print(result["model"])  # qwen2.5:0.5b-instruct
for src in result["sources"]:
    print(src["id"], src["score"], src.get("text"))
```

When **no passages** match the query, the server returns *I don't have enough information to answer that question.* with `context_count: 0` and does **not** call Ollama.

### Optional prompts and history

```python theme={null}
result = edge.answer_text(
    "What are your hours?",
    top_k=3,
    header_prompt="You are a helpful store assistant.",
    footer_prompt="Answer in one sentence.",
    chat_history=[
        {"role": "user", "content": "Hi"},
        {"role": "assistant", "content": "Hello! How can I help?"},
    ],
)
```

## SDK - answer() with precomputed vector

If you already have a query embedding:

```python theme={null}
vector = edge.embedder.embed_query("Who won?")
result = edge.answer("Who won?", vector, top_k=5)
```

## HTTP client

You must supply both **`query`** and **`query_vector`**:

```python theme={null}
from moorcheh_edge import MoorchehEdgeApiClient, Embedder

client = MoorchehEdgeApiClient("http://localhost:8080")
embedder = Embedder()
vector = embedder.embed_query("Who won the football match?")

result = client.answer({
    "query": "Who won the football match?",
    "query_vector": vector,
    "top_k": 5,
})
print(result["answer"])
```

## Requirements

* Store must contain uploaded documents (text or vector mode).
* Ollama must be running with **`qwen2.5:0.5b-instruct`** (use `moorcheh-edge up --with-llm` on Linux).

For token-by-token output, use [`answer_stream()`](/python-client/answer-stream) with `MoorchehEdgeApiClient`.

See [API: Answer](/api-references/answer) and [CLI: answer](/cli/answer).
