Class OpenApiHelper
- Namespace
- FunctionCalling
- Assembly
- AntRunnerLib.dll
Provides helper methods for validating and parsing OpenAPI specifications.
public class OpenApiHelper
- Inheritance
-
System.ObjectOpenApiHelper
- 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
openapiSpecSystem.Text.Json.JsonDocumentThe OpenAPI specification as a System.Text.Json.JsonDocument.
toolDefinitionsList<ToolDefinition>The list of tool definitions extracted from the OpenAPI spec.
assistantNameSystem.StringThe 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
openapiSpecSystem.Text.Json.JsonDocumentThe 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
specStringSystem.StringThe OpenAPI specification string in JSON or YAML format.
Returns
- ValidationResult
A ValidationResult indicating the validation result.