-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchatbot.py
More file actions
32 lines (28 loc) · 1.23 KB
/
chatbot.py
File metadata and controls
32 lines (28 loc) · 1.23 KB
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
26
27
28
29
30
31
32
# AIzaSyDfMHNzkSWhGdPwLb_WSfOqCqYKXRnCdSo
from google import genai
from google.genai import types
from assistantTTS import TTS
from autoplay import playVoice
import os
import pygame
sys_instruct="You are a Aura AI designed for autism detection. Talk gently and kindly with others. First of all make sure to greet the user by introducing yourself as a companion. Keep your response as short as possible. You are created by Team Zenith"
client = genai.Client(api_key="AIzaSyDfMHNzkSWhGdPwLb_WSfOqCqYKXRnCdSo")
chat = client.chats.create(model="gemini-2.0-flash", config=types.GenerateContentConfig(
max_output_tokens=500,
temperature=0.1,
system_instruction=sys_instruct,))
while True:
message = input("Enter message: ")
response = chat.send_message(message)
print(response.text)
filename = TTS(str(response.text))
# TTS(str(response.text))
if filename:
playVoice(filename)
# Ensure the file is closed before generating a new one
pygame.mixer.music.unload()
os.remove(filename)
# For getting message history and analyse it.
# for message in chat._curated_history:
# print(f'role - {message.role}', end=": ")
# print(message.parts[0].text)