Skip to content

Commit

Permalink
[apps/hal9] add history to generic agent (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisGuillen03 authored Dec 15, 2024
1 parent da9410a commit c6375ba
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions apps/hal9/tools/generic.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from groq import Groq
from utils import stream_print
from utils import stream_print, load_messages, insert_message, save_messages

def answer_generic_question(user_input):
# load messages
messages = load_messages(file_path="./.storage/.generic_agent_messages.json")
messages = insert_message(messages, "user", user_input)
response = Groq().chat.completions.create(
model = "llama3-70b-8192",
messages = [{"role": "user", "content": user_input}],
temperature = 0,
seed = 1)
model = "llama3-70b-8192",
messages = messages,
temperature = 0,
seed = 1)

text_response = response.choices[0].message.content
messages = insert_message(messages, "assistant", text_response)
save_messages(messages, file_path="./.storage/.generic_agent_messages.json")
stream_print(text_response)
return text_response

Expand Down

0 comments on commit c6375ba

Please sign in to comment.