mirror of
https://github.com/yihong0618/bilingual_book_maker.git
synced 2025-06-05 19:15:34 +00:00

* feat: add Azure OpenAI service support * fix: code format * fix: enforce `api_base` when providing `deployment_id` --------- Co-authored-by: yihong0618 <zouzou0208@gmail.com>
20 lines
383 B
Python
20 lines
383 B
Python
import itertools
|
|
from abc import ABC, abstractmethod
|
|
|
|
|
|
class Base(ABC):
|
|
def __init__(self, key, language):
|
|
self.keys = itertools.cycle(key.split(","))
|
|
self.language = language
|
|
|
|
@abstractmethod
|
|
def rotate_key(self):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def translate(self, text):
|
|
pass
|
|
|
|
def set_deployment_id(self, deployment_id):
|
|
pass
|