mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 22:43:57 +01:00
33 lines
777 B
Python
33 lines
777 B
Python
from .helpers import utils
|
|
|
|
AUTH = True
|
|
ORGANIC = False
|
|
CONTEXT = True
|
|
STREAMING = True
|
|
MODERATIONS = False
|
|
ENDPOINT = 'https://nova-00001.openai.azure.com'
|
|
MODELS = [
|
|
'gpt-3.5-turbo',
|
|
'gpt-3.5-turbo-16k',
|
|
'gpt-4',
|
|
'gpt-4-32k'
|
|
]
|
|
# MODELS = [f'{model}-azure' for model in MODELS]
|
|
|
|
AZURE_API = '2023-07-01-preview'
|
|
|
|
async def chat_completion(**payload):
|
|
key = await utils.random_secret_for('azure-nva1')
|
|
|
|
deployment = payload['model'].replace('.', '').replace('-azure', '')
|
|
|
|
return {
|
|
'method': 'POST',
|
|
'url': f'{ENDPOINT}/openai/deployments/{deployment}/chat/completions?api-version={AZURE_API}',
|
|
'payload': payload,
|
|
'headers': {
|
|
'api-key': key
|
|
},
|
|
'provider_auth': f'azure-nva1>{key}'
|
|
}
|