Skip to content

Commit a529fb2

Browse files
chindris-mihai-alexandruforge-code-agentamitksingh1490
authored
feat(provider): add Modal as a built-in provider for GLM-5 (#2871)
Co-authored-by: ForgeCode <noreply@forgecode.dev> Co-authored-by: Amit Singh <amitksingh1490@gmail.com>
1 parent 66ab313 commit a529fb2

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

crates/forge_domain/src/provider.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ impl ProviderId {
7474
pub const FIREWORKS_AI: ProviderId = ProviderId(Cow::Borrowed("fireworks-ai"));
7575
pub const NOVITA: ProviderId = ProviderId(Cow::Borrowed("novita"));
7676
pub const GOOGLE_AI_STUDIO: ProviderId = ProviderId(Cow::Borrowed("google_ai_studio"));
77+
pub const MODAL: ProviderId = ProviderId(Cow::Borrowed("modal"));
7778

7879
/// Returns all built-in provider IDs
7980
///
@@ -108,6 +109,7 @@ impl ProviderId {
108109
ProviderId::FIREWORKS_AI,
109110
ProviderId::NOVITA,
110111
ProviderId::GOOGLE_AI_STUDIO,
112+
ProviderId::MODAL,
111113
]
112114
}
113115

@@ -136,6 +138,7 @@ impl ProviderId {
136138
"fireworks-ai" => "FireworksAI".to_string(),
137139
"novita" => "Novita".to_string(),
138140
"google_ai_studio" => "GoogleAIStudio".to_string(),
141+
"modal" => "Modal".to_string(),
139142
_ => {
140143
// For other providers, use UpperCamelCase conversion
141144
use convert_case::{Case, Casing};
@@ -182,6 +185,7 @@ impl std::str::FromStr for ProviderId {
182185
"fireworks-ai" => ProviderId::FIREWORKS_AI,
183186
"novita" => ProviderId::NOVITA,
184187
"google_ai_studio" => ProviderId::GOOGLE_AI_STUDIO,
188+
"modal" => ProviderId::MODAL,
185189
// For custom providers, use Cow::Owned to avoid memory leaks
186190
custom => ProviderId(Cow::Owned(custom.to_string())),
187191
};
@@ -596,6 +600,24 @@ mod tests {
596600
assert_eq!(actual, expected);
597601
}
598602

603+
#[test]
604+
fn test_modal_from_str() {
605+
let actual = ProviderId::from_str("modal").unwrap();
606+
let expected = ProviderId::MODAL;
607+
assert_eq!(actual, expected);
608+
}
609+
610+
#[test]
611+
fn test_modal_display_name() {
612+
assert_eq!(ProviderId::MODAL.to_string(), "Modal");
613+
}
614+
615+
#[test]
616+
fn test_modal_in_built_in_providers() {
617+
let built_in = ProviderId::built_in_providers();
618+
assert!(built_in.contains(&ProviderId::MODAL));
619+
}
620+
599621
#[test]
600622
fn test_io_intelligence() {
601623
let fixture = "test_key";

crates/forge_repo/src/provider/provider.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,5 +3209,25 @@
32093209
"input_modalities": ["text"]
32103210
}
32113211
]
3212+
},
3213+
{
3214+
"id": "modal",
3215+
"api_key_vars": "MODAL_API_KEY",
3216+
"url_param_vars": [],
3217+
"response_type": "OpenAI",
3218+
"url": "https://api.us-west-2.modal.direct/v1/chat/completions",
3219+
"models": [
3220+
{
3221+
"id": "zai-org/GLM-5-FP8",
3222+
"name": "GLM-5",
3223+
"description": "Z.ai's 745B parameter flagship open-source MoE model for long-horizon agents and systems engineering, hosted on Modal",
3224+
"context_length": 192000,
3225+
"tools_supported": true,
3226+
"supports_parallel_tool_calls": true,
3227+
"supports_reasoning": true,
3228+
"input_modalities": ["text"]
3229+
}
3230+
],
3231+
"auth_methods": ["api_key"]
32123232
}
32133233
]

0 commit comments

Comments
 (0)