Skip to content

fix(api): complete parts support in SDK layers and simplify error handling#275

Merged
qin-ctx merged 1 commit intovolcengine:mainfrom
SeanZ:fix/parts-support-cleanup
Feb 25, 2026
Merged

fix(api): complete parts support in SDK layers and simplify error handling#275
qin-ctx merged 1 commit intovolcengine:mainfrom
SeanZ:fix/parts-support-cleanup

Conversation

@SeanZ
Copy link
Contributor

@SeanZ SeanZ commented Feb 25, 2026

  1. Complete parts support in all client layers:

    • BaseClient (abstract interface)
    • SyncHTTPClient
    • AsyncOpenViking
    • SyncOpenViking
  2. Simplify VikingFS error handling:

    • Remove _convert_agfs_error() complex error mapping
    • Use simple FileNotFoundError for all AGFS exceptions
    • This is cleaner and the original PR's error mapping was over-engineered for the use case

Description

This PR completes the parts parameter support that was partially implemented in #270. The previous PR added parts support to HTTP API and some client layers, but missed the SDK entry points (AsyncOpenViking, SyncOpenViking) and base interface (BaseClient).

Additionally, this PR removes the over-engineered _convert_agfs_error() function that was introduced in #270, replacing it with simple FileNotFoundError exceptions. The complex error type mapping (FileNotFoundError/PermissionError/IOError) was unnecessary for the use case and added complexity without meaningful benefit.

Related Issue

Follow-up to #270

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Add parts parameter to BaseClient.add_message() abstract interface
  • Add parts parameter to SyncHTTPClient.add_message()
  • Add parts parameter to AsyncOpenViking.add_message()
  • Add parts parameter to SyncOpenViking.add_message()
  • Remove _convert_agfs_error() method from VikingFS
  • Simplify exception handling in read_file(), read_file_bytes(), and ls() to use FileNotFoundError

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

The parts parameter in all add_message() methods follows the same pattern:

  • content: str | None = None - simple text mode (backward compatible)
  • parts: list[dict] | None = None - full Part support (TextPart, ContextPart, ToolPart)
  • If both are provided, parts takes precedence
  • At least one of content or parts must be provided

1. Complete parts support in all client layers:
   - BaseClient (abstract interface)
   - SyncHTTPClient
   - AsyncOpenViking
   - SyncOpenViking

2. Simplify VikingFS error handling:
   - Remove _convert_agfs_error() complex error mapping
   - Use simple FileNotFoundError for all AGFS exceptions
   - This is cleaner and the original PR's error mapping was
     over-engineered for the use case
@qin-ctx qin-ctx merged commit 6ea8958 into volcengine:main Feb 25, 2026
6 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in OpenViking project Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants