Table of Contents

Class ApiHelper

Namespace
OobaboogaAPIHelper
Assembly
DougWare.OobaboogaAPIHelper.dll

A helper class for interacting with the OobaboogaAPI extension.

public class ApiHelper
Inheritance
ApiHelper
Inherited Members

Methods

GenerateAsync(GenerateRequestBody, PromptTemplate)

Sends a request to the API to generate a response based on a given request body and prompt template.

public static Task<string> GenerateAsync(ApiHelper.GenerateRequestBody requestBody, PromptTemplate promptTemplate)

Parameters

requestBody ApiHelper.GenerateRequestBody

The request body to use for the generation request.

promptTemplate PromptTemplate

The prompt template to use for the generation request.

Returns

Task<string>

A Task that represents the asynchronous operation. The task result is a string containing the generated text.

Exceptions

HttpRequestException

Thrown if the API request does not return a success status code.

GetTokenCountAsync(string)

Sends a request to the API to get the token count of a given prompt.

public static Task<int> GetTokenCountAsync(string prompt)

Parameters

prompt string

The prompt to get the token count for.

Returns

Task<int>

A Task that represents the asynchronous operation. The task result is an integer representing the token count.

Exceptions

HttpRequestException

Thrown if the API request does not return a success status code.