Query CSV collections using an embedded small language model. No API keys, no cloud services; inference runs locally via quantized GGUF weights downloaded from Hugging Face Hub.
data/*.csv, reports/2024*) or fetch remote CSVs via URL. Mix freely in a single invocation.candle uses the Metal backend for faster inference out of the box.Io<Error, String> value; nothing executes until run is called once at the boundary.cargo install --path .
Or build from source:
cargo build --release
The binary lands at target/release/csv-query.
csv-query [OPTIONS] --source <SOURCE> <PROMPT>
| Argument | Description |
|---|---|
--source, -s | CSV source: a glob pattern or URL (repeatable) |
<PROMPT> | Natural-language question or instruction about the data |
| Flag | Default | Description |
|---|---|---|
--model, -m | phi3 | Model to use (phi3, smollm2) |
--output, -o | stdout | Write output to a file instead of stdout |
--max-tokens | 512 | Maximum tokens to generate |
--temperature | 0.7 | Sampling temperature (0.0 for greedy) |
Ask a question about local CSV files:
csv-query -s "sales/*.csv" "What was the total revenue in Q4?"
Combine local and remote sources:
csv-query \
-s "local_data/*.csv" \
-s "https://example.com/remote_data.csv" \
"List the top 5 products by unit volume"
Produce a new CSV from the collection:
csv-query -s "logs/*.csv" -o summary.csv \
"Produce a CSV with columns date, error_count, warning_count summarizing each day"
Use a different model with greedy decoding:
csv-query -s "data.csv" -m smollm2 --temperature 0.0 \
"How many unique customers appear in this dataset?"
The codebase is organized by domain context, not technical layer:
src/
main.rs Entry point. Wires the pipeline and calls run once.
cli.rs Command-line interface (clap derive).
source.rs Source resolution: glob expansion and HTTP fetch.
collection.rs Schema validation and row merging across sources.
model.rs Model download, GGUF loading, and token generation.
prompt.rs Chat-template prompt construction from CSV data.
error.rs Project-wide error enum with From impls for every dependency.
The pipeline is a chain of Io combinators that composes without executing:
--source string becomes a CsvSource::Local (glob) or CsvSource::Remote (URL).ResolvedSource values.CsvCollection.run is called exactly once in main, at the boundary.
| CLI name | Model | Architecture | Quantization | Size |
|---|---|---|---|---|
phi3 (default) | Phi-3-mini-4k-Instruct | Phi-3 | Q4 | ~2.2 GB |
smollm2 | SmolLM2-1.7B-Instruct | Llama | Q4_K_M | ~1.0 GB |
Weights are auto-downloaded from Hugging Face Hub on first run and cached in ~/.cache/huggingface/.
| Crate | Role |
|---|---|
| comp-cat-rs | Functional effects framework (Io, Stream, Resource) |
| csv-cat | CSV reading/writing built on comp-cat-rs |
| candle-core | Tensor operations and GGUF weight loading (Metal-accelerated) |
| candle-transformers | Quantized Phi-3 and Llama model architectures |
| hf-hub | Hugging Face Hub model downloading |
| tokenizers | HuggingFace tokenizer for prompt encoding |
| clap | Command-line argument parsing |
| reqwest | HTTP client for remote CSV fetching |
| tokio | Async runtime (bridged into synchronous Io via block_in_place) |
| glob | File pattern matching |
Licensed under either of
at your option.
5 commits
Rust
100.0%
Query CSV collections using an embedded small language model. No API keys, no cloud services; inference runs locally via quantized GGUF weights downloaded from Hugging Face Hub.
data/*.csv, reports/2024*) or fetch remote CSVs via URL. Mix freely in a single invocation.candle uses the Metal backend for faster inference out of the box.Io<Error, String> value; nothing executes until run is called once at the boundary.cargo install --path .
Or build from source:
cargo build --release
The binary lands at target/release/csv-query.
csv-query [OPTIONS] --source <SOURCE> <PROMPT>
| Argument | Description |
|---|---|
--source, -s | CSV source: a glob pattern or URL (repeatable) |
<PROMPT> | Natural-language question or instruction about the data |
| Flag | Default | Description |
|---|---|---|
--model, -m | phi3 | Model to use (phi3, smollm2) |
--output, -o | stdout | Write output to a file instead of stdout |
--max-tokens | 512 | Maximum tokens to generate |
--temperature | 0.7 | Sampling temperature (0.0 for greedy) |
Ask a question about local CSV files:
csv-query -s "sales/*.csv" "What was the total revenue in Q4?"
Combine local and remote sources:
csv-query \
-s "local_data/*.csv" \
-s "https://example.com/remote_data.csv" \
"List the top 5 products by unit volume"
Produce a new CSV from the collection:
csv-query -s "logs/*.csv" -o summary.csv \
"Produce a CSV with columns date, error_count, warning_count summarizing each day"
Use a different model with greedy decoding:
csv-query -s "data.csv" -m smollm2 --temperature 0.0 \
"How many unique customers appear in this dataset?"
The codebase is organized by domain context, not technical layer:
src/
main.rs Entry point. Wires the pipeline and calls run once.
cli.rs Command-line interface (clap derive).
source.rs Source resolution: glob expansion and HTTP fetch.
collection.rs Schema validation and row merging across sources.
model.rs Model download, GGUF loading, and token generation.
prompt.rs Chat-template prompt construction from CSV data.
error.rs Project-wide error enum with From impls for every dependency.
The pipeline is a chain of Io combinators that composes without executing:
--source string becomes a CsvSource::Local (glob) or CsvSource::Remote (URL).ResolvedSource values.CsvCollection.run is called exactly once in main, at the boundary.
| CLI name | Model | Architecture | Quantization | Size |
|---|---|---|---|---|
phi3 (default) | Phi-3-mini-4k-Instruct | Phi-3 | Q4 | ~2.2 GB |
smollm2 | SmolLM2-1.7B-Instruct | Llama | Q4_K_M | ~1.0 GB |
Weights are auto-downloaded from Hugging Face Hub on first run and cached in ~/.cache/huggingface/.
| Crate | Role |
|---|---|
| comp-cat-rs | Functional effects framework (Io, Stream, Resource) |
| csv-cat | CSV reading/writing built on comp-cat-rs |
| candle-core | Tensor operations and GGUF weight loading (Metal-accelerated) |
| candle-transformers | Quantized Phi-3 and Llama model architectures |
| hf-hub | Hugging Face Hub model downloading |
| tokenizers | HuggingFace tokenizer for prompt encoding |
| clap | Command-line argument parsing |
| reqwest | HTTP client for remote CSV fetching |
| tokio | Async runtime (bridged into synchronous Io via block_in_place) |
| glob | File pattern matching |
Licensed under either of
at your option.
5 commits
Rust
100.0%