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 ALIBABA_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
- #audio ⇒ Object
-
#default_model ⇒ String
Returns the default model for chat completions.
-
#error_handler ⇒ Class
Returns the class that handles unsuccessful responses.
- #images ⇒ Object
- #initialize(host: ENV.fetch("DASHSCOPE_API_HOST", HOST), base_path: BASE_PATH) ⇒ LLM::Alibaba constructor
- #moderations ⇒ Object
-
#name ⇒ Symbol
Returns the provider's name.
- #responses ⇒ Object
- #vector_stores ⇒ Object
Methods inherited from OpenAI
#adapt_function, #assistant_role, #complete, #embed, #files, #models, #server_tools, #web_search
Methods included from OpenAI::RequestAdapter
Methods inherited from Provider
#adapt_function, #assistant_role, #build_messages, #chat, #complete, #developer_role, #embed, #files, #inspect, #interrupt!, #key?, #models, #ocr, #registry, #request_owner, #respond, #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
#audio ⇒ Object
63 64 65 |
# File 'lib/llm/providers/alibaba.rb', line 63 def audio 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 |
#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 |
#moderations ⇒ Object
69 70 71 |
# File 'lib/llm/providers/alibaba.rb', line 69 def moderations raise NotImplementedError end |
#name ⇒ Symbol
Returns the provider's name
44 45 46 |
# File 'lib/llm/providers/alibaba.rb', line 44 def name :alibaba 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 |