beaker-kernel
    Preparing search index...

    Class BeakerSession

    Main class for connecting to and working with a Beaker kernel.

    Index

    Constructors

    Properties

    notebook: BeakerNotebook

    Accessors

    • get kernel(): null | IKernelConnection

      A reference to the Jupyter KernelConnection object for this session.

      Returns null | IKernelConnection

    • get prevClientId(): undefined | string

      Returns undefined | string

    • get services(): ServiceManager

      A reference to the Jupyter ServiceManager which contains all of the services for this session.

      Returns ServiceManager

    • get session(): SessionContext

      A reference to the underlying Jupyter SessionContext for this Beaker Session.

      Returns SessionContext

    • get sessionReady(): Promise<void>

      A promise that resolves once everything the session requires are also ready.

      Returns Promise<void>

    Methods

    • Parameters

      • source: string

        The code contents of the cell.

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      • outputs: never[] = []

        (Optional) Any outputs that should be included/displayed.

      Returns BeakerCodeCell

      • A reference to the generated cell
    • Convenience method for adding a MarkdownCell to the notebook

      Parameters

      • source: string

        The raw markdown encoded text that should be rendered upon execute

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      Returns BeakerMarkdownCell

      • A reference to the generated cell
    • Convenience method for adding a QueryCell to the notebook

      Parameters

      • source: string

        The contents of the query for the LLM as a plain string

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      Returns BeakerQueryCell

      • A reference to the generated cell
    • Convenience method for adding a RawCell to the notebook

      Parameters

      • source: string

        The raw contents to be included in the raw cell.

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      Returns BeakerRawCell

      • A reference to the generated cell
    • Executes a Beaker Action, handling all of the message

      The usual IBeakerFuture response handlers can be applied to the returned future to do act upon the responses.

      Parameters

      • actionName: string

        Name of the action to execute

      • payload: JSONObject

        Payload to pass along with the action

      • OptionalmessageId: string

        (Optional) Id for request message. If not provided, will be generated automatically.

      Returns IBeakerFuture

      • A future
    • Interrupt the kernel activity, stopping execution in both the beaker LLM ReAct loop and the subkernel as needed. See

      Returns Promise<any>

      • A future
    • Populates the sessions notebook with the provided notebook json

      Parameters

      • notebookJSONObject: object

        The json representation of a notebook, as found inside an .ipynb file

      Returns void

    • Low-level method for reconnecting to the kernel.

      Returns Promise<SessionContext>

    • Completely resets the session, clearing the notebook and history, and restarting the fresh kernel so it is in a fresh state.

      Returns void

    • Low-level method for sending a message to the Beaker kernel over the "shell" channel.

      Parameters

      • messageType: string

        The message type, as passed in msg.header.msg_type

      • content: JSONObject

        Any JSON-encodable payload to be included with the message

      • OptionalmessageId: string

        (Optional) Pre-defined id for the message. One will be generated if not provided.

      • Optionalmetadata: { [key: string]: any }

      Returns IBeakerFuture