drep/llm/mod.rs
1//! LLM client and JSON extraction.
2//!
3//! Split by concern rather than by phase:
4//!
5//! - [`json_parsing`] turns whatever the model returned into a `serde_json::Value`.
6//! Tolerant of fences, prose, trailing commas and truncated output, in that
7//! order, first success wins.
8//! - [`client`] wraps `open-agent-sdk`. The request itself - streaming,
9//! transport retry, and parse retry.
10//! - [`cache`] is the on-disk response cache. Content-addressed keys (not
11//! git-aware), infallible reads, oldest-first eviction.
12//! - [`concurrency`] is the bounded in-flight limiter. Deliberately just a
13//! `Semaphore`; the rate-limit machinery the Python carried is gone (see
14//! the module doc for the four reasons).
15//! - [`models`] asks an endpoint which models it serves, for `drep init`.
16//! - [`quirks`] answers what one *model* accepts - `temperature` and its
17//! output ceiling - which no endpoint's listing carries.
18//! - [`chain`] is the ordered list of providers with failover. It owns the
19//! loop, so the cache key is recomputed per provider and the answer is
20//! filed under the key of whoever gave it.
21//!
22//! `chain::ProviderChain::complete_json` is the boundary the analyzer calls;
23//! `client::LlmClient::complete_json` is the single-provider request beneath
24//! it. It
25//! returns the `Extracted` from `json_parsing`, never the raw text, so a
26//! truncated response stays a type the caller can pattern-match on rather
27//! than a log line to grep for.
28
29pub mod backend;
30pub mod cache;
31pub mod chain;
32pub mod client;
33pub mod codex;
34pub mod concurrency;
35pub mod error;
36pub mod json_parsing;
37pub mod models;
38pub mod quirks;