-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatbot.py
More file actions
25 lines (23 loc) 路 817 Bytes
/
Copy pathchatbot.py
File metadata and controls
25 lines (23 loc) 路 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import openai
def ask_gitty(prompt):
openai.api_key = os.getenv("OPENAI_API_KEY")
response = openai.ChatCompletion.create(
model="gpt-4-turbo",
messages=[
{"role": "system", "content": "Jij bent een vrolijke, scherpe, Nederlandstalige code-assistent met veel sarcasme."},
{"role": "user", "content": prompt}
],
max_tokens=400,
temperature=0.6,
)
return response['choices'][0]['message']['content']
if __name__ == "__main__":
print("Welkom bij mini-Gitty (GPT-4.1)! Type je vraag ('exit' stopt):")
while True:
vraag = input("Jij: ")
if vraag.lower() in ["exit", "quit", "stop"]:
print("Doei! 馃捇馃ゲ")
break
antwoord = ask_gitty(vraag)
print("Gitty:", antwoord)