Table of Contents

Class OpenApiHelper

Namespace
FunctionCalling
Assembly
AntRunnerLib.dll

Provides helper methods for validating and parsing OpenAPI specifications.

public class OpenApiHelper
Inheritance
System.Object
OpenApiHelper
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

Methods

GetRequestBuilders(JsonDocument, List<ToolDefinition>, String)

Generates request builders based on the OpenAPI specification.

public async Task<Dictionary<string, ActionRequestBuilder>> GetRequestBuilders(JsonDocument openapiSpec, List<ToolDefinition> toolDefinitions, string assistantName = null)

Parameters

openapiSpec System.Text.Json.JsonDocument

The OpenAPI specification as a System.Text.Json.JsonDocument.

toolDefinitions List<ToolDefinition>

The list of tool definitions extracted from the OpenAPI spec.

assistantName System.String

The assistant

Returns

Task<Dictionary<System.String, ActionRequestBuilder>>

A dictionary of ActionRequestBuilder objects with operation IDs as keys.

GetToolDefinitions(JsonDocument)

Extracts tool definitions from the OpenAPI specification.

public List<ToolDefinition> GetToolDefinitions(JsonDocument openapiSpec)

Parameters

openapiSpec System.Text.Json.JsonDocument

The OpenAPI specification as a System.Text.Json.JsonDocument.

Returns

List<ToolDefinition>

A list of ToolDefinition objects extracted from the OpenAPI spec.

ValidateAndParseOpenAPISpec(String)

Validates and parses the OpenAPI specification string.

public ValidationResult ValidateAndParseOpenAPISpec(string specString)

Parameters

specString System.String

The OpenAPI specification string in JSON or YAML format.

Returns

ValidationResult

A ValidationResult indicating the validation result.