valyu-best-practices

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Valyu Best Practices

Valyu 最佳实践

This skill provides instructions for using the Valyu API to perform search, content extraction, AI-powered answers, and deep research tasks.
本工具提供了使用Valyu API执行搜索、内容提取、AI生成答案及深度研究任务的操作指南。

Quick Reference: Choosing the Right API

快速参考:选择合适的API

Use this decision tree to select the appropriate Valyu API:
What do you need?

├─ Find information across multiple sources
│  └─ Use Search API
├─ Extract content from specific URLs
│  └─ Use Contents API
├─ Get an AI-synthesized answer with citations
│  └─ Use Answer API
├─ Generate a comprehensive research report
│  └─ Use DeepResearch API
└─ Discover available data sources
   └─ Use Datasources API

使用以下决策树来选择对应的Valyu API:
你需要什么?

├─ 跨多数据源查找信息
│  └─ 使用Search API
├─ 从特定URL提取内容
│  └─ 使用Contents API
├─ 获取带引用的AI合成答案
│  └─ 使用Answer API
├─ 生成综合性研究报告
│  └─ 使用DeepResearch API
└─ 发现可用数据源
   └─ 使用Datasources API

⚠️ MANDATORY: Use Official Valyu SDK Libraries

⚠️ 强制要求:使用官方Valyu SDK库

CRITICAL: When writing code that uses the Valyu API, you MUST use the official SDK libraries. NEVER make raw HTTP/fetch calls to the Valyu API endpoints.
重要提示:编写调用Valyu API的代码时,必须使用官方SDK库。绝对不要直接对Valyu API端点发起原始HTTP/fetch请求。

JavaScript/TypeScript:
valyu-js

JavaScript/TypeScript:
valyu-js

bash
npm install valyu-js
bash
npm install valyu-js

or

pnpm add valyu-js

```typescript
import { Valyu } from 'valyu-js';

const valyu = new Valyu(process.env.VALYU_API_KEY);

// Now use valyu.search(), valyu.contents(), valyu.answer(), valyu.deepResearch
pnpm add valyu-js

```typescript
import { Valyu } from 'valyu-js';

const valyu = new Valyu(process.env.VALYU_API_KEY);

// 现在可以使用valyu.search(), valyu.contents(), valyu.answer(), valyu.deepResearch

Python:
valyu

Python:
valyu

bash
pip install valyu
bash
pip install valyu

or

uv add valyu

```python
from valyu import Valyu

valyu = Valyu(api_key=os.environ.get("VALYU_API_KEY"))
uv add valyu

```python
from valyu import Valyu

valyu = Valyu(api_key=os.environ.get("VALYU_API_KEY"))

Now use valyu.search(), valyu.contents(), valyu.answer(), valyu.deep_research

现在可以使用valyu.search(), valyu.contents(), valyu.answer(), valyu.deep_research

undefined
undefined

Why SDK Over Raw API Calls?

为什么选择SDK而非原始API调用?

  1. Type safety - Full TypeScript/Python type hints for all parameters and responses
  2. Automatic retries - Built-in retry logic for transient failures
  3. Streaming support - Proper async iterator support for streaming responses
  4. Error handling - Structured error types with helpful messages
  5. Future compatibility - SDK updates handle API changes automatically
  1. 类型安全 - 为所有参数和响应提供完整的TypeScript/Python类型提示
  2. 自动重试 - 内置针对临时故障的重试逻辑
  3. 流式支持 - 为流式响应提供完善的异步迭代器支持
  4. 错误处理 - 带有实用提示信息的结构化错误类型
  5. 未来兼容性 - SDK更新会自动处理API变更

❌ NEVER Do This

❌ 绝对不要这么做

typescript
// DON'T make raw fetch calls
const response = await fetch('https://api.valyu.ai/v1/search', {
  method: 'POST',
  headers: {
    'x-api-key': apiKey,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ query: '...' })
});
typescript
// 不要发起原始fetch请求
const response = await fetch('https://api.valyu.ai/v1/search', {
  method: 'POST',
  headers: {
    'x-api-key': apiKey,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ query: '...' })
});

