Table of Contents

Class OpenAiInit

Namespace
BotManager.OpenAi.Expressions
Assembly
BotManager.OpenAi.dll

The OpenAI plugin will connect to the OpenAI api by using the ApiKey and allows you to run AI expressions like OpenAiChat.

Return type is null.

This json example initials OpenAI and returns null:
{ "$OpenAiInit": { "ApiKey": { "$Env": "OPENAI_API_KEY" } } }
public sealed class OpenAiInit : IExpression
Inheritance
OpenAiInit
Implements
Inherited Members

Constructors

OpenAiInit()

public OpenAiInit()

Properties

ApiKey

Gets and sets the OpenAI api key.

public IExpression? ApiKey { get; set; }

Property Value

IExpression

Service

Gets the internal OpenAI service.

[JsonIgnore]
public OpenAIService Service { get; }

Property Value

OpenAIService

Methods

ExecuteAsync(RuntimeContext, Type?)

Executes the expression in the given RuntimeContext. Please do not use this method to run an expression. Use ExecuteAsync(IExpression?) instead.

public Task<object?> ExecuteAsync(RuntimeContext context, Type? returnType)

Parameters

context RuntimeContext

The current runtime context.

returnType Type

The expected return type. Use typeof(object) for a generic result. Use null if you don't need the return value.

Returns

Task<object>

Returns the result of the expression.