Expand description
Claude API client for LLM-generated function summaries (SQ-6).
Uses reqwest::blocking to avoid nested tokio runtime issues
(the Store already uses rt.block_on()).
The summary pass uses the Batches API for throughput (no RPM limit, 50% discount). Individual summarize_chunk() is available for single-chunk fallback.
Split into submodules by concern:
prompts- prompt construction (summary, doc, HyDE)batch- batch submission, polling, result fetchingsummary- llm_summary_pass orchestrationdoc_comments- doc comment generation pass + needs_doc_commenthyde- HyDE query prediction pass
Re-exports§
pub use provider::BatchProvider;
Modules§
- provider
- LLM batch provider abstraction.
Structs§
- LlmClient
- Claude API client for generating summaries.
- LlmConfig
- Resolved LLM configuration (env vars > config file > constants).
- Summary
Entry - A summary entry ready for storage.
Enums§
- LlmError
- Typed error for LLM operations (EH-14).
- LlmProvider
- LLM API provider type.
Functions§
- create_
client - Create a batch provider from the resolved config.
- doc_
comment_ pass - Run the LLM doc-comment generation pass using the Batches API.
Scans all indexed chunks, selects those needing doc comments (via
needs_doc_comment), checks the cache, submits uncached candidates as a batch to Claude withbuild_doc_prompt, and returns the results. Cached results are returned without an API call.max_docslimits how many functions to process (0 = unlimited).improve_allregenerates docs for all functions, even those with existing adequate docs. - hyde_
query_ pass - Run the HyDE query prediction pass using the Batches API. Scans all callable chunks, submits them as a batch to Claude for query prediction, polls for completion, then stores results with purpose=“hyde”. Returns the number of new HyDE predictions generated.
- llm_
summary_ pass - Run the LLM summary pass using the Batches API.
- needs_
doc_ comment - Determines whether a code chunk needs a documentation comment.
Returns
trueif the chunk is a callable, non-test item from a source file that either lacks documentation or has inadequate documentation (less than 30 characters and no signal words like “TODO” or “FIXME”). Only the first window of windowed chunks is considered eligible.