✅ Always Do This

✅ 正确的做法

typescript
// DO use the SDK
import { Valyu } from 'valyu-js';

const valyu = new Valyu(process.env.VALYU_API_KEY);
const response = await valyu.search({ query: '...' });

typescript
// 务必使用SDK
import { Valyu } from 'valyu-js';

const valyu = new Valyu(process.env.VALYU_API_KEY);
const response = await valyu.search({ query: '...' });

1. Search API

1. Search API

Purpose: Find information across web, academic, medical, transportation, financial, news, and proprietary sources.
用途: 跨网页、学术、医疗、交通、金融、新闻及专有数据源查找信息。

When to Use

使用场景

  • Finding recent information on any topic
  • Academic research (arXiv, PubMed, bioRxiv, medRxiv)
  • Financial data (SEC filings, earnings reports, stock data)
  • News monitoring and current events
  • Healthcare data (clinical trials, drug labels)
  • Prediction markets (Polymarket, Kalshi)
  • Transportation (UK National Rail, Global Shipping)
  • 查找任意主题的最新信息
  • 学术研究(arXiv、PubMed、bioRxiv、medRxiv)
  • 金融数据(SEC文件、收益报告、股票数据)
  • 新闻监测与时事追踪
  • 医疗健康数据(临床试验、药品说明书)
  • 预测市场(Polymarket、Kalshi)
  • 交通数据(英国国家铁路、全球航运)

Basic Usage

基础用法

typescript
const response = await valyu.search({
  query: "transformer architecture attention mechanism 2024",
  searchType: "all",
  maxNumResults: 10
});
typescript
const response = await valyu.search({
  query: "transformer architecture attention mechanism 2024",
  searchType: "all",
  maxNumResults: 10
});

Search Types

搜索类型

TypeUse For
all
Everything - web, academic, financial, proprietary
web
General internet content only
proprietary
Licensed academic papers and research
news
News articles and current events
类型适用场景
all
所有数据源 - 网页、学术、金融、专有
web
仅通用互联网内容
proprietary
授权学术论文与研究资料
news
新闻文章与时事内容

Key Parameters

关键参数

Parameter (TS/JS)Parameter (Python)PurposeExample
query
query
Search query (under 400 chars)
"CRISPR gene editing 2024"
searchType
search_type
Source scope
"all"
,
"web"
,
"proprietary"
,
"news"
maxNumResults
max_num_results
Number of results (1-20)
10
includedSources
included_sources
Limit to specific sources
["valyu/valyu-arxiv", "valyu/valyu-pubmed"]
startDate
/
endDate
start_date
/
end_date
Date filtering
"2024-01-01"
relevanceThreshold
relevance_threshold
Minimum relevance (0-1)
0.7
参数(TS/JS)参数(Python)用途示例
query
query
搜索查询(不超过400字符)
"CRISPR gene editing 2024"
searchType
search_type
数据源范围
"all"
,
"web"
,
"proprietary"
,
"news"
maxNumResults
max_num_results
结果数量(1-20)
10
includedSources
included_sources
限定特定数据源
["valyu/valyu-arxiv", "valyu/valyu-pubmed"]
startDate
/
endDate
start_date
/
end_date
日期过滤
"2024-01-01"
relevanceThreshold
relevance_threshold
最低相关度(0-1)
0.7

Domain-Specific Search Patterns

特定领域搜索模式

Academic Research:
typescript
await valyu.search({
  query: "CRISPR therapeutic applications clinical trials",
  searchType: "proprietary",
  includedSources: ["valyu/valyu-arxiv", "valyu/valyu-pubmed", "valyu/valyu-biorxiv"],
  startDate: "2024-01-01"
});
Financial Analysis:
typescript
await valyu.search({
  query: "Apple revenue Q4 2024 earnings",
  searchType: "all",
  includedSources: ["valyu/valyu-sec-filings", "valyu/valyu-earnings-US"]
});
News Monitoring:
typescript
await valyu.search({
  query: "AI regulation EU",
  searchType: "news",
  startDate: "2024-06-01",
  countryCode: "EU"
});
学术研究:
typescript
await valyu.search({
  query: "CRISPR therapeutic applications clinical trials",
  searchType: "proprietary",
  includedSources: ["valyu/valyu-arxiv", "valyu/valyu-pubmed", "valyu/valyu-biorxiv"],
  startDate: "2024-01-01"
});
金融分析:
typescript
await valyu.search({
  query: "Apple revenue Q4 2024 earnings",
  searchType: "all",
  includedSources: ["valyu/valyu-sec-filings", "valyu/valyu-earnings-US"]
});
新闻监测:
typescript
await valyu.search({
  query: "AI regulation EU",
  searchType: "news",
  startDate: "2024-06-01",
  countryCode: "EU"
});

