Expand description
The LLM client.
One boundary: LlmClient::complete_json takes a system prompt and a user
payload, sends them to the configured OpenAI-compatible endpoint, and
returns the JSON value the model produced. Cache and concurrency limiting
live above this single-provider request boundary.
§What is deliberately delegated to the SDK
- Streaming.
open-agent-sdkparses the SSE stream; drep concatenates theContentBlock::Textblocks it emits and ignores the rest. Since 0.10.0 those blocks are fragments - one event per delta, delivered while the stream is open, where 0.9.x emitted the whole response as a single block at the end. The types are identical either way, so nothing here failed to compile and nothing here changed: the join inrun_one_queryis what makes the assembled text independent of where the deltas fall. Reading one block as the whole answer would now return a prefix, andsrc/llm/client/tests/streaming.rsis what would notice. - Transport retry.
retry_with_backoff_conditionaldecides per error whether to retry (5xx, timeout, stream error) or fail fast (4xx, config errors). drep adds no retry layer on top.
§What this module owns
- Parse retry. The same prompt truncates the same way, so a parse
failure does NOT retry. The retry closure returns
Ok(None)for an unparseable body; the SDK’s retry seesOk(...)and stops. - Attempt count floor.
LlmConfig::max_retriesmay be 0, but a “zero attempts loop” would skip the request and report a bogus “no exception was captured”. The floor is 1. max_tokenspass-through. The configured cap is forwarded only when the user set one. open-agent-sdk 0.7.0 omits the field entirely otherwise, so “unset” means the server decides - which is what a 256k-1M context model needs. (Before 0.7.0 the builder substituted 4096 and truncated reasoning models mid-thought; drep passed a large sentinel to work around it. That workaround is gone.)
Structs§
- LlmClient
- A configured LLM client ready to issue requests.
Constants§
- NO_
JSON_ ATTEMPTS - How many times a response carrying no JSON at all is asked for again.