ccproxy.adapters.base¶
ccproxy.adapters.base
¶
Base adapter interface for API format conversion.
APIAdapter
¶
Bases: ABC
Abstract base class for API format adapters.
Combines all transformation interfaces to provide a complete adapter for converting between different API formats.
adapt_request
abstractmethod
async
¶
Convert a request from one API format to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
dict[str, Any]
|
The request data to convert |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
The converted request data |
Raises:
Type | Description |
---|---|
ValueError
|
If the request format is invalid or unsupported |
Source code in ccproxy/adapters/base.py
adapt_response
abstractmethod
async
¶
Convert a response from one API format to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response
|
dict[str, Any]
|
The response data to convert |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
The converted response data |
Raises:
Type | Description |
---|---|
ValueError
|
If the response format is invalid or unsupported |
Source code in ccproxy/adapters/base.py
adapt_stream
abstractmethod
async
¶
Convert a streaming response from one API format to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream
|
AsyncIterator[dict[str, Any]]
|
The streaming response data to convert |
required |
Yields:
Type | Description |
---|---|
AsyncIterator[dict[str, Any]]
|
The converted streaming response chunks |
Raises:
Type | Description |
---|---|
ValueError
|
If the stream format is invalid or unsupported |