Setup your environment

Quick Examples

Need to make your AI smarter? Let’s get some high-quality context:

from valyu import Valyu

valyu = Valyu()

# Get context about quantum computing
response = valyu.context(
    query="What are the latest developments in quantum computing?",
    search_type="all",            # Search both proprietary and web
    max_num_results=3,            # Top 3 most relevant results
    similarity_threshold=0.5,     # Minimum 50% relevance
    max_price=10                  # Maximum price per thousand queries (CPM)
)

# Process the enriched context
for result in response.results:
    print(f"Source: {result.source}")
    print(f"Relevance: {result.relevance_score}")
    print(f"Content: {result.content[:200]}...")  # First 200 chars
    print("---")

Financial Market Data Magic

Want financial data? Just ask in plain English - we’ll figure it out:

response = valyu.context(
    query="Price of TSLA for the last 5 days",
    search_type="proprietary",
    max_num_results=1,
    max_price=10                  # Maximum price per thousand queries (CPM)
)

# The response includes structured JSON data
print(response.results[0].content)

Response looks like this:

{
    "success": true,
    "error": "",
    "tx_id": "tx_6a2568cf-a3f4-4860-9b6e-96b35e398b7f",
    "query": "Price of TSLA today?",
    "results": [
        {
            "title": "Tesla Inc (TSLA) Stock Price",
            "content": "{\"ticker\": \"TSLA\", \"price\": \"288.1400\", \"timestamp\": \"2025-03-25\", \"is_weekend\": false}",
            "source": "valyu/valyu-stocks-US",
            "data_type": "structured",
            "relevance_score": 1
        }
    ],
    "results_by_source": {
        "proprietary": 1,
        "web": 0
    }
}

Our natural language processing is so good, it even understands queries like ”$$$$$ of larry and Sergey brins companie. on fr week commencing 5th hune on the 21st century” 🤯

(Yes, that means “Google stock price for Friday June 5th, 2021” - we’re that good!)

Advanced Features

Deep Research

Search across proprietary academic papers, financial data, and more with search_type="proprietary"

Web Intelligence

Get smart web search results that are actually relevant with search_type="web"

Cost Control

Set max_price to control costs per thousand queries (CPM). Only pay for what you use!

Quality Filtering

Use similarity_threshold to ensure only relevant results

Next Steps