Expand description
§bigrag
Rust client for bigRAG — a self-hostable RAG platform.
§Installation
[dependencies]
bigrag = "0.1"
tokio = { version = "1", features = ["full"] }§Quick Start
use bigrag::BigRag;
#[tokio::main]
async fn main() -> Result<(), bigrag::BigRagError> {
let client = BigRag::new("http://localhost:6100", "your-api-key");
// Create a collection
let collection = client.collections().create(bigrag::types::collections::CreateCollectionBody {
name: "my-docs".into(),
..Default::default()
}).await?;
// Upload a document
let doc = client.documents().upload("my-docs", "/path/to/file.pdf", None).await?;
// Query
let results = client.queries().query("my-docs", bigrag::types::query::QueryBody {
query: "How does it work?".into(),
..Default::default()
}).await?;
for result in results.results {
println!("[{:.2}] {}", result.score, result.text);
}
Ok(())
}§Environment Variables
| Variable | Default | Description |
|---|---|---|
BIGRAG_BASE_URL | http://localhost:6100 | Base URL of the bigRAG API |
BIGRAG_API_KEY | — | API key for authentication |
Use BigRag::from_env() to read these automatically.
§Builder API
use std::time::Duration;
use bigrag::BigRag;
let client = BigRag::builder()
.base_url("https://my-bigrag.example.com")
.api_key("sk-...")
.timeout(Duration::from_secs(60))
.max_retries(3)
.build()?;§Collection-Scoped Client
use bigrag::BigRag;
let client = BigRag::new("http://localhost:6100", "sk-...");
let col = client.collection("my-docs");
// All methods scoped to "my-docs"
let docs = col.list_documents(None).await?;
let stats = col.stats().await?;Re-exports§
pub use error::BigRagError;pub use resources::Collections;pub use resources::Documents;pub use resources::Queries;pub use resources::Vectors;pub use resources::Webhooks;
Modules§
- error
- Error types.
- resources
- Resource namespaces for interacting with the bigRAG API.
- types
- Request and response types.
Structs§
- BigRag
- The bigRAG client.
- BigRag
Builder - Builder for creating a
BigRagclient with custom configuration. - BigRag
Config - Configuration for the bigRAG client.
- Collection
Client - A collection-scoped client for convenience.
- SseStream
- A stream of SSE progress events from the bigRAG API.
Enums§
- File
Input - Input for file upload operations.