Class R2AI

Class that interacts with the r2ai plugin (requires rlang-python and r2i r2pm packages to be installed). Provides a way to script the interactions with different language models using javascript from inside radare2.

Hierarchy

  • R2AI

Constructors

  • Parameters

    • Optional num: number
    • Optional model: string

    Returns R2AI

Properties

available: boolean = false

Instance variable that informs if the r2ai plugin is loaded, must be true in order to use the rest of the methods of this class.

model: string = ""

Name of the model instantiated to be used for the subsequent calls.

Methods

  • Get the current selected model name.

    Returns string

    model name

  • Get a list of suggestions for model names to use.

    Returns string[]

    array of strings containing the model names known to work

  • Send message to the language model to be appended to the current conversation (see .reset())

    Parameters

    • msg: string

    Returns string

    response from the language model

  • Reset conversation messages

    Returns void

  • Set the Model name or path to the GGUF file to use.

    Parameters

    • modelName: string

    Returns boolean

    true if successful

  • Set the role (system prompt) message for the language model to obey.

    Parameters

    • msg: string

    Returns boolean

    true if successful

Generated using TypeDoc