Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/llm/anthropic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pub mod tools;

pub use auth::{AnthropicAuthPath, apply_auth_headers, detect_auth_path};
pub use cache::{CacheRetention, get_cache_control, resolve_cache_retention};
pub use params::build_anthropic_request;
pub use params::{AnthropicRequest, anthropic_messages_url, build_anthropic_request};
pub use tools::{from_claude_code_name, to_claude_code_name};
8 changes: 8 additions & 0 deletions src/llm/anthropic/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub struct AnthropicRequest {
pub auth_path: AnthropicAuthPath,
/// Original tool (name, description) pairs for reverse-mapping response tool calls.
pub original_tools: Vec<(String, String)>,
/// The JSON body sent to the API, exposed for streaming variants to add `"stream": true`.
pub body: serde_json::Value,
}

/// Adaptive thinking is only available on 4.6-generation models.
Expand Down Expand Up @@ -44,6 +46,11 @@ fn messages_url(base_url: &str) -> String {
}
}

/// The Anthropic messages endpoint URL, exposed for streaming request construction.
pub fn anthropic_messages_url(base_url: &str) -> String {
messages_url(base_url)
}

/// Build a fully configured Anthropic API request from a CompletionRequest.
///
/// `base_url` is the provider's configured base URL (e.g. `https://api.anthropic.com`
Expand Down Expand Up @@ -109,6 +116,7 @@ pub fn build_anthropic_request(
builder,
auth_path,
original_tools,
body,
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/llm/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ impl LlmManager {
/// Create a new LLM manager with the given configuration.
pub async fn new(config: LlmConfig) -> Result<Self> {
let http_client = reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(120))
.timeout(std::time::Duration::from_secs(300))
.connect_timeout(std::time::Duration::from_secs(30))
.tcp_keepalive(std::time::Duration::from_secs(30))
.pool_idle_timeout(std::time::Duration::from_secs(90))
.build()
.with_context(|| "failed to build HTTP client")?;

Expand Down Expand Up @@ -94,7 +97,10 @@ impl LlmManager {
/// Initialize with an instance directory (for use at construction time).
pub async fn with_instance_dir(config: LlmConfig, instance_dir: PathBuf) -> Result<Self> {
let http_client = reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(120))
.timeout(std::time::Duration::from_secs(300))
.connect_timeout(std::time::Duration::from_secs(30))
.tcp_keepalive(std::time::Duration::from_secs(30))
.pool_idle_timeout(std::time::Duration::from_secs(90))
.build()
.with_context(|| "failed to build HTTP client")?;

Expand Down
Loading
Loading