From a6c21aab43b09ef262e68fb1531af0c0789906e9 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 7 Aug 2023 08:29:36 +0200 Subject: [PATCH 1/2] Fixed some formatting --- cord/credential_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cord/credential_manager.py b/cord/credential_manager.py index 60f3986..1eef509 100644 --- a/cord/credential_manager.py +++ b/cord/credential_manager.py @@ -16,9 +16,9 @@ async def get_credentials(interaction): try: get_response = await accounts.request_user_by_discord_id(interaction.user.id) except Exception as exc: - await embedder.error(interaction, """Sorry, - there was an issue while checking if you already have an account. - Please report this issue to the staff!""", ephemeral=True) + await embedder.error(interaction, """Sorry,\n" \ +there was an issue while checking if you already have an account. +Please report this issue to the staff!""", ephemeral=True) raise exc if get_response.status_code == 200: # user exists @@ -49,13 +49,13 @@ async def get_credentials(interaction): except Exception as exc: await embedder.error(interaction, """Sorry, - your account could not be created. Please report this issue to the staff!""", ephemeral=True) +your account could not be created. Please report this issue to the staff!""", ephemeral=True) raise exc else: await embedder.ok(interaction, f"""Welcome to NovaAI, {interaction.user.mention}! - Your account was created successfully.""", ephemeral=True) +Your account was created successfully.""", ephemeral=True) api_key = get_response.json()['api_key'] From a629e3f5d603eb00595668b6a372f177f585b87b Mon Sep 17 00:00:00 2001 From: Leander Date: Mon, 7 Aug 2023 20:14:55 +0200 Subject: [PATCH 2/2] Update tutorials.py Updated the bot, so it shows nova_python instead of openai --- cord/tutorials.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cord/tutorials.py b/cord/tutorials.py index 90d819e..22ab9cc 100644 --- a/cord/tutorials.py +++ b/cord/tutorials.py @@ -62,20 +62,20 @@ Don't have `pip` installed? Learn more here: https://pip.pypa.io/en/stable/insta if how_can_i == 'use the Python library': text = """For the official `openai` Python library, you just need to set the `openai.api_base` to `https://api.nova-oss.com/v1`. ```py -import openai +from nova_python import Models, Endpoints, NovaClient -openai.api_key = "PUT_YOUR_NOVA_AI_API_KEY_IN_HERE" -openai.api_base = "https://api.nova-oss.com/v1" +client = NovaClient('YOUR_API_KEY') -completion = openai.ChatCompletion.create( - model="gpt-3.5-turbo", - messages=[ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "Hello!"} - ] +reponse = client.make_request( + endpoint = Endpoints.CHAT_COMPLETION, + model = Models.GPT3, + data=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "What is the highest mountain?"} + ] ) -print(completion.choices[0].message) +print(reponse.get_message_content()) ``` """