I am working based off the StateManagement Bot sample from the Bot Framework repository.
I believe I have a decent grasp of the Bot and State architecture. My question is in regards to using a custom class that I am getting and setting as part of the conversation data that is maintained in my state
class ChatRequest:
def __init__(self, chat_history: List[ChatMessage] = None, question: str = None, chat_id: str = None):
self.chat_history = chat_history,
self.question = question,
self.chat_id = chat_id,
def toJSON(self):
return json.dumps(
self,
default=lambda o: o.__dict__,
sort_keys=False,
indent=4
)
I am using the ConversationState type to create a data property that retrieves and handles this object. I am stuck at modifying the chat_history attribute, a list, how do I update the current value and store it in memory to be retrieved on the next turn? Currently, I’m retrieving it with the state’s get() method and it imports it as a tuple. Tuples are immutable, however, so I’m looking to update my list with previous data and extend it. Exactly how the spread operator works in JavaScript.
Does the question make sense? Am I going about this in the wrong way?
I’ve tried also to set() a new object in the context of the turn but when I pass in a new object I receive type errors that ‘list is not hashable’ even after trying to wrap it in a dict.