From d7ea4f90a8fa1be0fbbaa715426caf1c819d12a8 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Sun, 16 Apr 2023 17:37:07 +0100 Subject: ora.sh load model ( to use gpt-4 ) --- ora/__init__.py | 4 ++-- ora/model.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'ora') 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 -- cgit v1.2.3