Search Recipes

搜索示例

For detailed patterns, see:
  • Basic Search Patterns
  • Academic Search
  • Finance Search
  • News Search
  • Healthcare Search

如需详细模式,请查看:
  • 基础搜索模式
  • 学术搜索
  • 金融搜索
  • 新闻搜索
  • 医疗健康搜索

2. Contents API

2. Contents API

Purpose: Extract clean, structured content from web pages optimized for LLM processing.
用途: 从网页提取干净、结构化的内容,优化LLM处理效果。

When to Use

使用场景

  • Converting web pages to clean markdown
  • Extracting article text for summarization
  • Parsing documentation for RAG systems
  • Structured data extraction from product pages
  • Processing academic papers
  • 将网页转换为简洁的Markdown格式
  • 提取文章文本用于摘要生成
  • 解析文档以构建RAG系统
  • 从产品页面提取结构化数据
  • 处理学术论文

Basic Usage

基础用法

typescript
const response = await valyu.contents({
  urls: ["https://example.com/article"]
});
typescript
const response = await valyu.contents({
  urls: ["https://example.com/article"]
});

With Summarization

带摘要功能

typescript
const response = await valyu.contents({
  urls: ["https://arxiv.org/abs/2401.12345"],
  summary: "Extract key findings in 3 bullet points"
});
typescript
const response = await valyu.contents({
  urls: ["https://arxiv.org/abs/2401.12345"],
  summary: "Extract key findings in 3 bullet points"
});

Structured Extraction (JSON Schema)

结构化提取(JSON Schema)

typescript
const response = await valyu.contents({
  urls: ["https://example.com/product"],
  summary: {
    type: "object",
    properties: {
      product_name: { type: "string" },
      price: { type: "number" },
      features: { type: "array", items: { type: "string" } }
    },
    required: ["product_name", "price"]
  }
});
typescript
const response = await valyu.contents({
  urls: ["https://example.com/product"],
  summary: {
    type: "object",
    properties: {
      product_name: { type: "string" },
      price: { type: "number" },
      features: { type: "array", items: { type: "string" } }
    },
    required: ["product_name", "price"]
  }
});

Key Parameters

关键参数

Parameter (TS/JS)Parameter (Python)PurposeExample
urls
urls
URLs to process (1-10)
["https://example.com"]
responseLength
response_length
Content length
"short"
,
"medium"
,
"large"
,
"max"
extractEffort
extract_effort
Extraction quality
"normal"
,
"high"
,
"auto"
summary
summary
AI summarization
true
,
"instructions"
, or JSON schema
screenshot
screenshot
Capture screenshots
true
参数(TS/JS)参数(Python)用途示例
urls
urls
待处理的URL(1-10个)
["https://example.com"]
responseLength
response_length
内容长度
"short"
,
"medium"
,
"large"
,
"max"
extractEffort
extract_effort
提取质量
"normal"
,
"high"
,
"auto"
summary
summary
AI摘要
true
,
"instructions"
, 或JSON Schema
screenshot
screenshot
捕获截图
true

Content Recipes

内容提取示例

For detailed patterns, see:
  • Basic Content Extraction
  • Extraction with Summary
  • Structured Extraction
  • Research Paper Extraction

如需详细模式,请查看:
  • 基础内容提取
  • 【带摘要的内容提取】(references/content-recipes/basic-content-extraction-from-web-with-summary.md)
  • 结构化内容提取
  • 研究论文提取

3. Answer API

3. Answer API

