drep/llm/mod.rs
1//! LLM client and JSON extraction.
2//!
3//! Split by concern:
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`; see the module doc for why it remains narrow.
14//! - [`models`] asks an endpoint which models it serves, for `drep init`.
15//! - [`quirks`] answers what one *model* accepts - `temperature` and its
16//! output ceiling - which no endpoint's listing carries.
17//! - [`chain`] is the ordered list of providers with failover. It owns the
18//! loop, so the cache key is recomputed per provider and the answer is
19//! filed under the key of whoever gave it.
20//!
21//! `chain::ProviderChain::complete_json` is the boundary the analyzer calls;
22//! `client::LlmClient::complete_json` is the single-provider request beneath
23//! it. It
24//! returns the `Extracted` from `json_parsing`, never the raw text, so a
25//! truncated response stays a type the caller can pattern-match on rather
26//! than a log line to grep for.
27
28pub mod backend;
29pub mod cache;
30pub mod chain;
31pub mod client;
32pub mod codex;
33pub mod concurrency;
34pub mod error;
35pub mod json_parsing;
36pub mod models;
37pub mod quirks;