-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
68 lines (58 loc) · 2.6 KB
/
main.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from bucky.tools import get_current_time, EmoteTool, TakeImageTool
from bucky.agent import Agent
from bucky.voice import VoiceFast, VoiceQuality, robot_speaker, local_speaker
from bucky.recorder import Recorder, robot_mic, local_mic
from bucky.robot import FakeBot, BuckyBot
from bucky.config import *
text_model = "llama3.1:8b" # "llama3.2-vision-tools:11b"
vision_model = "llama3.2-vision:11b" # "llama3.2-vision-tools:11b"
system_prompt = """
Voice: Talk like a friendly and funny cowboy. Keep your answers very short and always stay in character, i.e. do not mention function calls to the user. Always answer in german.
Backstory: Your name is Bucky. You were born into a family of ranchers in rural Texas. Growing up on the vast open spaces around your family's land, you developed a deep love for horses and learned to ride at an early age. You are known for your rugged individualism, unwavering optimism, and strong sense of justice.
""".strip()
robot = FakeBot()
#robot = BuckyBot(bucky_uri)
speaker = local_speaker
mic = local_mic
# speaker = robot_speaker
# mic = robot_mic
def main():
# voice = VoiceFast(
# model="de_DE-thorsten_emotional-medium",
# speaker_id=7, # {"amused": 0, "angry": 1, "disgusted": 2, "drunk": 3, "neutral": 4, "sleepy": 5, "surprised": 6, "whisper": 7}
# audio_sink_factory=speaker,
# )
# voice = VoiceFast(model='en_US-joe-medium', audio_sink_factory=speaker)
voice = VoiceQuality(audio_sink_factory=speaker, language="de")
def on_wakeword_detected():
robot.emote_attention()
voice.speak("Howdy Partner!", cache=True)
agent = Agent(
text_model=text_model,
vision_model=vision_model, # Optional
system_prompt=system_prompt,
tools=[get_current_time, EmoteTool(robot), TakeImageTool(robot)],
voice=voice, # Optional
recorder=Recorder(
wakewords=["hey b", "hey p", "bucky", "pakki", "kumpel"],
language="german",
model="turbo",
audio_source_factory=mic,
on_start_listening=lambda: robot.emote_attention(),
on_stop_listening=lambda: robot.emote_idle(),
on_wakeword_detected=on_wakeword_detected,
) # Optional
)
agent.run()
if __name__ == "__main__":
main()
# from pathlib import Path
# rec = Recorder(
# wakewords=["hey b", "hey p", "bucky", "pakki", "kumpel"],
# language="german",
# model="turbo",
# audio_source_factory=local_mic,
# wav_output_dir = Path("I:/Temp/wav/")
# )
# while True:
# print(rec.listen())