Class: LLM::Alibaba
- Defined in:
- lib/llm/providers/alibaba.rb,
lib/llm/providers/alibaba/error_handler.rb,
lib/llm/providers/alibaba/request_adapter.rb
Overview
The Alibaba class implements a provider for Alibaba Cloud Model Studio through its OpenAI-compatible API, including the Qwen3 family of models.
The default host is the pay-as-you-go DashScope
international endpoint (dashscope-intl.aliyuncs.com). Configure
a different host either globally through the DASHSCOPE_API_HOST
environment variable, or per instance through
LLM.alibaba(host: "token-plan.ap-southeast-1.maas.aliyuncs.com")
(for example Alibaba's Token Plan).
Defined Under Namespace
Modules: RequestAdapter Classes: ErrorHandler
Constant Summary collapse
- HOST =
"dashscope-intl.aliyuncs.com"- BASE_PATH =
"/compatible-mode/v1"
Instance Method Summary collapse
-
#retry_budget ⇒ Integer
Returns the number of times a rate-limited request is retried.
-
#name ⇒ Symbol
Returns the provider's name.
-
#error_handler ⇒ Class
Returns the class that handles unsuccessful responses.
- #images ⇒ Object
- #audio ⇒ Object
- #moderations ⇒ Object
- #responses ⇒ Object
- #vector_stores ⇒ Object
-
#default_model ⇒ String
Returns the default model for chat completions.
- #initialize(host: ENV.fetch("DASHSCOPE_API_HOST", HOST), base_path: BASE_PATH) ⇒ LLM::Alibaba constructor
Methods inherited from OpenAI
#adapt_function, #complete, #embed, #files, #models, #server_tools, #web_search
Methods inherited from Provider
#adapt_function, #assistant_role, #build_messages, #chat, #complete, #developer_role, #embed, #files, #host, #inspect, #interrupt!, #key?, #models, #ocr, #port, #registry, #request_owner, #respond, #retry_errors, #schema, #server_tool, #server_tools, #system_role, #tool_role, #tracer, #tracer=, #user_role, #web_search, #with, #with_tracer
Constructor Details
#initialize(host: ENV.fetch("DASHSCOPE_API_HOST", HOST), base_path: BASE_PATH) ⇒ LLM::Alibaba
37 38 39 |
# File 'lib/llm/providers/alibaba.rb', line 37 def initialize(host: ENV.fetch("DASHSCOPE_API_HOST", HOST), base_path: BASE_PATH, **) super end |
Instance Method Details
#retry_budget ⇒ Integer
Returns the number of times a rate-limited request is retried.
Alibaba (token plan) will frequently issue rate limits or time outs that it recovers from. The higher retry count is to account for scenarios where it takes longer than expected to recover.
104 105 106 |
# File 'lib/llm/providers/alibaba.rb', line 104 def retry_budget 8 end |
#name ⇒ Symbol
Returns the provider's name
44 45 46 |
# File 'lib/llm/providers/alibaba.rb', line 44 def name :alibaba end |
#error_handler ⇒ Class
Returns the class that handles unsuccessful responses
51 52 53 |
# File 'lib/llm/providers/alibaba.rb', line 51 def error_handler LLM::Alibaba::ErrorHandler end |
#images ⇒ Object
57 58 59 |
# File 'lib/llm/providers/alibaba.rb', line 57 def images raise NotImplementedError end |
#audio ⇒ Object
63 64 65 |
# File 'lib/llm/providers/alibaba.rb', line 63 def audio raise NotImplementedError end |
#moderations ⇒ Object
69 70 71 |
# File 'lib/llm/providers/alibaba.rb', line 69 def moderations raise NotImplementedError end |
#responses ⇒ Object
75 76 77 |
# File 'lib/llm/providers/alibaba.rb', line 75 def responses raise NotImplementedError end |
#vector_stores ⇒ Object
81 82 83 |
# File 'lib/llm/providers/alibaba.rb', line 81 def vector_stores raise NotImplementedError end |
#default_model ⇒ String
Returns the default model for chat completions
89 90 91 |
# File 'lib/llm/providers/alibaba.rb', line 89 def default_model "deepseek-v4-flash-0731" end |