diff options
Diffstat (limited to '')
-rw-r--r-- | ora/__init__.py | 4 | ||||
-rw-r--r-- | ora/model.py | 16 |
2 files changed, 17 insertions, 3 deletions
diff --git a/ora/__init__.py b/ora/__init__.py index 928f4af3..b6389f64 100644 --- a/ora/__init__.py +++ b/ora/__init__.py @@ -26,10 +26,10 @@ class Completion: 'chatbotId': model.id, 'input' : prompt, 'userId' : model.createdBy, - 'model' : 'gpt-3.5-turbo', + 'model' : model.modelName, 'provider' : 'OPEN_AI', 'includeHistory': includeHistory}).json() - + return OraResponse({ 'id' : response['conversationId'], 'object' : 'text_completion', diff --git a/ora/model.py b/ora/model.py index 69eca526..a0f0e93e 100644 --- a/ora/model.py +++ b/ora/model.py @@ -8,6 +8,7 @@ class CompletionModel: createdAt = None slug = None id = None + model = 'gpt-3.5-turbo' def create( system_prompt: str = 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible', @@ -18,6 +19,7 @@ class CompletionModel: CompletionModel.description = description CompletionModel.slug = name + response = post('https://ora.sh/api/assistant', json = { 'prompt' : system_prompt, 'userId' : f'auto:{uuid4()}', @@ -29,4 +31,16 @@ class CompletionModel: CompletionModel.createdAt = response.json()['createdAt'] return CompletionModel -
\ No newline at end of file + + def load(chatbotId: str, modelName: str = 'gpt-3.5-turbo', userId: str = None): + if userId is None: userId = f'{uuid4()}' + + CompletionModel.system_prompt = None + CompletionModel.description = None + CompletionModel.slug = None + CompletionModel.id = chatbotId + CompletionModel.createdBy = userId + CompletionModel.createdAt = None + CompletionModel.modelName = modelName + + return CompletionModel
\ No newline at end of file |