Purpose: Get AI-powered answers grounded in real-time search results with citations.
用途: 获取基于实时搜索结果的AI生成答案,并附带引用来源。

When to Use

使用场景

  • Questions requiring current information synthesis
  • Multi-source fact verification
  • Technical documentation questions
  • Research requiring cited sources
  • Structured data extraction from search results
  • 需要综合当前信息的问题
  • 多来源事实核查
  • 技术文档相关问题
  • 需要引用来源的研究
  • 从搜索结果中提取结构化数据

Basic Usage

基础用法

typescript
const response = await valyu.answer({
  query: "What are the latest developments in quantum computing?"
});
typescript
const response = await valyu.answer({
  query: "What are the latest developments in quantum computing?"
});

With Fast Mode (Lower Latency)

快速模式(低延迟)

typescript
const response = await valyu.answer({
  query: "Current Bitcoin price and 24h change",
  fastMode: true
});
typescript
const response = await valyu.answer({
  query: "Current Bitcoin price and 24h change",
  fastMode: true
});

With Custom Instructions

自定义指令

typescript
const response = await valyu.answer({
  query: "Compare React and Vue for enterprise applications",
  systemInstructions: "Provide a balanced comparison with pros and cons. Format as a comparison table."
});
typescript
const response = await valyu.answer({
  query: "Compare React and Vue for enterprise applications",
  systemInstructions: "Provide a balanced comparison with pros and cons. Format as a comparison table."
});

With Streaming

流式输出

typescript
const stream = await valyu.answer({
  query: "Explain transformer architecture",
  streaming: true
});

for await (const chunk of stream) {
  // Handle: search_results, content, metadata, done, error
  console.log(chunk);
}
typescript
const stream = await valyu.answer({
  query: "Explain transformer architecture",
  streaming: true
});

for await (const chunk of stream) {
  // 处理:search_results, content, metadata, done, error
  console.log(chunk);
}

Structured Output

结构化输出

typescript
const response = await valyu.answer({
  query: "Apple Q4 2024 financial highlights",
  structuredOutput: {
    type: "object",
    properties: {
      revenue: { type: "string" },
      growthRate: { type: "string" },
      keyHighlights: { type: "array", items: { type: "string" } }
    }
  }
});
typescript
const response = await valyu.answer({
  query: "Apple Q4 2024 financial highlights",
  structuredOutput: {
    type: "object",
    properties: {
      revenue: { type: "string" },
      growthRate: { type: "string" },
      keyHighlights: { type: "array", items: { type: "string" } }
    }
  }
});

Key Parameters

关键参数

Parameter (TS/JS)Parameter (Python)PurposeExample
query
query
Question to answer
"What is quantum computing?"
fastMode
fast_mode
Lower latency
true
systemInstructions
system_instructions
AI directives
"Be concise"
structuredOutput
structured_output
JSON schema
{type: "object", ...}
streaming
streaming
Enable SSE streaming
true
dataMaxPrice
data_max_price
Dollar limit
1.0
参数(TS/JS)参数(Python)用途示例
query
query
待回答的问题
"What is quantum computing?"
fastMode
fast_mode
低延迟模式
true
systemInstructions
system_instructions
AI指令
"Be concise"
structuredOutput
structured_output
JSON Schema
{type: "object", ...}
streaming
streaming
启用SSE流式输出
true
dataMaxPrice
data_max_price
费用上限(美元)
1.0

Answer Recipes

答案生成示例

For detailed patterns, see:
  • Basic Answer
  • Fast Mode
  • Streaming
  • Custom Instructions

如需详细模式,请查看:
  • 基础答案生成
  • 快速模式
  • 流式输出
  • 自定义指令

4. DeepResearch API

4. DeepResearch API

Purpose: Generate comprehensive research reports with detailed analysis and citations.
用途: 生成包含详细分析与引用来源的综合性研究报告。

When to Use

使用场景

  • Comprehensive market analysis
  • Literature reviews
  • Competitive intelligence
  • Technical deep dives
  • Topics requiring multi-source synthesis
  • 综合性市场分析
  • 文献综述
  • 竞争情报
  • 技术深度解析
  • 需要多来源综合的主题

