Qwen API Processor
Qwen API Processor
Details
Concrete implementation of BaseAPIProcessor for Qwen models.
Handles Qwen-specific API calls, authentication, and response parsing.
Qwen has two API endpoints:
International: https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text-generation/generation (preferred)
Domestic (China): https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation (fallback)
The processor automatically tries international first, then falls back to domestic if needed.
Methods
Inherited methods
Method new()
Test if an endpoint is accessible
Initialize Qwen processor
Arguments
base_url
Optional custom base URL for Qwen API
url
The endpoint URL to test
api_key
API key for authentication
Returns
TRUE if accessible, FALSE otherwise
Method get_default_api_url()
Get default Qwen API URL with intelligent endpoint selection
Usage
QwenProcessor$get_default_api_url()
Returns
Default Qwen API endpoint URL
Method get_working_api_url()
Get working Qwen API URL with automatic endpoint detection
Usage
QwenProcessor$get_working_api_url(api_key)
Arguments
api_key
API key for testing endpoints
Returns
Working Qwen API endpoint URL
Method make_api_call()
Make API call to Qwen
Usage
QwenProcessor$make_api_call(chunk_content, model, api_key)
Arguments
chunk_content
Content for this chunk
model
Model identifier
api_key
API key
Returns
httr response object
Extract response content from Qwen API response
Usage
QwenProcessor$extract_response_content(response, model)
Arguments
response
httr response object
model
Model identifier
Returns
Extracted text content
Method clone()
The objects of this class are cloneable with this method.
Usage
QwenProcessor$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.