Update tutorials.py

Updated the bot, so it shows nova_python instead of openai
This commit is contained in:
Leander 2023-08-07 20:14:55 +02:00 committed by GitHub
parent a545633493
commit a629e3f5d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,
data=[
{"role": "system", "content": "You are a helpful assistant."}, {"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"} {"role": "user", "content": "What is the highest mountain?"}
] ]
) )
print(completion.choices[0].message) print(reponse.get_message_content())
``` ```
""" """