avatarLaxfed Paulacy

Summary

The undefined website introduces two new "human in the loop" features, Interrupt and Authorize, in OpenGPTs, powered by LangGraph, to enhance the interaction between humans and language models.

Abstract

The undefined website discusses the integration of human oversight in language model applications through the introduction of two novel features: Interrupt and Authorize. These features are part of the OpenGPTs framework and are enabled by the LangGraph library, which facilitates the development of multi-actor, multi-step, and stateful language model applications. The Interrupt feature allows users to pause the application, review the current state, and decide whether to resume, input new data, or take no action. The Authorize feature enables users to pre-emptively set conditions for the application to defer control to them when specific actors are invoked. This approach aims to create more powerful and collaborative applications by combining the strengths of language models with human judgment and intervention.

Opinions

  • The website suggests that the combination of an LLM with a search engine can lead to the creation of powerful applications that a single actor alone could not achieve.
  • It emphasizes the importance of proper coordination and order of actions in multi-step interactions between different actors within an application.
  • The concept of a shared, central state is presented as crucial for observing, interrupting, and modifying the application process.
  • The authors believe that human-in-the-loop capabilities are essential for developing interactive and supervisory roles for users in language model applications.
  • The website implies that privacy is a significant consideration in the development of open-source plugin infrastructures for OpenGPTs and LLM applications.

LANGCHAIN — Is Human-in-the-Loop Possible with OpenGPTs and LangGraph?

The most profound technologies are those that disappear. They weave themselves into the fabric of everyday life until they are indistinguishable from it. — Mark Weiser.

Human-in-the-loop with OpenGPTs and LangGraph

Today, we’re introducing two “human in the loop” features in OpenGPTs, Interrupt and Authorize, both powered by LangGraph. LangGraph is a library created to assist developers in constructing multi-actor, multi-step, stateful LLM applications. Let’s dive into each feature.

Multi-actor

A team of specialists can build something together that none of them could build alone. Similarly, combining an LLM with a search engine in novel ways can lead to the creation of powerful applications.

# Define actors
actors = {
    "LLM": LLM_actor,
    "search_engine": search_engine_actor
}

# Define work handoff
work_handoff = {
    "LLM": "search_engine",
    "search_engine": "LLM"
}

# Schedule execution
schedule_execution(actors, work_handoff)

Multi-step

Model the interaction between actors as happening across multiple discrete steps, ensuring proper coordination and order of actions.

# Define multi-step interactions
for step in range(total_steps):
    actor1_work = actor1.handle_work()
    actor2_work = actor2.handle_work(actor1_work)

Stateful

Communication across steps implies updating of some state, and a single central state helps in collaboration and easy snapshotting.

# Update central state
central_state.update(actor1_state)
central_state.update(actor2_state)

# Snapshot central state
snapshot_state(central_state)

Human-in-the-loop

A shared state makes the process easier to observe, interrupt, and modify. LangGraph introduces support for two forms of Human in the Loop in OpenGPTs: Interrupt and Authorize.

Interrupt

The Interrupt mode allows the user to manually interrupt the application and choose to resume from that point onwards, send new input, or take no action.

# Implement Interrupt mode
def on_interrupt():
    # Save state
    save_state()
    # User actions
    if user_action == "resume":
        resume_computation()
    elif user_action == "send_new_input":
        send_new_input()
    else:
        do_nothing()

Authorize

In the Authorize mode, the user can define ahead of time that they want the application to hand off control to them every time a particular actor is about to be called.

# Implement Authorize mode
def authorize_tool_call():
    if user_confirms_tool_call:
        resume_computation()
    elif user_sends_new_message:
        send_new_message()
    else:
        do_nothing()

Where to find this?

You can find an example notebook for building your own LangGraph application with Human-in-the-loop controls here.

In conclusion, with the introduction of Interrupt and Authorize modes in OpenGPTs, powered by LangGraph, human-in-the-loop control is now possible, providing users with a more interactive and supervisory role in the application’s processes.

Langchain
Possible
ChatGPT
Opengpts
Human In The Loop
Recommended from ReadMedium