Skip to content

Commit

Permalink
removes instructions system message from history before calling RAG
Browse files Browse the repository at this point in the history
  • Loading branch information
filipeximenes committed Sep 13, 2024
1 parent d8326c7 commit 25d4679
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django_ai_assistant/helpers/assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,9 @@ def retriever(state: AgentState):
return

retriever = self.get_history_aware_retriever()
messages_without_input = state["messages"][:-1]
# Remove the initial instructions to prevent having two SystemMessages
# This is necessary for compatibility with Anthropic
messages_without_input = state["messages"][1:-1]
docs = retriever.invoke({"input": state["input"], "history": messages_without_input})

document_separator = self.get_document_separator()
Expand Down

0 comments on commit 25d4679

Please sign in to comment.