From 364ba9a237fee4b58c4a6bf9a03a85cd781f6fe3 Mon Sep 17 00:00:00 2001 From: vintro Date: Wed, 21 Feb 2024 22:44:33 -0500 Subject: [PATCH] ready for user object (tbomk) --- example/discord/honcho-dspy-personas/bot.py | 5 ++++- example/discord/honcho-dspy-personas/graph.py | 7 ++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/discord/honcho-dspy-personas/bot.py b/example/discord/honcho-dspy-personas/bot.py index 5efd9e2..948bdb3 100644 --- a/example/discord/honcho-dspy-personas/bot.py +++ b/example/discord/honcho-dspy-personas/bot.py @@ -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") diff --git a/example/discord/honcho-dspy-personas/graph.py b/example/discord/honcho-dspy-personas/graph.py index 7b46d05..9295a43 100644 --- a/example/discord/honcho-dspy-personas/graph.py +++ b/example/discord/honcho-dspy-personas/graph.py @@ -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] = { @@ -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)}") @@ -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