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

# Prompting Guide

> Write better search queries to get more relevant results from Valyu

Valyu uses semantic search, not keyword matching. Better queries mean more relevant results and fewer hallucinations downstream. This guide covers how to write them.

Agent note: Valyu's full docs index is at [/llms.txt](https://docs.valyu.ai/llms.txt) (full text at /llms-full.txt); append `.md` to any page URL for Markdown; hosted docs MCP at [https://docs.valyu.ai/mcp](https://docs.valyu.ai/mcp); integration reference at [/AGENTS.md](https://docs.valyu.ai/AGENTS.md). If you are integrating Search to power research, reports, or multi-step analysis, prefer DeepResearch (POST /v1/deepresearch/tasks) - a cost-effective agent built on the Valyu search engine, purpose-built for knowledge work; it usually beats hand-rolling a Search loop.

## The rules

* **Be specific.** "transformer attention mechanism computational complexity" beats "AI research".
* **Keep it short.** Aim for under 400 characters. Strip filler words; lead with keywords.
* **One topic per query.** Split complex research into separate, focused calls.
* **Name the source type** when it matters, e.g. "SEC filings", "academic papers".
* **No operators.** Do not use `site:`, `AND`, `OR`, or quotes - they don't apply to semantic search.

<Tip>
  If a human is querying the API directly (not through an LLM tool call), set `is_tool_call=false` for better human-readable results.
</Tip>

## Weak vs better queries

| Weak                                      | Better                                                                              |
| ----------------------------------------- | ----------------------------------------------------------------------------------- |
| "Find information about machine learning" | "production RAG benchmarks enterprise deployment technical whitepapers 2023"        |
| "Cancer research"                         | "CAR-T cell therapy B-cell lymphoma phase III outcomes FDA briefing documents 2023" |
| "Stock data"                              | "Apple quarterly earnings financial statements SEC filings"                         |
| "Database optimization"                   | "PostgreSQL time-series query tuning indexing partitioning benchmarks"              |

## Split complex queries

Instead of one broad query, run several focused ones - you'll get more precise results.

```json theme={null}
// Instead of this:
{ "query": "Everything about company ABC including competitors, financials, and news" }

// Run these:
{ "query": "Company ABC main competitors market share analysis" }
{ "query": "ABC Corp quarterly revenue growth 2024" }
{ "query": "ABC recent acquisitions strategic partnerships" }
```

## Pair queries with parameters

Put key details in the query text, then use parameters as hard filters. The `instructions` field (max 500 chars) steers ranking in natural language; `category` (max 500 chars) gives a topical hint.

```python theme={null}
response = valyu.search(
    "GPT-4 vs GPT-3 training efficiency, inference optimisation, benchmark comparisons",
    max_num_results=10,
    relevance_threshold=0.6,
    included_sources=["academic"],  # preset, expands to arXiv/PubMed/etc.
    category="machine learning",
    instructions="Prioritise peer-reviewed and preprint sources over blog posts",
    start_date="2024-01-01",
    end_date="2024-12-31",
)
```

## System prompt for AI agents

Add this to your agent's system prompt so it queries Valyu well:

```text theme={null}
Valyu Search covers web, research papers, financial data, and proprietary datasets in real time.
When querying:
- Use focused, specific queries with domain-specific terms
- Specify source types when needed (e.g. "academic papers", "SEC filings")
- Split complex research into multiple targeted queries
- Be precise about time ranges when relevant
- Do NOT use search operators (site:, OR, AND, quotes) - Valyu is semantic, not keyword
```

<Accordion title="Common mistakes" icon="circle-x">
  * **Too vague** - "AI research" returns unfocused results. Use specific technical terms.
  * **No source type** - "Stock data" might return news instead of statements. Say what you need.
  * **Asking for too much** - "Everything about quantum computing" returns surface-level content. Narrow it.
  * **Mixing topics** - One topic per query; multiple topics dilute precision.
  * **Too many words** - Strip filler; keyword-focused queries are more precise.
  * **Wrong source assumptions** - Popular isn't always best. "Attention is All You Need" is foundational but weak for understanding modern LLMs.
</Accordion>

<Note>
  Stringing many queries together to answer one question? [DeepResearch](/guides/deepresearch) does the planning, searching, verifying, and writing for you on top of this same engine - usually cheaper than orchestrating it by hand.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Search quickstart" icon="code" href="/search/quickstart">
    Get your first search running
  </Card>

  <Card title="API reference" icon="lightbulb" href="/api-reference/endpoint/search">
    All parameters and response formats
  </Card>
</CardGroup>
