sqlrite-ask 0.1.20

Natural-language → SQL adapter for sqlrite-engine. Anthropic-first; OpenAI / Ollama follow-ups.
Documentation
[package]
# Phase 7g.1 — natural-language → SQL via an LLM provider.
#
# This crate is intentionally kept separate from `sqlrite-engine` so
# the engine stays pure-SQL with no HTTP / TLS / async dependencies.
# Anyone embedding SQLRite who doesn't need `ask()` (the WASM SDK,
# read-only build-time tooling, lean embeddings) can ignore this
# crate entirely.
#
# Published to crates.io as `sqlrite-ask`. Joins the lockstep release
# wave (`sqlrite-ask-vX.Y.Z` tag) — see `docs/release-plan.md`.
name = "sqlrite-ask"
version = "0.1.20"
authors = ["Joao Henrique Machado Silva <joaoh82@gmail.com>"]
edition = "2024"
rust-version = "1.85"
description = "Natural-language → SQL adapter for sqlrite-engine. Anthropic-first; OpenAI / Ollama follow-ups."
repository = "https://github.com/joaoh82/rust_sqlite"
license = "MIT"

[lib]
name = "sqlrite_ask"
path = "src/lib.rs"

[dependencies]
# **No engine dep as of v0.1.19 (Phase 7g.2 structural fix).**
# `sqlrite-ask` is now pure: takes a `&str` schema dump + a `&str`
# question, returns generated SQL. The `Connection` / `Database`
# integration moved to the engine itself, gated behind the engine's
# new `ask` feature. Why: cargo's static cycle detection rejected
# `sqlrite-engine[bin] → sqlrite-ask → sqlrite-engine[lib]` even
# with `optional = true` on the engine side. Pure crate breaks the
# cycle structurally.
#
# Migration for v0.1.18 callers: `use sqlrite_ask::ConnectionAskExt`
# becomes `use sqlrite::ConnectionAskExt` (after enabling the
# engine's `ask` feature). API signature unchanged. See PR #60
# retrospective in `docs/roadmap.md`.

# JSON request/response shapes for the Anthropic Messages API.
# Could be hand-rolled but the request body has nested arrays of
# tagged-enum content blocks — serde derives are worth the dep.
serde = { version = "1", features = ["derive"] }
serde_json = "1"

# Sync HTTPS client. `ureq` 2.x is pure-Rust + rustls — no system
# OpenSSL, no tokio, no async runtime. Per `ask()` call we make
# exactly one POST to api.anthropic.com, so the sync surface is a
# perfect fit. Rolling our own JSON types over ureq is ~120 LOC
# vs. ~400 LOC + tokio + reqwest::blocking via an SDK.
ureq = { version = "2", features = ["json", "tls"] }

# Typed errors. (Same crate the engine uses, so consumers that
# enable the engine's `ask` feature can layer their own thiserror
# wrapper without version skew.)
thiserror = "2"

[dev-dependencies]
# Throwaway tiny localhost HTTP server for the integration test
# that exercises the real ureq path. Avoids hitting api.anthropic.com
# from CI (no network egress + no API key in test runners). Stays
# in `dev-dependencies` so it doesn't ship to consumers.
tiny_http = "0.12"