Skip to main content
This guide shows you how to write search queries that get the best results from Valyu’s DeepSearch API.

Setting Up Your AI Agent

System Prompt Configuration

Add this to your AI agent’s system prompt:
Valyu DeepSearch searches web content, research papers, financial data, and proprietary datasets in real time.
When querying the Valyu API:
- Use focused, specific queries
- Include domain-specific terms and technical keywords  
- 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

Why Good Queries Matter

Better queries mean better results. When your AI agent sends precise search queries to Valyu, it gets back more relevant information, which means fewer hallucinations and more accurate responses.

What Makes a Good Query

A good search query has four parts:
ComponentWhat it doesExample
IntentThe specific knowledge you need”LLM transformer efficiency optimisations”
Source TypeWhich data sources to prioritise”{author} {document name}“
ConstraintsFilters that improve relevance”production-ready solutions”
Time RangeThe time period results should cover”2022-2024”, “last 6 months”, “after 2021”
Tip: If you don’t want to write prompts yourself, set tool_call_mode=false in the API parameters. But for the best results, keep reading.

Writing Better Queries

Keep It Short

Queries work best when they’re under 400 characters. Short, focused phrasing beats long, rambling prompts. ❌ Too long (450+ characters): “I need comprehensive information about the latest developments in artificial intelligence and machine learning technologies, particularly focusing on large language models, their training methodologies, performance benchmarks, computational requirements, and how they compare to previous generations of AI systems in terms of accuracy and efficiency” ✅ Better (under 400 characters): “LLM training methodologies performance benchmarks computational requirements vs previous AI systems”

Split Complex Queries

If you’re researching something complex, break it into separate queries. You’ll get more precise results. Instead of one broad query:
{
  "query": "Tell me everything about company ABC including competitors, financials, recent news, and industry trends"
}
Use focused queries:
{
  "query": "Company ABC main competitors market share analysis"
}
{
  "query": "ABC Corp quarterly revenue growth 2024"
}
{
  "query": "ABC recent acquisitions strategic partnerships"
}
{
  "query": "Industry trends affecting ABC business model"
}
Running several focused queries often gives better results than one broad query.

Common Mistakes

Being Too Vague

❌ “AI research” ✅ “transformer attention mechanism computational complexity analysis” Vague queries return unfocused results. Specific terms help Valyu find exactly what you need.

Not Specifying Source Type

❌ “Stock data” ✅ “Apple quarterly earnings financial statements SEC filings” Without context, Valyu might return news articles when you want financial statements. Be explicit about what type of content you need.

Asking for Too Much

❌ “Everything about quantum computing” ✅ “quantum error correction surface codes implementation” Broad queries return surface-level content. Narrow your focus to get deeper, more relevant results.

Mixing Multiple Topics

❌ “Explain causes of high inflation rates, and also tell me about cryptocurrency market trends” ✅ “Federal Reserve interest rate policy impact on inflation 2023-2024” One topic per query. Multiple topics dilute the search and reduce precision.

Using Too Many Words

❌ “Explain concepts on how bioinformatics works by helix” ✅ “DNA helix structure bioinformatics sequence analysis” Strip out unnecessary words. Keyword-focused queries are more precise.

Quick Reference

Weak QueryBetter Query
”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"
"Recent studies on psychology""CBT efficacy treatment-resistant adolescent depression meta-analysis peer-reviewed journals 2020-2024"
"Database optimization""PostgreSQL time-series query tuning indexing partitioning official documentation benchmarks”
If a user is querying the Valyu API directly (not through an LLM tool call), set tool_call_mode=false for better results.

Using Search Parameters

Combine good queries with Valyu’s search parameters to narrow your results further:
response = valyu.search(
    "GPT-4 vs GPT-3 architectural innovations: training efficiency, inference optimisation, and benchmark comparisons",
    search_type="proprietary",
    max_num_results=10,
    relevance_threshold=0.6,
    included_sources=["valyu/valyu-arxiv"],
    max_price=50.0,
    category="machine learning",
    start_date="2024-01-01",
    end_date="2024-12-31"
)
Include the key details in your query text, then use parameters as hard filters.
Use included_sources to access datasets that other search APIs can’t reach—like valyu/valyu-arxiv for academic papers or financial market data.

Things to Avoid

  1. Wasting tokens: Keep prompts focused on what your LLM actually needs
  2. Vague queries: Define technical terms and expand acronyms
  3. Skipping filters: Use relevance thresholds and source controls
  4. Ignoring costs: Balance max_price with the quality you need
  5. Wrong source assumptions: Popular sources aren’t always the best for learning, “Attention is All You Need” is foundational but not great for understanding modern LLMs

Next Steps

Get Help

Need assistance? We’re here to help:
The best prompts combine your domain knowledge with Valyu’s search controls. Start with these patterns, then adjust based on what works for your use case.