Find answers from the community

Updated last year

Hey Found a little bug in the low level

1
V
W
L
11 comments
You say in the doc that you are passing a tuple for the history in the custom_chat_history , hence the chat_history variable in the chat_engine = CondenseQuestionChatEngine.from_defaults() ask for a dictionnary.
Plain Text
Exception has occurred: ValidationError
1 validation error for ChatMemoryBuffer
chat_history -> 0
  value is not a valid dict (type=type_error.dict)
  File "C:\Projets\IA Chat Local\Sources\AzureOpenAI2\testindex copy.py", line 113, in <module>
    chat_engine = CondenseQuestionChatEngine.from_defaults(
pydantic.error_wrappers.ValidationError: 1 validation error for ChatMemoryBuffer
chat_history -> 0
  value is not a valid dict (type=type_error.dict)
Yep, just checked failing for me too. Made it running by changing the way messages were added in chathistory list

Plain Text
custom_chat_history = [
    {"role":"system","content":"THis is system msg"},
]


This will make it run
You can use these roles if you want to have some initial convo
Plain Text
class MessageRole(str, Enum):
    """Message role."""

    SYSTEM = "system"
    USER = "user"
    ASSISTANT = "assistant"
    FUNCTION = "function"
maybe the docs are not updated 🧐
Looks like this slipped by yup
The docs are detailing an old/initial way of doing it before we had a defined structure
Will update this!
Fixed! Docs page should update shortly πŸ™‚
Add a reply
Sign up and join the conversation on Discord