Buckets:

download
raw
1.42 kB
"""
Common utilities for Volcengine LLM provider
"""
from typing import Final
import httpx
from litellm.llms.base_llm.chat.transformation import BaseLLMException
class VolcEngineError(BaseLLMException):
"""
Custom exception class for Volcengine provider errors.
"""
def __init__(self, status_code: int, message: str, headers: httpx.Headers | None = None):
self.status_code = status_code
self.message = message
self.headers = headers or httpx.Headers()
super().__init__(status_code=status_code, message=message, headers=dict(self.headers))
def get_volcengine_base_url(api_base: str | None = None) -> str:
"""
Get the base URL for Volcengine API calls.
Args:
api_base: Optional custom API base URL
Returns:
The base URL to use for API calls
"""
if api_base:
return api_base
return "https://ark.cn-beijing.volces.com"
def get_volcengine_headers(api_key: str, extra_headers: dict | None = None) -> dict:
"""
Get headers for Volcengine API calls.
Args:
api_key: The API key for authentication
extra_headers: Optional additional headers
Returns:
Dictionary of headers
"""
headers: Final = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}",
}
if extra_headers:
headers.update(extra_headers)
return headers

Xet Storage Details

Size:
1.42 kB
·
Xet hash:
c49b65312161d41b891abc7fb458c80296f8c476675c0ac9eb3844a059c84975

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.