🎨 Reset retrieved sources

This commit is contained in:
Ruben Lucas 2025-04-09 16:30:39 +02:00
parent 67ba306d3e
commit df2afd73cb

View File

@ -95,6 +95,10 @@ class CondRetGenLangGraph:
def _query_or_respond(self, state: MessagesState) -> dict[str, BaseMessage]: def _query_or_respond(self, state: MessagesState) -> dict[str, BaseMessage]:
"""Generate tool call for retrieval or respond.""" """Generate tool call for retrieval or respond."""
# Reset last retrieved docs
self.last_retrieved_docs = {}
self.last_retrieved_sources = set()
llm_with_tools = self.chat_model.bind_tools([self._retrieve]) llm_with_tools = self.chat_model.bind_tools([self._retrieve])
response = llm_with_tools.invoke(state["messages"]) response = llm_with_tools.invoke(state["messages"])
return {"messages": [response]} return {"messages": [response]}