Monius
v0.3 by <M0n-ius>
dc465b0
raw
history blame
612 Bytes
from .base import BaseAPI
from typing import List
class AzureAPI(BaseAPI):
def get_headers(self):
return {
'Content-Type': 'application/json',
'api-key': self.key
}
def get_caption(self, sys_prompt: str, user_prompt: str, images_base64: List[str]) -> str:
url_suffix = f'/openai/deployments/{self.model}/chat/completions?api-version=2024-02-15-preview'
return super().get_caption(sys_prompt, user_prompt, images_base64, url_suffix)
def parse_response(self, response: dict) -> str:
return response['choices'][0]['message']['content']