tavily2

Crates.iotavily2
lib.rstavily2
version0.1.0
created_at2025-11-08 16:51:22.62367+00
updated_at2025-11-10 07:21:36.453375+00
descriptionA tiny tool for calling Tavily's REST API in the simplest way!
homepage
repositoryhttps://github.com/launcher-rs/tavily-rs
max_upload_size
id1923054
size59,003
(cyberdoors)

documentation

README

基于 tavily-rs 进行修改

  • 添加多api_key
  • 添加重试模式: multi_retry, false: 单个api重试, true: 选择不同api重试

Tavily2 Rust SDK

Unofficial (for now 🫠) Rust SDK for the Tavily Search API - the AI-powered search engine for LLM applications 🚀

[!NOTE] Requires an API key. You can get one by signing up at Tavily. The API key should be kept secure and not shared publicly.

Installation

cargo add tavily2

Quick Start

use std::time::Duration;
use tavily2::{Tavily, SearchRequest, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let tavily = Tavily::builder("tvly-your-api-key")
        .timeout(Duration::from_secs(60))
        .max_retries(5)
        .build()?;
    
    // Simple search
    let results = tavily.search("Latest AI developments").await?;

    // Advanced search with customization
    let  request = SearchRequest::new("tvly-your-api-key", "Breaking tech news")
        .search_depth("advanced")
        .topic("news")
        .include_answer(true)
        .max_results(10);
    
    let results = tavily.call(&request).await?;

    // Extract content from URLs
    let urls = vec![
        "https://tavily.com/",
        "https://github.com/PierreLouisLetoquart",
        "https://www.google.com/",
    ];
    let results = tavily.extract(urls).await?;

    Ok(())
}

Features

  • Simple Search: Quick search queries with minimal configuration
  • Answer Mode: Get AI-generated answers along with search results
  • Advanced Customization: Control search depth, topics, time range, and more
  • Domain Filtering: Include or exclude specific domains
  • Rich Content: Optional image results and descriptions

Documentation

For detailed examples and API documentation, check out:

License

MIT

Commit count: 0

cargo fmt