Files
Projet-Agent-IA/AgentReact/utils/state.py

26 lines
827 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from langgraph.graph import StateGraph, MessagesState
from typing import List, Annotated
import operator
class CustomState(MessagesState):
todo: Annotated[list, operator.add] # Les tâches en cours, au format JSON
ragQuery: str # Requête envoyée au RAG, pour le cross-encodeur
ragDocuments: List[str] # Documents retrouvés par le RAG, pour le cross-encodeur
lastSummarizedMessage: int # Index du message où l'on s'était arrêté de résumer
stop: bool # Permet d'indiquer la fin de l'exécution de l'agent
# TODO: Ajouter la source des documents sélectionnés pour la fin du rapport ?
def getState()->StateGraph:
"""
Retourne un StateGraph prêt à utiliser pour préparer un workflow
Returns:
StateGraph: prêt à utiliser
"""
return StateGraph(CustomState)