Crates.io | spiceai |
lib.rs | spiceai |
version | 2.0.0 |
source | src |
created_at | 2024-03-21 05:27:28.225015 |
updated_at | 2024-04-30 01:58:03.553412 |
description | SDK for Spice.ai, an open-source runtime and platform for building AI-driven software. |
homepage | |
repository | |
max_upload_size | |
id | 1181212 |
size | 36,881 |
Rust SDK for Spice.ai
Add Spice SDK
cargo add spiceai
Follow the quiqstart guide to install and run spice locally
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let mut client = ClientBuilder::new()
.flight_url("http://localhost:50051")
.build()
.await
.unwrap();
let data = client.query("SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;").await;
}
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let mut client = ClientBuilder::new()
.api_key("API_KEY")
.use_spiceai_cloud()
.build()
.await
.unwrap();
}
SQL Query
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let mut client = ClientBuilder::new()
.api_key("API_KEY")
.use_spiceai_cloud()
.build()
.await
.unwrap();
let data = client.query("SELECT * FROM eth.recent_blocks LIMIT 10;").await;
}
Firecache SQL Query
use spiceai::ClientBuilder;
#[tokio::main]
async fn main() {
let mut client = ClientBuilder::new()
.api_key("API_KEY")
.use_spiceai_cloud()
.build()
.await
.unwrap();
let data = client.fire_query("SELECT * FROM eth.recent_blocks LIMIT 10;").await;
}
Check out our Documentation to learn more about how to use the Rust SDK.