Skip to content

Commit 699161b

Browse files
author
User
committed
feat: additional configuration for model providers
1 parent bcc1b90 commit 699161b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

huly-coder.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ model: anthropic/claude-3.5-sonnet
2828
#provider_api_key: sk-xxxxxxxxxxxxxxxxxxxxx
2929
#provider_base_url: http://127.0.0.1:1234/v1
3030

31+
# Advanced provider configuration (optional)
32+
# For example, you can configure openrouter provider routing configuration(https://openrouter.ai/docs/features/provider-routing) as follows:
33+
# provider_config:
34+
# provider:
35+
# order: [ "openai", "together"]
36+
# allow_fallbacks: false
37+
38+
3139
#---------------------------------------
3240
# Permission mode
3341
#---------------------------------------

src/agent/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ impl Agent {
327327
M: CompletionModel,
328328
{
329329
agent_builder = agent_builder.temperature(0.0);
330+
if let Some(config) = &context.config.provider_config {
331+
agent_builder = agent_builder.additional_params(config.clone());
332+
}
330333
let mut system_prompt = context.system_prompt.clone();
331334
let mcp_config = context.config.mcp.as_ref();
332335
agent_builder = Self::add_static_tools(agent_builder, context);

src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub struct Config {
8787
pub provider: ProviderKind,
8888
pub provider_api_key: Option<String>,
8989
pub provider_base_url: Option<String>,
90+
pub provider_config: Option<serde_json::Value>,
9091
pub model: String,
9192
pub permission_mode: PermissionMode,
9293
pub workspace: PathBuf,

0 commit comments

Comments
 (0)