diff --git a/arch/tools/cli/config_generator.py b/arch/tools/cli/config_generator.py index 2d86dbef..3e8e02ea 100644 --- a/arch/tools/cli/config_generator.py +++ b/arch/tools/cli/config_generator.py @@ -20,6 +20,7 @@ SUPPORTED_PROVIDERS = [ "ollama", "moonshotai", "zhipu", + "qwen", ] @@ -128,9 +129,9 @@ def validate_and_render_schema(): ) provider = model_name_tokens[0] # Validate azure_openai and ollama provider requires base_url - if (provider == "azure_openai" or provider == "ollama") and llm_provider.get( - "base_url" - ) is None: + if ( + provider == "azure_openai" or provider == "ollama" or provider == "qwen" + ) and llm_provider.get("base_url") is None: raise Exception( f"Provider '{provider}' requires 'base_url' to be set for model {model_name}" ) diff --git a/arch/tools/cli/main.py b/arch/tools/cli/main.py index 25c00404..de3ed20f 100644 --- a/arch/tools/cli/main.py +++ b/arch/tools/cli/main.py @@ -205,6 +205,8 @@ def up(file, path, service, foreground): "MODEL_SERVER_PORT": os.getenv("MODEL_SERVER_PORT", "51000"), } env = os.environ.copy() + # Remove PATH variable if present + env.pop("PATH", None) # check if access_keys are preesnt in the config file access_keys = get_llm_provider_access_keys(arch_config_file=arch_config_file) diff --git a/crates/common/src/configuration.rs b/crates/common/src/configuration.rs index a37a0c80..301a8206 100644 --- a/crates/common/src/configuration.rs +++ b/crates/common/src/configuration.rs @@ -179,6 +179,8 @@ pub enum LlmProviderType { Moonshotai, #[serde(rename = "zhipu")] Zhipu, + #[serde(rename = "qwen")] + Qwen, } impl Display for LlmProviderType { @@ -197,6 +199,7 @@ impl Display for LlmProviderType { LlmProviderType::Ollama => write!(f, "ollama"), LlmProviderType::Moonshotai => write!(f, "moonshotai"), LlmProviderType::Zhipu => write!(f, "zhipu"), + LlmProviderType::Qwen => write!(f, "qwen"), } } } diff --git a/crates/hermesllm/src/clients/endpoints.rs b/crates/hermesllm/src/clients/endpoints.rs index fd4e0149..e5c01f05 100644 --- a/crates/hermesllm/src/clients/endpoints.rs +++ b/crates/hermesllm/src/clients/endpoints.rs @@ -87,6 +87,13 @@ impl SupportedAPIs { default_endpoint } } + ProviderId::Qwen => { + if request_path.starts_with("/v1/") { + "/compatible-mode/v1/chat/completions".to_string() + } else { + default_endpoint + } + } ProviderId::AzureOpenAI => { if request_path.starts_with("/v1/") { format!("/openai/deployments/{}/chat/completions?api-version=2025-01-01-preview", model_id) diff --git a/crates/hermesllm/src/providers/id.rs b/crates/hermesllm/src/providers/id.rs index d1756a08..46b9cf93 100644 --- a/crates/hermesllm/src/providers/id.rs +++ b/crates/hermesllm/src/providers/id.rs @@ -19,6 +19,7 @@ pub enum ProviderId { Ollama, Moonshotai, Zhipu, + Qwen, // alias for Qwen } impl From<&str> for ProviderId { @@ -38,6 +39,7 @@ impl From<&str> for ProviderId { "ollama" => ProviderId::Ollama, "moonshotai" => ProviderId::Moonshotai, "zhipu" => ProviderId::Zhipu, + "qwen" => ProviderId::Qwen, // alias for Zhipu _ => panic!("Unknown provider: {}", value), } } @@ -64,7 +66,8 @@ impl ProviderId { | ProviderId::TogetherAI | ProviderId::Ollama | ProviderId::Moonshotai - | ProviderId::Zhipu, + | ProviderId::Zhipu + | ProviderId::Qwen, SupportedAPIs::AnthropicMessagesAPI(_)) => SupportedAPIs::OpenAIChatCompletions(OpenAIApi::ChatCompletions), (ProviderId::OpenAI @@ -79,7 +82,8 @@ impl ProviderId { | ProviderId::TogetherAI | ProviderId::Ollama | ProviderId::Moonshotai - | ProviderId::Zhipu, + | ProviderId::Zhipu + | ProviderId::Qwen, SupportedAPIs::OpenAIChatCompletions(_)) => SupportedAPIs::OpenAIChatCompletions(OpenAIApi::ChatCompletions), } } @@ -102,6 +106,7 @@ impl Display for ProviderId { ProviderId::Ollama => write!(f, "ollama"), ProviderId::Moonshotai => write!(f, "moonshotai"), ProviderId::Zhipu => write!(f, "zhipu"), + ProviderId::Qwen => write!(f, "qwen"), } } } diff --git a/docs/source/concepts/llm_providers/supported_providers.rst b/docs/source/concepts/llm_providers/supported_providers.rst index 3531e2e6..c5c47ea0 100644 --- a/docs/source/concepts/llm_providers/supported_providers.rst +++ b/docs/source/concepts/llm_providers/supported_providers.rst @@ -517,6 +517,32 @@ Azure OpenAI access_key: $AZURE_OPENAI_API_KEY base_url: https://your-resource.openai.azure.com + +Azure OpenAI +~~~~~~~~~~~~ + +**Provider Prefix:** ``qwen/`` + +**API Endpoint:** ``/v1/chat/completions`` + +**Authentication:** API Key + Base URL - Get your Qwen API key from `Qwen Portal `_ → Your Qwen Resource → Keys and Endpoint. + +**Supported Chat Models:** All Qwen chat models including Qwen3, Qwen3-Coder and all future releases. + +.. code-block:: yaml + + llm_providers: + # Single deployment + - model: qwen/qwen3 + access_key: $DASHSCOPE_API_KEY + base_url: https://dashscope.aliyuncs.com + + # Multiple deployments + - model: qwen/qwen3-coder + access_key: $DASHSCOPE_API_KEY + base_url: "https://dashscope-intl.aliyuncs.com", + + Ollama ~~~~~~