Search across Valyu’s comprehensive knowledge base including web content, academic journals, financial data, and proprietary datasets. The DeepSearch API returns AI ready search results that are perfect for RAG pipelines, AI agents, and applications.

Why Use the DeepSearch API

The DeepSearch API provides AI ready search results that enable:
  • Comprehensive Coverage - Search web, research journals, books, and live financial data
  • Real-Time Results - Access up-to-the-minute information from sources
  • Precise Filtering - Control sources, dates, relevance scores, and result count
  • RAG-Ready - Perfect for Retrieval-Augmented Generation and AI agent workflows

Key DeepSearch Features

Multi-Source Search

Search web content alongside research papers, books, and financial market data in one API call.

AI Ready

Get AI ready search results that can you pass directly to your AI’s context window.

Source Control

Include or exclude specific domains, URLs, and datasets to focus on authoritative sources.

Date Filtering

Filter results by publication date to get recent or historical content.

Getting Started

Basic Search Query

Search across all available sources with a simple query:
from valyu import Valyu

valyu = Valyu() # Uses VALYU_API_KEY from env

response = valyu.search(
query="latest developments in quantum computing",
max_num_results=5,
search_type="all",
)

for result in response["results"]:
print(f"Title: {result['title']}")
print(f"URL: {result['url']}")
print(f"Source: {result['source_type']}")
print(f"Content: {result['content'][:200]}...")
print("---")

Fast Mode for Reduced Latency

Enable fast mode for quicker search speed but shorter results. Best for general purpose queries:
from valyu import Valyu

valyu = Valyu()

# Fast mode search for reduced latency

response = valyu.search(
query="latest market trends in tech stocks",
fast_mode=True, # Enable fast mode
max_num_results=5,
search_type="all",
)

for result in response["results"]:
print(f"Title: {result['title']}")
print(f"Source: {result['source_type']}")
print(f"Content: {result['content'][:200]}...")
print("---")

This returns raw search results with metadata, relevance scores, and full content for each match.

Search Type Options

Control which data sources to search:
TypeDescriptionBest For
allSearch web and proprietary sources (default)Comprehensive coverage
webWeb search onlyCurrent events, general topics
proprietaryResearch, financial, and premium sources onlyResearch, technical analysis

Advanced Features

AI Agent vs User Queries

Optimize retrieval based on the caller type:
from valyu import Valyu

valyu = Valyu()

# AI agent making a tool call

agent_response = valyu.search(
query="latest AI research papers",
is_tool_call=True, # Optimized for AI processing
max_num_results=10,
)

# Direct user query

user_response = valyu.search(
query="explain quantum computing basics",
is_tool_call=False, # Optimized for human consumption
max_num_results=5,
)

Response Length Control

Control how much content is returned per result:
from valyu import Valyu

valyu = Valyu()

# Short snippets for quick overview

response = valyu.search(
query="renewable energy trends",
response_length="short", # ~25k characters per result
max_num_results=10,
)

# Full content for detailed analysis

response = valyu.search(
query="financial market analysis",
response_length="max", # Full content
max_num_results=3,
)

# Custom character limit

response = valyu.search(
query="technical documentation",
response_length=5000, # Exactly 5000 characters
max_num_results=5,
)

Response Length Options:
  • "short": ~25,000 characters per result
  • "medium": ~50,000 characters per result
  • "large": ~100,000 characters per result
  • "max": Full content available
  • Custom integer: Exact character count

Advanced Feature Guides

Check out our guides for other advanced features:

Response Format

Standard Search Response

