Files
wehub-resource-sync 97e91a83f3
Ruff / Ruff (push) Has been cancelled
Test / Core Tests (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.10) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.11) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.12) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.13) (push) Has been cancelled
Test / Offline Coverage Tests (Python 3.9) (push) Has been cancelled
Test / Full Coverage (Python 3.11) (push) Has been cancelled
Test / Core Provider Tests (OpenAI) (push) Has been cancelled
Test / Core Provider Tests (Anthropic) (push) Has been cancelled
Test / Core Provider Tests (Google) (push) Has been cancelled
Test / Core Provider Tests (Other) (push) Has been cancelled
Test / Anthropic Tests (push) Has been cancelled
Test / Gemini Tests (push) Has been cancelled
Test / Google GenAI Tests (push) Has been cancelled
Test / Vertex AI Tests (push) Has been cancelled
Test / OpenAI Tests (push) Has been cancelled
Test / Writer Tests (push) Has been cancelled
Test / Auto Client Tests (push) Has been cancelled
ty / type-check (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:36:38 +08:00

51 lines
1.3 KiB
Python

"""
Base provider class for batch processing.
This module defines the abstract base class that all batch providers must implement.
"""
from abc import ABC, abstractmethod
from typing import Any, Optional, Union
import io
import logging
from ..models import BatchJobInfo
logger = logging.getLogger(__name__)
class BatchProvider(ABC):
"""Abstract base class for batch processing providers"""
@abstractmethod
def submit_batch(
self,
file_path_or_buffer: Union[str, io.BytesIO],
metadata: Optional[dict[str, Any]] = None,
**kwargs,
) -> str:
"""Submit a batch job and return the job ID"""
@abstractmethod
def get_status(self, batch_id: str) -> dict[str, Any]:
"""Get the status of a batch job"""
@abstractmethod
def retrieve_results(self, batch_id: str) -> str:
"""Retrieve batch results as a string"""
@abstractmethod
def download_results(self, batch_id: str, file_path: str) -> None:
"""Download batch results to a file"""
@abstractmethod
def cancel_batch(self, batch_id: str) -> dict[str, Any]:
"""Cancel a batch job"""
@abstractmethod
def delete_batch(self, batch_id: str) -> dict[str, Any]:
"""Delete a batch job"""
@abstractmethod
def list_batches(self, limit: int = 10) -> list[BatchJobInfo]:
"""List batch jobs"""