Research Modes

研究模式

ModeDurationBest For
fast
~5 minutesQuick lookups, simple questions
standard
~10-20 minutesBalanced research (most common)
heavy
~90 minutesComprehensive analysis, complex topics
模式耗时最佳适用场景
fast
~5分钟快速查询、简单问题
standard
~10-20分钟均衡性研究(最常用)
heavy
~90分钟综合性分析、复杂主题

Create Research Task

创建研究任务

typescript
const task = await valyu.deepResearch.create({
  query: "AI chip market competitive landscape 2024",
  model: "standard"
});
// Returns: { deepresearch_id: "abc123", status: "queued" }
typescript
const task = await valyu.deepResearch.create({
  query: "AI chip market competitive landscape 2024",
  model: "standard"
});
// 返回:{ deepresearch_id: "abc123", status: "queued" }

Poll for Completion

查询任务完成状态

typescript
const status = await valyu.deepResearch.getStatus(task.deepresearch_id);
// status: "queued" | "running" | "completed" | "failed" | "cancelled"

if (status.status === "completed") {
  console.log(status.output);  // Markdown report
  console.log(status.sources); // Cited sources
  console.log(status.pdf_url); // PDF download link
}
typescript
const status = await valyu.deepResearch.getStatus(task.deepresearch_id);
// 状态:"queued" | "running" | "completed" | "failed" | "cancelled"

if (status.status === "completed") {
  console.log(status.output);  // Markdown报告
  console.log(status.sources); // 引用来源
  console.log(status.pdf_url); // PDF下载链接
}

Key Parameters

关键参数

Parameter (TS/JS)Parameter (Python)PurposeExample
query
query
Research question
"AI market trends 2024"
model
model
Research depth
"fast"
,
"standard"
,
"heavy"
outputFormat
output_format
Report format
"markdown"
,
"pdf"
includedSources
included_sources
Source filtering
["valyu/valyu-arxiv", "techcrunch.com"]
startDate
/
endDate
start_date
/
end_date
Date range
"2024-01-01"
参数(TS/JS)参数(Python)用途示例
query
query
研究问题
"AI market trends 2024"
model
model
研究深度
"fast"
,
"standard"
,
"heavy"
outputFormat
output_format
报告格式
"markdown"
,
"pdf"
includedSources
included_sources
数据源过滤
["valyu/valyu-arxiv", "techcrunch.com"]
startDate
/
endDate
start_date
/
end_date
日期范围
"2024-01-01"

DeepResearch Recipes

深度研究示例

For detailed patterns, see:
  • Fast Research
  • Standard Research
  • Heavy Research

如需详细模式,请查看:
  • 快速研究
  • 标准研究
  • 深度研究

5. Query Writing Best Practices

5. 查询编写最佳实践

Core Principles

核心原则

  1. Be specific - Use domain terminology
  2. Be concise - Keep queries under 400 characters
  3. Be focused - One topic per query
  4. Add constraints - Include timeframes, source types
  1. 具体明确 - 使用领域术语
  2. 简洁精炼 - 查询不超过400字符
  3. 聚焦主题 - 每个查询对应一个主题
  4. 添加约束 - 包含时间范围、数据源类型

Query Anatomy

查询结构

ElementDescriptionExample
IntentWhat you need"latest advancements" vs "overview"
DomainTopic terminology"transformer architecture"
ConstraintsFilters"2024", "peer-reviewed"
Source typeWhere to lookacademic papers, SEC filings
元素说明示例
意图你的需求"latest advancements" vs "overview"
领域主题术语"transformer architecture"
约束条件过滤条件"2024", "peer-reviewed"
数据源类型查找范围学术论文、SEC文件

Good vs Bad Queries

优质与劣质查询对比

BAD:  "I want to know about AI"
GOOD: "transformer attention mechanism survey 2024"

BAD:  "Apple financial information"
GOOD: "Apple revenue growth Q4 2024 earnings SEC filing"

BAD:  "gene editing research"
GOOD: "CRISPR off-target effects therapeutic applications 2024"
劣质:  "I want to know about AI"
优质: "transformer attention mechanism survey 2024"

