DatagroutConduit.GuidedSession (DataGrout Conduit v0.5.0)

Copy Markdown View Source

Wraps a guided execution session, providing choose/2 and complete/1.

A guided session is started via the guide extension on the client and walks the user through a multi-step tool selection workflow.

Usage

{:ok, session} = DatagroutConduit.GuidedSession.start(client, goal: "send an email")
session = DatagroutConduit.GuidedSession.choose(session, 0)
{:ok, result} = DatagroutConduit.GuidedSession.complete(session)

Summary

Functions

Make a choice by option index and advance the session.

Complete the session and return the final result.

Returns the current options list.

Start a guided session for the given goal.

Returns the current session status.

Types

t()

@type t() :: %DatagroutConduit.GuidedSession{
  client: GenServer.server(),
  session_id: String.t() | nil,
  state: DatagroutConduit.Types.GuideState.t()
}

Functions

choose(session, option_index)

@spec choose(t(), non_neg_integer()) :: {:ok, t()} | {:error, term()}

Make a choice by option index and advance the session.

Returns {:ok, updated_session} or {:error, reason}.

complete(guided_session)

@spec complete(t()) :: {:ok, map() | nil} | {:error, term()}

Complete the session and return the final result.

Returns {:ok, result} if the session status is "completed", or {:error, reason} if the workflow is not yet done.

options(guided_session)

@spec options(t()) :: [DatagroutConduit.Types.GuideOption.t()]

Returns the current options list.

start(client, opts)

@spec start(
  GenServer.server(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Start a guided session for the given goal.

Options

  • :goal - Natural language description of the goal (required)

status(guided_session)

@spec status(t()) :: String.t() | nil

Returns the current session status.