Siren AI scripting API reference

Classes

GenerativeAi

Generative AI class. Accessible via sirenapi.extensions.GenerativeAi

Methods

generateGraphReport()
static generateGraphReport(graphModel, options?): Promise<{
  content: string;
}>;

Generate a report from a graph model

Parameters
Parameter Type Description

graphModel

GraphModel

The graph model to generate a report from. Retrieved from the graphBrowserVis.getGraphModel()

options?

{ customPrompt?: string; focusNodes?: string[]; }

Additional options

options.customPrompt?

string

The custom LLM prompt for generating the report

options.focusNodes?

string[]

The IDs of the nodes to focus on in the report

Returns

Promise<{ content: string; }>

  • The generated report content in Markdown format

Example
const graphVis = sirenapi.Visualization.getCurrentVisualizer()
const graphModel = await graphVis.getGraphModel()
await sirenapi.extensions.GenerativeAi.generateGraphReport(graphModel)

sendPrompt()
static sendPrompt(message, options?): Promise<{
  contextId: string;
  data: (ToolCall | K9Message)[];
}>;

Send a prompt to the AI

Parameters
Parameter Type Description

message

string

The message to send to the AI

options?

{ contextId?: string; }

Additional options

options.contextId?

string

The ID of the conversation context; helps the LLM remember previous messages

Returns

Promise<{ contextId: string; data: (ToolCall | K9Message)[]; }>

  • The response from the LLM test

Example
await sirenapi.extensions.GenerativeAi.sendPrompt('What is 2 * 4?')

Interfaces

K9Message

Extends

  • BaseMessage

Properties

content
content: string;

Formatted in Markdown

Inherited from
BaseMessage.content

errors?
optional errors: object;
attachment
attachment: string;

timestamp
timestamp: string;

ISO format

Inherited from
BaseMessage.timestamp

type
type: "message";
Inherited from
BaseMessage.type

user
user: K9;
Overrides
BaseMessage.user

ToolCall

Properties

callId
callId: string;

function
function: object;
arguments
arguments: string;

JSON string of arguments

name
name: string;

type
type: "function_call";