Question: import os import openai openai.api _ key = os . getenv ( sk - proj - 9 ZMdQpWg 7 1 IayFOTNsom 1 TW 3

import os
import openai
openai.api_key=os.getenv("sk-proj-9ZMdQpWg71IayFOTNsom1TW38Bs6x2r9t3xBxZd09cU)
def ask_chatgpt(question):
response = openai.ChatCompletion.create(
model='gpt-3.5-turbo',
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": question},
]
return response['choices'][0]['message']['content']
print(ask_chatgpt("what are the type of leaf diseases"))
Why the code (ask chatgpt) unreachable pylance?
import os import openai openai.api _ key = os .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!