You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
446 B
Python

import openai
class ChatGPT():
def __init__(self, model_path = 'gpt-3.5-turbo', api_key = None):
openai.api_key = api_key
self.model_path = model_path
def chat(self, message):
response = openai.ChatCompletion.create(
model=self.model_path,
messages=[
{"role": "user", "content": message}
]
)
return response['choices'][0]['message']['content']