2023-10-09 19:09:01 +02:00
|
|
|
from .helpers import utils
|
|
|
|
|
|
|
|
ORGANIC = False
|
|
|
|
MODELS = [
|
2023-10-14 01:15:59 +02:00
|
|
|
'gpt-3.5-turbo',
|
2023-10-09 19:09:01 +02:00
|
|
|
'gpt-3.5-turbo-0301',
|
|
|
|
'gpt-3.5-turbo-16k-0613'
|
|
|
|
]
|
|
|
|
|
|
|
|
async def chat_completion(**kwargs):
|
|
|
|
payload = kwargs
|
2023-10-14 01:15:59 +02:00
|
|
|
key = await utils.random_secret_for('ai.ls')
|
2023-10-09 19:09:01 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
'method': 'POST',
|
2023-10-14 01:15:59 +02:00
|
|
|
'url': 'https://api.caipacity.com/v1/chat/completions',
|
2023-10-09 19:09:01 +02:00
|
|
|
'payload': payload,
|
|
|
|
'headers': {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
'Authorization': f'Bearer {key}'
|
|
|
|
},
|
2023-10-14 01:15:59 +02:00
|
|
|
'provider_auth': f'ai.ls>{key}'
|
2023-10-09 19:09:01 +02:00
|
|
|
}
|