劣质:  "Apple financial information"
优质: "Apple revenue growth Q4 2024 earnings SEC filing"

劣质:  "gene editing research"
优质: "CRISPR off-target effects therapeutic applications 2024"

Split Complex Requests

拆分复杂请求

undefined
undefined

Don't do this

不要这样做

"Tesla stock performance, new products, and Elon Musk statements"
"Tesla stock performance, new products, and Elon Musk statements"

Do this instead

应该这样拆分

Query 1: "Tesla stock performance Q4 2024" Query 2: "Tesla Cybertruck production updates 2024" Query 3: "Tesla FSD autonomous driving progress"
undefined
查询1:"Tesla stock performance Q4 2024" 查询2:"Tesla Cybertruck production updates 2024" 查询3:"Tesla FSD autonomous driving progress"
undefined

Source Filtering

数据源过滤

Use
includedSources
for domain authority: ​ Financial Research Collection. Some sources to include:
  • valyu/valyu-sec-filings
    - SEC regulatory filings
  • valyu/valyu-stocks
    - Stock market data
  • valyu/valyu-earnings-US
    - Earnings reports
  • reuters.com
    - Financial news
  • bloomberg.com
    - Market analysis ​ Medical Research Collection. Some sources to include:
  • valyu/valyu-pubmed
    - Medical literature
  • valyu/valyu-clinical-trials
    - Clinical trial data
  • valyu/valyu-drug-labels
    - FDA drug information
  • nejm.org
    - New England Journal of Medicine
  • thelancet.com
    - The Lancet ​ Tech Documentation Collection. Some sources to include:
  • docs.aws.amazon.com
    - AWS documentation
  • cloud.google.com/docs
    - Google Cloud docs
  • learn.microsoft.com
    - Microsoft docs
  • kubernetes.io/docs
    - Kubernetes docs
  • developer.mozilla.org
    - MDN Web Docs
javascript
// Academic
includedSources: ["valyu/valyu-arxiv", "valyu/valyu-pubmed", "nature"]

// Financial
includedSources: ["valyu/valyu-sec-filings", "bloomberg.com", "reuters.com"]

// Tech news
includedSources: ["techcrunch.com", "theverge.com", "arstechnica.com"]
For complete prompting guide, see references/prompting.md.

使用
includedSources
获取领域权威内容: ​ 金融研究推荐数据源:
  • valyu/valyu-sec-filings
    - SEC监管文件
  • valyu/valyu-stocks
    - 股票市场数据
  • valyu/valyu-earnings-US
    - 美国公司收益报告
  • reuters.com
    - 金融新闻
  • bloomberg.com
    - 市场分析 ​ 医疗研究推荐数据源:
  • valyu/valyu-pubmed
    - 医学文献
  • valyu/valyu-clinical-trials
    - 临床试验数据
  • valyu/valyu-drug-labels
    - FDA药品信息
  • nejm.org
    - 《新英格兰医学杂志》
  • thelancet.com
    - 《柳叶刀》 ​ 技术文档推荐数据源:
  • docs.aws.amazon.com
    - AWS文档
  • cloud.google.com/docs
    - Google Cloud文档
  • learn.microsoft.com
    - Microsoft文档
  • kubernetes.io/docs
    - Kubernetes文档
  • developer.mozilla.org
    - MDN Web文档
javascript
// 学术研究
includedSources: ["valyu/valyu-arxiv", "valyu/valyu-pubmed", "nature"]

// 金融研究
includedSources: ["valyu/valyu-sec-filings", "bloomberg.com", "reuters.com"]

// 科技新闻
includedSources: ["techcrunch.com", "theverge.com", "arstechnica.com"]
如需完整提示指南,请查看references/prompting.md

6. Common Workflows

6. 常见工作流

Research Workflow

研究工作流

typescript
// 1. Quick search to find sources
const searchResults = await valyu.search({
  query: "CRISPR therapeutic applications",
  searchType: "proprietary",
  maxNumResults: 20
});

// 2. Extract key content from top results
const contents = await valyu.contents({
  urls: searchResults.results.slice(0, 3).map(r => r.url),
  summary: "Extract key findings"
});

