-
Notifications
You must be signed in to change notification settings - Fork 0
docs(rust): API reference master #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,43 @@ | ||
| [ | ||
| "resq-ai", | ||
| "resq-bin", | ||
| "resq-ai/config", | ||
| "resq-ai/index", | ||
| "resq-ai/provider", | ||
| "resq-ai/token", | ||
| "resq-bin/analysis", | ||
| "resq-bin/bin_explorer", | ||
| "resq-bin/index", | ||
| "resq-clean", | ||
| "resq-cli", | ||
| "resq-cli/commands", | ||
| "resq-cli/commands/audit", | ||
| "resq-cli/commands/commit", | ||
| "resq-cli/commands/completions", | ||
| "resq-cli/commands/copyright", | ||
| "resq-cli/commands/dev", | ||
| "resq-cli/commands/docs", | ||
| "resq-cli/commands/explore", | ||
| "resq-cli/commands/format", | ||
| "resq-cli/commands/hook_templates", | ||
| "resq-cli/commands/hooks", | ||
| "resq-cli/commands/pre_commit", | ||
| "resq-cli/commands/secrets", | ||
| "resq-cli/commands/version", | ||
| "resq-cli/gitignore", | ||
| "resq-cli/index", | ||
| "resq-cli/resq_cli", | ||
| "resq-cli/utils", | ||
| "resq-deploy", | ||
| "resq-dsa", | ||
| "resq-dsa/bloom", | ||
| "resq-dsa/count_min", | ||
| "resq-dsa/graph", | ||
| "resq-dsa/heap", | ||
| "resq-dsa/index", | ||
| "resq-dsa/resq_dsa", | ||
| "resq-dsa/trie", | ||
| "resq-flame", | ||
| "resq-health", | ||
| "resq-logs", | ||
| "resq-perf", | ||
| "resq-tui" | ||
| "resq-tui/index", | ||
| "resq-tui/resq_tui", | ||
| "resq-tui/terminal" | ||
| ] |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| **resq_ai > config** | ||
|
|
||
| # Module: config | ||
|
|
||
| ## Contents | ||
|
|
||
| **Structs** | ||
|
|
||
| - [`AiConfig`](#aiconfig) - AI configuration. | ||
|
|
||
| **Functions** | ||
|
|
||
| - [`load_config`](#load_config) - Load config with cascade: env vars -> ~/.resq/ai.toml -> .resq/ai.toml. | ||
|
|
||
| --- | ||
|
|
||
| ## resq_ai::config::AiConfig | ||
|
|
||
| *Struct* | ||
|
|
||
| AI configuration. | ||
|
|
||
| **Fields:** | ||
| - `provider: crate::provider::Provider` - Selected provider. | ||
| - `model: String` - Model identifier. | ||
| - `base_url: Option<String>` - Base URL override. | ||
| - `max_tokens: u32` - Max tokens in response. | ||
| - `timeout_secs: u64` - HTTP request timeout in seconds. | ||
|
|
||
| **Methods:** | ||
|
|
||
| - `fn api_key(self: &Self) -> &str` - Access the API key. | ||
|
|
||
| **Trait Implementations:** | ||
|
|
||
| - **Debug** | ||
| - `fn fmt(self: &Self, f: & mut fmt::Formatter) -> fmt::Result` | ||
|
|
||
|
|
||
|
|
||
| ## resq_ai::config::load_config | ||
|
|
||
| *Function* | ||
|
|
||
| Load config with cascade: env vars -> ~/.resq/ai.toml -> .resq/ai.toml. | ||
|
|
||
| # Errors | ||
|
|
||
| Returns an error if no API key is found for the selected provider. | ||
|
|
||
| ```rust | ||
| fn load_config() -> anyhow::Result<AiConfig> | ||
| ``` | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # resq_ai | ||
|
|
||
| > **Version:** `v0.1.0` · **License:** `Apache-2.0` · **Crate:** [crates.io](https://crates.io/crates/resq-ai) · **API docs:** [docs.rs](https://docs.rs/resq-ai/0.1.0) | ||
|
|
||
| Multi-provider LLM abstraction for `ResQ` developer tools. | ||
|
|
||
| Supports Anthropic, `OpenAI`, and Google Gemini APIs with a unified | ||
| `complete()` interface and cascading config resolution. | ||
|
|
||
| ## Modules | ||
|
|
||
| ### [`config`](./config.md) | ||
|
|
||
| *1 function, 1 struct* | ||
|
|
||
| ### [`provider`](./provider.md) | ||
|
|
||
| *1 enum, 1 function* | ||
|
|
||
| ### [`token`](./token.md) | ||
|
|
||
| *2 functions* | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| **resq_ai > provider** | ||
|
|
||
| # Module: provider | ||
|
|
||
| ## Contents | ||
|
|
||
| **Enums** | ||
|
|
||
| - [`Provider`](#provider) - Supported LLM providers. | ||
|
|
||
| **Functions** | ||
|
|
||
| - [`complete`](#complete) - Send a completion request to the configured provider. | ||
|
|
||
| --- | ||
|
|
||
| ## resq_ai::provider::Provider | ||
|
|
||
| *Enum* | ||
|
|
||
| Supported LLM providers. | ||
|
|
||
| **Variants:** | ||
| - `Anthropic` - Anthropic Claude API | ||
| - `OpenAi` - OpenAI-compatible Chat Completions API | ||
| - `Gemini` - Google Gemini API | ||
|
|
||
| **Methods:** | ||
|
|
||
| - `fn default_model(self: &Self) -> &'static str` - Default model for this provider. | ||
| - `fn default_base_url(self: &Self) -> &'static str` - Default base URL for this provider. | ||
| - `fn api_key_env_var(self: &Self) -> &'static str` - Environment variable name for the API key. | ||
|
|
||
| **Traits:** Eq, Copy | ||
|
|
||
| **Trait Implementations:** | ||
|
|
||
| - **Deserialize** | ||
| - `fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>` | ||
| - **Debug** | ||
| - `fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result` | ||
| - **Clone** | ||
| - `fn clone(self: &Self) -> Provider` | ||
| - **PartialEq** | ||
| - `fn eq(self: &Self, other: &Provider) -> bool` | ||
|
|
||
|
|
||
|
|
||
| ## resq_ai::provider::complete | ||
|
|
||
| *Function* | ||
|
|
||
| Send a completion request to the configured provider. | ||
|
|
||
| A single [`reqwest::Client`] is reused across calls to benefit from | ||
| connection pooling. | ||
|
|
||
| # Errors | ||
|
|
||
| Returns an error on network failure, auth failure, or empty response. | ||
|
|
||
| ```rust | ||
| fn complete(config: &super::AiConfig, system: &str, user: &str) -> anyhow::Result<String> | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| **resq_ai > token** | ||
|
|
||
| # Module: token | ||
|
|
||
| ## Contents | ||
|
|
||
| **Functions** | ||
|
|
||
| - [`estimate_tokens`](#estimate_tokens) - Estimate token count using the chars/4 heuristic. | ||
| - [`truncate_to_budget`](#truncate_to_budget) - Truncate text to fit within a token budget. | ||
|
|
||
| --- | ||
|
|
||
| ## resq_ai::token::estimate_tokens | ||
|
|
||
| *Function* | ||
|
|
||
| Estimate token count using the chars/4 heuristic. | ||
|
|
||
| ```rust | ||
| fn estimate_tokens(text: &str) -> usize | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| ## resq_ai::token::truncate_to_budget | ||
|
|
||
| *Function* | ||
|
|
||
| Truncate text to fit within a token budget. | ||
| Cuts at line boundaries to avoid broken diff hunks. | ||
|
|
||
| ```rust | ||
| fn truncate_to_budget(text: &str, max_tokens: usize) -> &str | ||
| ``` | ||
|
|
||
|
|
||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generated documentation is exposing internal implementation details such as
_serde::__private228::Result. The generator should be configured to resolve these to their public-facing types (e.g.,serde::ResultorResult) to maintain clarity for end-users and avoid exposing unstable internals.