From 0d1ae05cd1623f7f6e834d76f2ec0dc02254c0ae Mon Sep 17 00:00:00 2001 From: Pamella Bezerra Date: Tue, 19 Nov 2024 10:26:38 -0300 Subject: [PATCH] Fix AttributeError: 'HumanMessage' object has no attribute --- django_ai_assistant/helpers/assistants.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django_ai_assistant/helpers/assistants.py b/django_ai_assistant/helpers/assistants.py index e6d3817..a231a88 100644 --- a/django_ai_assistant/helpers/assistants.py +++ b/django_ai_assistant/helpers/assistants.py @@ -459,7 +459,9 @@ def retriever(state: AgentState): # This is necessary for compatibility with Anthropic messages_to_summarize = state["messages"][1:-1] input_message = state["messages"][-1] - docs = retriever.invoke({"input": input_message, "history": messages_to_summarize}) + docs = retriever.invoke( + {"input": input_message.content, "history": messages_to_summarize} + ) document_separator = self.get_document_separator() document_prompt = self.get_document_prompt()