Untitled
unknown
plain_text
10 months ago
575 B
5
Indexable
import openai # Set up your OpenAI API key openai.api_key = 'your_api_key_here' # Define a function to interact with the AI model def generate_response(prompt): response = openai.Completion.create( engine="text-davinci-002", prompt=prompt, temperature=0.7, max_tokens=150 ) return response.choices[0].text.strip() # Main conversation loop while True: user_input = input("You: ") if user_input.lower() == 'exit': print("Goodbye!") break prompt = f"You: {user_input}\nAI:" print(generate_response(prompt))
Editor is loading...
Leave a Comment