---
title: "Ask and Steer — Context Infrastructure"
description: "Search and prompt your own model, or let Alchemyst search and answer."
canonical: "https://press.getalchemystai.com/books/context-infrastructure-build-ai-that-understands-your-business/ask-and-steer"
last_updated: "2018-10-20"
book: "Context Infrastructure"
label: "Chapter 10"
---

# Ask and Steer

Retrieval has two modes: get the context and prompt your own model (search), or let Alchemyst search and answer in one call (steer). Both use the same scoping rules.

## Search parameters

| Parameter | Where | What it does |
| --- | --- | --- |
| `query` | body | The question, in natural language. Strip noise (stray symbols, emoji, filler) before sending |
| `minimum_similarity_threshold` | body | Lower bound of the similarity band; 0.5 is a sensible start |
| `similarity_threshold` | body | Upper bound; must be at least the minimum |
| `scope` | body | `internal` (default) or `external` |
| `body_metadata` | body | Filters such as `groupName`, `fileName`, `lastModifiedAt` |
| `mode` | query string | `fast` favours speed; `standard` (default) is comprehensive |
| `metadata` | query string | `true` returns each result's metadata; off by default for speed |

Two habits pay off immediately. Call search as a **tool or function** from your agent so the model writes a clean, focused query instead of passing the user's raw message. And keep `groupName` filters to five tags or fewer; seven or more adds noticeable overhead.

## The Steering API: search plus a grounded answer

`POST /api/v1/context/search/steer` runs a context search, joins the matching chunks, and asks an LLM to answer the query from that context alone. An optional `steeringPrompt` shapes the output, from "answer in one sentence" to a strict JSON schema.

```ts
const res = await fetch(
  'https://platform-backend.getalchemystai.com/api/v1/context/search/steer?mode=standard&context=true',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${process.env.ALCHEMYST_AI_API_KEY}`,
    },
    body: JSON.stringify({
      query: 'What is the status of the Mumbai warehouse lease?',
      minimum_similarity_threshold: 0.5,
      similarity_threshold: 0.9,
      scope: 'internal',
      body_metadata: { groupName: ['ops', 'facilities'] },
      steeringPrompt: 'Return JSON with the fields "status", "owner" and "next_step".',
    }),
  },
);

const { answer, model, usage, context } = await res.json();
```

The response carries `answer`, the `model` used and token `usage` (input, output, total). With `context=true` it also returns the joined context that grounded the answer, which is what you log for audit or show as citations.

---

- Previous: [Chapter 9: Memory](https://press.getalchemystai.com/books/context-infrastructure-build-ai-that-understands-your-business/memory.md)
- Contents: [Context Infrastructure](https://press.getalchemystai.com/books/context-infrastructure-build-ai-that-understands-your-business.md)
- Next: [Chapter 11: Plug In](https://press.getalchemystai.com/books/context-infrastructure-build-ai-that-understands-your-business/plug-in.md)
