4. Chatbot with human-in-loop scenarios

  • A human-in-loop workflow integrates human input into automated processes, allowing for decisions, validation, or corrections at key stages.
  • This is especially usefull in LLM-based applications, where the underlying model may generate occational inaccuracies.
  • Use Cases:
    • Reviewing tool calls: Humans can review, edit, or approve tool calls requested by the LLM before tool execution.
    • Validating LLM outputs: Humans can review, edit, or approve content generated by the LLM.
    • Providing context: Enable the LLM to explicitly request human input for clarification or additional details or to support multi-turn conversations.

Design Patterns

1. Approve or Reject
  • Pause the graph before a critical step, such as an API call, to review and approve the action.
  • If the action is rejected, you can prevent the graph from executing the step, and potentially take an alternative action. This pattern often involve routing the graph based on the human’s input.
2. Review & Edit State:
  • A human can review and edit the state of the graph. This is useful for correcting mistakes or updating the state with additional information.
3. Review Tool Calls:
  • A human can review and edit the output from the LLM before proceeding.
  • This is particularly critical in applications where the tool calls requested by the LLM may be sensitive or require human oversight.