Block a user
baml-client (0.1.0)
Published 2026-05-31 14:26:00 -05:00 by joe
Installation
[registry]
default = "gitea"
[registries.gitea]
index = "sparse+ " # Sparse index
# index = " " # Git
[net]
git-fetch-with-cli = truecargo add baml-client@0.1.0About this package
BAML client for Gooey AI integrations
BAML Client for Gooey
AI-powered structured data extraction from Claude Code hooks using BAML (Boundary AI Markup Language).
Features
- 🧠 LLM-powered insight extraction from hook events
- 🔒 Type-safe structured outputs using BAML schemas
- 🎯 Multi-provider support (OpenAI GPT-4, Anthropic Claude)
- ⚡ Pure Rust/WASM compatible (no Node.js required)
- 🎨 Native integration with Gooey UI components
Architecture
Hook Event → BAML Function → LLM Provider → Structured Insight → Gooey Component
Quick Start
1. Configure API Keys
# Copy example config
cp .env.example .env
# Add your API key (choose one)
echo "OPENAI_API_KEY=sk-..." >> .env
# OR
echo "ANTHROPIC_API_KEY=sk-ant-..." >> .env
2. Use in Code
use baml_client::{GooeyBamlClient, types::HookEvent};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = GooeyBamlClient::new().await?;
let event = HookEvent {
event_type: "tool_use".to_string(),
tool: Some("Read".to_string()),
result: "File not found".to_string(),
error: Some("ENOENT".to_string()),
command: None,
};
let insight = client.analyze_hook_event(&event).await?;
println!("Title: {}", insight.title);
println!("Severity: {:?}", insight.severity);
println!("Summary: {}", insight.summary);
Ok(())
}
3. Run Example
cargo run --example analyze_hook
Data Types
Input: HookEvent
Claude Code hook event data:
pub struct HookEvent {
pub event_type: String, // "tool_use", "error", etc.
pub tool: Option<String>, // Tool name (e.g., "Read")
pub command: Option<String>, // Executed command
pub result: String, // Event output
pub error: Option<String>, // Error message
}
Output: Insight
Structured insight from LLM analysis:
pub struct Insight {
pub title: String, // Brief summary
pub summary: String, // Detailed explanation
pub severity: Severity, // Info/Warning/Critical
pub action_items: Vec<ActionItem>, // Actionable tasks
}
Technology Stack
- simplify_baml - Native Rust BAML runtime
- reqwest - HTTP client for LLM APIs
- serde - JSON serialization
- tokio - Async runtime
Development
Run Tests
cargo test -p baml-client
Build
cargo build -p baml-client --release
Generate Docs
cargo doc -p baml-client --open
License
MIT
Dependencies
| ID | Version |
|---|---|
| anyhow | ^1.0 |
| async-trait | ^0.1 |
| baml | ^0.218 |
| chrono | ^0.4 |
| futures | ^0.3 |
| log | ^0.4 |
| reqwest | ^0.12 |
| serde | ^1.0 |
| serde_json | ^1.0 |
| simplify_baml | ^0.2 |
| thiserror | ^1.0 |
| tokio | ^1.0 |
| toml | ^0.8 |
| env_logger | ^0.11 |
| proptest | ^1.4 |
| tokio-test | ^0.4 |
Details
2026-05-31 14:26:00 -05:00
Assets (1)
Versions (1)
View all
Cargo
2
joe <joe@example.com>
MIT
59 KiB
baml-client-0.1.0.crate
59 KiB
0.1.0
2026-05-31