Skip to content

Commit

Permalink
Fix interrupt on tools
Browse files Browse the repository at this point in the history
  • Loading branch information
nfcampos committed May 6, 2024
1 parent 4aef884 commit 3ed53ff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/app/api/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from sse_starlette import EventSourceResponse

from app.auth.handlers import AuthedUser
from app.storage import get_thread
from app.storage import get_assistant, get_thread
from app.lifespan import get_langserve

router = APIRouter()
Expand Down Expand Up @@ -50,6 +50,9 @@ async def stream_run(
thread = await get_thread(user["user_id"], payload.thread_id)
if not thread:
raise HTTPException(status_code=404, detail="Thread not found")
assistant = await get_assistant(user["user_id"], thread["assistant_id"])
if not assistant:
raise HTTPException(status_code=404, detail="Assistant not found")

return EventSourceResponse(
(
Expand All @@ -60,6 +63,11 @@ async def stream_run(
input=payload.input,
config=payload.config,
stream_mode="messages",
interrupt_before=["action"]
if assistant["config"]["configurable"].get(
"type==agent/interrupt_before_action"
)
else None,
)
)
)
Expand Down

0 comments on commit 3ed53ff

Please sign in to comment.