1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
[]
# 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`.
= "sqlrite-ask"
= "0.9.0"
= ["Joao Henrique Machado Silva <joaoh82@gmail.com>"]
= "2024"
= "1.85"
= "Natural-language → SQL adapter for sqlrite-engine. Anthropic-first; OpenAI / Ollama follow-ups."
= "https://github.com/joaoh82/rust_sqlite"
= "MIT"
= "README.md"
= ["sqlrite", "llm", "anthropic", "ai", "sql"]
= ["database", "api-bindings"]
[]
= "sqlrite_ask"
= "src/lib.rs"
[]
# **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.
= { = "1", = ["derive"] }
= "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.
#
# **Optional behind the `http` feature** (default-on) as of Phase
# 7g.7. The WASM SDK pulls this crate in with `default-features =
# false` to use just the prompt construction + response parsing —
# ureq's sync HTTP + rustls don't compile to wasm32. WASM ships its
# own `db.askPrompt()` / `db.askParse()` shape per Q9, where the
# browser hands the prompt to the caller's JS HTTP function and
# parses the result back through this crate.
= { = "2", = ["json", "tls"], = true }
# 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.)
= "2"
[]
# Default is full HTTP-capable build — the engine's `ask` feature
# (and the Python / Node / Go SDKs) all go through `ask_with_schema`,
# which calls into the AnthropicProvider. Disabling `http` keeps
# only the wasm-safe parts: prompt construction (`build_system`,
# system rules), response parsing (`parse_response`), config types
# (`AskConfig`, `AskResponse`, `AskUsage`, `AskError`), and the
# generic `ask_with_schema_and_provider<P>` entry that takes a
# caller-supplied provider. The WASM SDK is the only consumer that
# turns this off today.
= ["http"]
= ["dep:ureq"]
[]
# 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.
= "0.12"