{
  "success": true,
  "error": "",
  "tx_id": "tx_12345678-1234-1234-1234-123456789abc",
  "query": "latest developments in quantum computing",
  "results": [
    {
      "title": "Quantum Computing Breakthrough: New Error Correction Method",
      "url": "https://nature.com/articles/quantum-error-correction-2024?utm_source=valyu",
      "content": "Researchers at MIT have developed a revolutionary quantum error correction method that reduces error rates by 90% while maintaining computational speed. This breakthrough addresses one of the fundamental challenges in scaling quantum computers...",
      "description": "Major breakthrough in quantum error correction methodology",
      "source": "academic",
      "price": 0.005,
      "length": 15420,
      "data_type": "unstructured",
      "source_type": "paper",
      "publication_date": "2024-03-15",
      "id": "https://nature.com/articles/quantum-error-correction-2024",
      "image_url": {
        "main": "https://nature.com/quantum-diagram.jpg"
      },
      "relevance_score": 0.94
    },
    {
      "title": "IBM Announces 1000-Qubit Quantum Processor",
      "url": "https://techcrunch.com/2024/05/12/ibm-quantum-1000-qubit?utm_source=valyu",
      "content": "IBM has unveiled its latest quantum processor featuring over 1000 qubits, marking a significant milestone in quantum computing hardware development. The new processor, called Condor, demonstrates improved coherence times and reduced error rates...",
      "description": "IBM's latest quantum hardware milestone announcement",
      "source": "web",
      "price": 0.003,
      "length": 8950,
      "data_type": "unstructured",
      "source_type": "website",
      "publication_date": "2024-05-12",
      "id": "https://techcrunch.com/2024/05/12/ibm-quantum-1000-qubit",
      "image_url": {
        "main": "https://techcrunch.com/ibm-quantum-chip.jpg"
      },
      "relevance_score": 0.87
    }
  ],
  "results_by_source": {
    "academic": 1,
    "web": 1
  },
  "total_results": 25,
  "total_cost_dollars": 0.008,
  "total_characters": 24370
}

Top-level fields

FieldDescription
successIndicates whether the search completed successfully
errorEmpty string on success; populated when warnings or errors occur
tx_idUnique transaction identifier for tracing and support
queryThe processed search query
resultsRanked array of result objects
results_by_sourceCount of results returned per source type
total_resultsTotal number of matches available for the query
total_cost_dollarsTotal cost of the request in USD
total_charactersCombined character count across all returned results
fast_modePresent when the query ran in fast mode (omitted otherwise)

Result fields

FieldDescription
titleTitle of the document or article
urlCanonical URL for the result (tracking parameters may be appended)
contentExtracted text content, trimmed according to the response_length
descriptionHigh-level summary of the result
sourceHigh-level source category such as web or academic
priceCost in USD attributed to this individual result
lengthCharacter count returned for this result
data_typeData modality for the result (for example unstructured)
source_typeSpecific source classification (see Source types)
publication_dateISO 8601 publication date when available
idStable identifier or canonical reference for the result
image_urlImages extracted from the page
relevance_scoreRanking score between 0 and 1 indicating result relevance

Source types

TypeDatasetsDescription
generalvalyu-wikipedia and similar general-reference corporaGeneral knowledge indexes (e.g., Wikipedia) served from LanceDB
websiteBrave web search pipeline (fast + full), Spider scraper fallback, LinkedIn processorGeneral web articles extracted or scraped by the web processing stack
forumBrave QA hits handled by the web processorCommunity Q&A snippets surfaced when Brave supplies QA payloads
papervalyu/valyu-arxiv and other academic research indexesAcademic paper corpora (ArXiv, etc.) routed through the academic server
dataFinance server market data integrations (quotes, FX, fundamentals, etc.)Structured market metrics and analytics returned by the finance search pipeline
reportvalyu/valyu-sec-filings (SEC filings service)Regulatory filing documents returned from the SEC microservice
health_dataWHO Global Health Observatory ingestionGlobal health indicator records delivered by the WHO handler
clinical_trialvalyu/valyu-clinical-trials (ClinicalTrials.gov)Structured clinical-study summaries produced by the clinical trials handler
drug_labelvalyu/valyu-drug-labels (FDA DailyMed)Drug labeling content (warnings, dosing, contraindications) processed by the DailyMed handler
grantsNIH RePORTER grants ingestionNIH funding project data generated by the NIH handler

Best Practices

  1. Be Specific: Use detailed queries for better search results
  2. Set Appropriate Price Limits: Balance cost with data quality needs
  3. Filter Results: Use parameters to get only the most relevant content
  4. Choose the Right Search Type: Match search_type to your use case
  5. Monitor Costs: Track price_per_result and total_cost_dollars in responses
  6. Optimize for Tool Calls: Set is_tool_call=true for AI agent usage
For detailed guidance on optimizing your searches, see our Tips & Tricks guide and Prompting Guide.

Error Handling

from valyu import Valyu

valyu = Valyu()

try:
    response = valyu.search(
        query="quantum computing applications",
        max_num_results=10,
        search_type="all",
    )

    if response.get("success"):
        for result in response["results"]:
            print(f"Found: {result['title']}")
            print(f"Source: {result['source_type']}")
    else:
        print(f"Search failed: {response.get('error', 'Unknown error')}")

except Exception as e:
    print(f"Request failed: {e}")

Try the DeepSearch API

Explore the complete API reference with interactive examples and detailed parameter documentation.

Next Steps