Repository navigation
dev/v2-change - #216
Merged
Merged
dev/v2-change#216
Conversation
added 4 commits
October 21, 2026 17:31
- Migrate save_api_key function from common module to v2._config module - Update comments to reflect the relocation of key-file authentication implementation - Move SDK session ID implementation to shared module dashscope._shared - Modify v2 package re-export strategy, no longer importing save_api_key from 1.x - Adjust incremental output parameter check logic in chat completion module - Update related tests to verify new module structure and functionality migration
…plementations - Update _shared module documentation to clarify its role as state shared between the two stacks - Migrate the agentstudio subpackage implementation to dashscope.v2.agentstudio - Add a compatibility layer for agentstudio to preserve historical import paths - Migrate aigc, app, assistants, audio, cli, common, embeddings and other subpackage implementations to their corresponding legacy_1x modules - Add backward-compatible import shims for each subpackage - Remove finetune/reinforcement-related demo and parser components - Update the import structure of the finetune/reinforcement module
luk384090-cloud
force-pushed
the
dev/v2-change
branch
from
October 23, 2026 09:54
f73f3a4 to
eff77e8
Compare
Sync the vendored error registry to upstream 1.0.11 (commit 5b2d2e1), which adds the generic sdk.ConnectionError / sdk.ConnectionInterrupted / sdk.Timeout / sdk.IoError entries shared with the Java SDK. APIConnectionError / APITimeoutError become SdkError subclasses whose code / solution / allow_retry default from the catalog entries, and the httpx transport now formats their messages from the entry templates. Local file I/O failures in client.files raise sdk.IoError via the new sdk_error() factory instead of raw FileNotFoundError / OSError. sdk.ConnectionInterrupted is vendored for parity but intentionally not wired (a Java threading artifact).
Re-vendor the catalog at upstream 1.0.11 commit cd873b6, which adds the public response_error entry and five sdk.ws.* entries. ResponseError joins the status-error hierarchy as a flat APIStatusError sibling. It shares status 500 with internal_error, so the status map now lets the first catalog claimant win: a bare 500 still resolves to InternalServerError, and 500 joins 400/401/429 as a status too ambiguous for catalog fallback text. ResponseError itself stays SDK-side with no wire-code or status mapping. The websocket transport's ad-hoc RuntimeError/WsEventError raises are replaced by catalog-backed SdkError subclasses: WsEventError now carries sdk.ws.ProtocolError, and the new WsStateError / WsBinaryOwnerConflictError carry sdk.ws.IllegalState / sdk.ws.BinaryOwnerConflict. sdk.ws.UpstreamQueueFull (synchronous send, no buffer) and sdk.ws.QueueCapacityExceeded (unbounded per-task queues) describe mechanisms the Python transport does not have and are vendored for parity only.
Move both implementations onto native v2 exceptions while preserving legacy imports and AgenticRL numeric error codes.
Keep legacy reinforcement aliases and move AgentStudio coverage into the v2 suite.
Finalize the 2.0 package layout, move 1.x APIs under legacy_1x, and align tests, packaging, CI, examples, and documentation with the new import paths.
- Added @deprecated decorator to mark all 1.x error classes - Created _legacy_error utility function to handle deprecation warnings uniformly - Preserved backward compatibility; existing except clauses continue to work - Guided users toward the new dashscope.errors (2.0) exception hierarchy - Added deprecation docstrings to all error classes
…c RL exception hierarchy - Removed save_api_key function definition; now imported from dashscope._config - Made content parameter in Message constructor Optional to support None values - RuntimeErrorWithCode and ValueErrorWithCode now inherit from both AgenticRLError and their corresponding built-in exception types - DashScopeError now inherits from DashScopeException to unify the error handling hierarchy - Updated README documenting Agentic RL path restructuring and error handling changes - Added tests verifying inheritance relationships and exception catching behavior of unified error base classes
- Added dashscope.applications.finetune submodule to legacy 1.x alias mapping - Ensured `from dashscope.finetune import <sub>` resolves correctly to 1.x version modules - Added alias support for customize_types, deployments, and finetunes submodules - Fixed import errors caused by module object sharing
…cted thinking block parsing - Added _thinking field for storing thinking block state - Implemented parsing support for thinking and redacted_thinking block types - Handled thinking block initialization in content_block_start events - Accumulated thinking content and signatures in content_block_delta events - Added _cumulative_thinking_blocks method for cumulative thinking blocks - Updated streaming aggregation logic to preserve thinking blocks and signature info - Implemented logic to extract a single signature from block list - Added cumulative processing of thinking block content and signatures - Fixed reasoning block handling in message merging - Added JSON response error handling in async audio stream tests - Extended queue-full error handling in WebSocket connections
- Removed legacy _ThreadBridgeTransport class, replaced with unified _blocking module - Added bridge_client function for creating bridged clients supporting cross-thread transport calls - Updated _AsyncResourceProxy to use the new bridged client implementation - Moved synchronous response parsing to worker threads to avoid blocking the event loop - Ensured async clients correctly handle file-upload-related blocking operations
Use an isolated executor for synchronous upload workers so async transports retain access to the event loop default executor. Classify malformed upload-policy responses as catalog-backed internal errors while preserving response metadata.
Map malformed successful JSON responses to the catalog internal error across resources, preserving response metadata and parse causes. Wire bounded WebSocket queue overflow to sdk.ws.QueueCapacityExceeded instead of IllegalState.
Restore the historical dashscope.tokenizers package attribute and type stub. Re-resolve quickstart configuration before each call, safely retiring stale clients after in-flight requests finish and closing hidden pools at process exit.
- Introduced get_user_agent function in utils module - Added user-agent header to Encryption class API requests - Added user-agent header to fine-tuning related requests - Updated request headers to include SDK identification info
…tion - Removed all warnings and comments about 2.0 audio API preview status - Removed warnings import and related FutureWarning notices - Refactored VoiceDesign class to use voice_id field uniformly instead of voice - Updated voice_design method parameters and field mappings - Added support for language_hints parameter - Improved DesignedVoice response model data structure - Adjusted documentation in examples and README - Optimized real-time WebSocket task queue capacity error handling
Setuptools leaves deleted packages in an incremental build/lib tree. Clean the built dashscope package before copying current sources so stale 1.x packages cannot shadow 2.0 modules such as dashscope/client.py.
…s check mechanism - Introduce FC_LAYER_STATUS_TIMEOUT and FC_LAYER_STATUS_INTERVAL environment variables to control layer build timeout and polling interval - Update FunctionLayerError message descriptions to cover build failure, timeout, and status query error scenarios - Refactor get_layer method implementation with build status polling logic and timeout handling - Enhance error handling to distinguish between build failures, status query errors, and timeouts - Fix legacy 1.x version issue where client directory could shadow the client module import - Add comprehensive unit tests covering various layer build states and error scenarios
…uration options - Add acli-openai, acli-anthropic, acli-voice, acli-camera, acli-all feature group descriptions - Add base_url, config_path, protocol_options, raise_on_error, http_client configuration options - Add DASHSCOPE_HTTP_BASE_URL and DASHSCOPE_WEBSOCKET_BASE_URL environment variable support - Extend HTTP connection pool related environment variable configurations - Update model list including qwen-turbo, wan2.6-image, wan2.7-i2v, cosyvoice-v3-flash, etc. - Fix streaming transmission retry mechanism description - Add API key file path environment variable support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
[Describe what this PR does and why]
Related Issue: Fixes #[issue_number] or Relates to #[issue_number]
Security Considerations: [Check if API keys or sensitive credentials are exposed in code/logs]
Type of Change
Component(s) Affected
Checklist
Testing
[How to test these changes]
Additional Notes
[Optional: any other context]