Skip to content

Commit

Permalink
ready for user object (tbomk)
Browse files Browse the repository at this point in the history
  • Loading branch information
vintrocode authored and VVoruganti committed Feb 22, 2024
1 parent 07651cb commit 364ba9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 4 additions & 1 deletion example/discord/honcho-dspy-personas/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ async def on_reaction_add(reaction, user):
print(f"Added to thumbs down: {reaction.message.content}")

# TODO: we need to append these to the examples list within the user state json object

# append example
# example = Example(chat_input=chat_input, assessment_dimension=user_state, response=response).with_inputs('chat_input')
# examples.append(example)
# user_state_storage[user_state]["examples"] = examples


@bot.slash_command(name = "restart", description = "Restart the Conversation")
Expand Down
7 changes: 2 additions & 5 deletions example/discord/honcho-dspy-personas/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ async def chat(user_message: Message, session: Session, chat_history: List[Messa

user_chat_module = ChatWithThought()

# TODO: you'd want to initialize user state object from Honcho
# Save the user_state if it's new
if is_state_new:
user_state_storage[user_state] = {
Expand All @@ -71,6 +72,7 @@ async def chat(user_message: Message, session: Session, chat_history: List[Messa
user_state_data = user_state_storage[user_state]

# Optimize the state's chat module if we've reached the optimization threshold
# TODO: read in examples from Honcho User Object
examples = user_state_data["examples"]
print(f"Num examples: {len(examples)}")

Expand All @@ -91,9 +93,4 @@ async def chat(user_message: Message, session: Session, chat_history: List[Messa
response = user_chat_module(user_message=user_message, session=session, chat_input=chat_input)
dspy_gpt4.inspect_history(n=2)

# append example
example = Example(chat_input=chat_input, assessment_dimension=user_state, response=response).with_inputs('chat_input')
examples.append(example)
user_state_storage[user_state]["examples"] = examples

return response

0 comments on commit 364ba9a

Please sign in to comment.