mirror of
https://github.com/NovaOSS/nova-cord.git
synced 2024-11-25 16:33:57 +01:00
Merge branch 'main' of https://github.com/NovaOSS/nova-cord
This commit is contained in:
commit
02f7780761
|
@ -16,9 +16,9 @@ async def get_credentials(interaction):
|
||||||
try:
|
try:
|
||||||
get_response = await accounts.request_user_by_discord_id(interaction.user.id)
|
get_response = await accounts.request_user_by_discord_id(interaction.user.id)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
await embedder.error(interaction, """Sorry,
|
await embedder.error(interaction, """Sorry,\n" \
|
||||||
there was an issue while checking if you already have an account.
|
there was an issue while checking if you already have an account.
|
||||||
Please report this issue to the staff!""", ephemeral=True)
|
Please report this issue to the staff!""", ephemeral=True)
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
if get_response.status_code == 200: # user exists
|
if get_response.status_code == 200: # user exists
|
||||||
|
@ -49,13 +49,13 @@ async def get_credentials(interaction):
|
||||||
|
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
await embedder.error(interaction, """Sorry,
|
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
|
raise exc
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await embedder.ok(interaction, f"""Welcome to NovaAI, {interaction.user.mention}!
|
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']
|
api_key = get_response.json()['api_key']
|
||||||
|
|
||||||
|
|
|
@ -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':
|
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`.
|
text = """For the official `openai` Python library, you just need to set the `openai.api_base` to `https://api.nova-oss.com/v1`.
|
||||||
```py
|
```py
|
||||||
import openai
|
from nova_python import Models, Endpoints, NovaClient
|
||||||
|
|
||||||
openai.api_key = "PUT_YOUR_NOVA_AI_API_KEY_IN_HERE"
|
client = NovaClient('YOUR_API_KEY')
|
||||||
openai.api_base = "https://api.nova-oss.com/v1"
|
|
||||||
|
|
||||||
completion = openai.ChatCompletion.create(
|
reponse = client.make_request(
|
||||||
model="gpt-3.5-turbo",
|
endpoint = Endpoints.CHAT_COMPLETION,
|
||||||
messages=[
|
model = Models.GPT3,
|
||||||
{"role": "system", "content": "You are a helpful assistant."},
|
data=[
|
||||||
{"role": "user", "content": "Hello!"}
|
{"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())
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue