Human in the loop
Implémentation fonctionelle de l'HITL !
This commit is contained in:
@@ -4,9 +4,11 @@ from tavily import TavilyClient
|
||||
from pathlib import Path
|
||||
from typing import List, Dict, Annotated
|
||||
import sys
|
||||
from .StateElements.TodoElement import TodoElement
|
||||
from langgraph.types import interrupt
|
||||
|
||||
from .StateElements.TodoElement import TodoElement
|
||||
from .VectorDatabase import VectorDatabase
|
||||
from .InterruptPayload import InterruptPayload
|
||||
|
||||
@tool
|
||||
def internet_search(query: str)->dict:
|
||||
@@ -18,7 +20,16 @@ def internet_search(query: str)->dict:
|
||||
Returns:
|
||||
dict: Retour de la recherche
|
||||
"""
|
||||
return TavilyClient().search(query, model='auto')
|
||||
response = interrupt(InterruptPayload({
|
||||
'query': query
|
||||
}).toJSON())
|
||||
|
||||
resp = InterruptPayload.fromJSON(response) # Je reforme mon objet depuis la string json
|
||||
|
||||
if resp.isAccepted():
|
||||
return TavilyClient().search(resp.get("query"), model='auto')
|
||||
else:
|
||||
return {'error': "Utilisation de cet outil refusée par l'utilisateur"}
|
||||
|
||||
|
||||
@tool
|
||||
|
||||
Reference in New Issue
Block a user