// 3. Deep analysis for comprehensive report
const research = await valyu.deepResearch.create({
  query: "CRISPR therapeutic applications comprehensive review",
  model: "heavy"
});
typescript
// 1. 快速搜索查找数据源
const searchResults = await valyu.search({
  query: "CRISPR therapeutic applications",
  searchType: "proprietary",
  maxNumResults: 20
});

// 2. 从顶级结果中提取关键内容
const contents = await valyu.contents({
  urls: searchResults.results.slice(0, 3).map(r => r.url),
  summary: "Extract key findings"
});

// 3. 深度分析生成综合性报告
const research = await valyu.deepResearch.create({
  query: "CRISPR therapeutic applications comprehensive review",
  model: "heavy"
});

Financial Analysis Workflow

金融分析工作流

typescript
// 1. Get SEC filings
const filings = await valyu.search({
  query: "Apple 10-K 2024",
  includedSources: ["valyu/valyu-sec-filings"]
});

// 2. Quick synthesis
const summary = await valyu.answer({
  query: "Apple Q4 2024 financial highlights",
  fastMode: true
});

// 3. Structured extraction
const metrics = await valyu.answer({
  query: "Apple financial metrics 2024",
  structuredOutput: {
    type: "object",
    properties: {
      revenue: { type: "string" },
      netIncome: { type: "string" },
      growthRate: { type: "string" }
    }
  }
});

typescript
// 1. 获取SEC文件
const filings = await valyu.search({
  query: "Apple 10-K 2024",
  includedSources: ["valyu/valyu-sec-filings"]
});

// 2. 快速内容综合
const summary = await valyu.answer({
  query: "Apple Q4 2024 financial highlights",
  fastMode: true
});

// 3. 结构化提取指标
const metrics = await valyu.answer({
  query: "Apple financial metrics 2024",
  structuredOutput: {
    type: "object",
    properties: {
      revenue: { type: "string" },
      netIncome: { type: "string" },
      growthRate: { type: "string" }
    }
  }
});

7. Available Data Sources

7. 可用数据源

Valyu provides access to 25+ specialized datasets:
CategoryExamples
AcademicarXiv (2.5M+ papers), PubMed (37M+), bioRxiv, medRxiv
FinancialSEC filings, earnings transcripts, stock data, crypto
HealthcareClinical trials, DailyMed, PubChem, drug labels, ChEMBL, DrugBank, Open Target, WHO ICD
EconomicFRED, BLS, World Bank, US Treasury, Destatis
PredictionsPolymarket, Kalshi
PatentsUS patent database
TransportationUK Rail, Ship Tracking
For complete datasource reference, see references/datasources.md.

Valyu提供25+个专业数据集的访问权限:
分类示例
学术arXiv(250万+论文)、PubMed(3700万+)、bioRxiv、medRxiv
金融SEC文件、收益记录、股票数据、加密货币数据
医疗健康临床试验、DailyMed、PubChem、药品说明书、ChEMBL、DrugBank、Open Target、WHO ICD
经济FRED、BLS、世界银行、美国财政部、Destatis
预测市场Polymarket、Kalshi
专利美国专利数据库
交通英国铁路、船舶追踪
如需完整数据源参考,请查看references/datasources.md

8. API Reference

8. API参考

For complete API documentation including all parameters, response structures, and error codes, see references/api-guide.md.

如需包含所有参数、响应结构及错误代码的完整API文档,请查看references/api-guide.md

9. Integration Guides

9. 集成指南

Platform-specific integration documentation:
  • Anthropic Claude
  • OpenAI
  • Vercel AI SDK
  • LangChain
  • LlamaIndex
  • MCP Server

平台特定的集成文档:
  • Anthropic Claude
  • OpenAI
  • Vercel AI SDK
  • LangChain
  • LlamaIndex
  • MCP Server

Additional Resources

额外资源

  • All Recipes Index
  • Design Philosophy
  • Prompting Guide
  • Full API Reference
  • 所有示例索引
  • 设计理念
  • 提示指南
  • 完整API参考