File size: 377 Bytes
4a6aa55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import openai
import sys
import os


def openai_predict(message, input_prompt, openai_api_key):
    openai.api_key = openai_api_key

    response = openai.ChatCompletion.create(
        model='gpt-3.5-turbo',
        messages=[{"role": "user", "content": f"{input_prompt}: {message}"}],
        temperature=1.0
    )
    
    return response["choices"][0]["message"]["content"]