| Crates.io | search_for_llms |
| lib.rs | search_for_llms |
| version | 0.1.0 |
| created_at | 2025-08-13 16:06:01.523078+00 |
| updated_at | 2025-08-13 16:06:01.523078+00 |
| description | A search tool suitable for LLMs, with structured and cleaned search results, written in Rust |
| homepage | https://github.com/LeeeSe/search_for_llms |
| repository | https://github.com/LeeeSe/search_for_llms |
| max_upload_size | |
| id | 1793784 |
| size | 126,052 |
A Rust library and command-line tool for searching web pages and fetching their content, suitable for use with LLMs.
simple_search is a tool that performs web searches and retrieves content from the resulting pages. It combines search engine querying with web scraping capabilities to gather structured, cleaned information from search results, making it particularly suitable for LLM applications.
Add this to your Cargo.toml:
[dependencies]
search_for_llms = "0.1.0"
Or install the command-line tool:
cargo install search_for_llms
use search_for_llms::{search_and_fetch_structured, search_and_fetch_summary};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get structured results
let results = search_and_fetch_structured("Rust programming", 5, 5000).await?;
// Or get a formatted summary string
let summary = search_and_fetch_summary("Rust programming", 5, 5000).await?;
println!("{}", summary);
Ok(())
}
# Basic search
search_for_llms "Rust programming"
# Search with options
search_for_llms "Rust programming" --pages 10 --max-chars 10000
query - Search query (required)--pages / -p - Number of pages to fetch (default: 5)--max-chars / -m - Maximum characters per page (default: 5000)The tool creates a fetched_pages directory with:
search_and_fetch_structuredReturns structured data in a SearchResults struct:
pub async fn search_and_fetch_structured(
query: &str,
page_count: usize,
max_chars_per_page: usize,
) -> Result<SearchResults, Box<dyn std::error::Error>>
search_and_fetch_summaryReturns a formatted string summary:
pub async fn search_and_fetch_summary(
query: &str,
page_count: usize,
max_chars_per_page: usize,
) -> Result<String, Box<dyn std::error::Error>>
cargo build
cargo run -- "your search query"
cargo test
To publish this crate to crates.io:
cargo login <your-token>cargo publishBefore publishing, ensure:
clap - Command line argument parsingserde - Serialization frameworksimple_google - Google search functionalityspider - Web scraping frameworkfutures - Asynchronous programming utilitiesMIT