A class that implements the IntentMatcher interface to match intents using OpenAI's API. This class is responsible for analyzing an intent, matching it to a registered tool, and parsing the required parameters for the matched tool.

Implements

Constructors

Properties

name: "OpenAI Intent Matcher" = 'OpenAI Intent Matcher'

The name of the intent matcher.

requiredCredentialNames: readonly ["openAiApiKey"] = ...

The required credential names for this intent matcher.

Methods

  • Analyzes the provided intent and matches it to a registered tool. If a tool is matched, it also parses the required parameters from the intent.

    Parameters

    • intent: string

      The intent to be analyzed.

    • registeredTools: AwTool<any, any>[]

      An array of registered tools to match against the intent.

    Returns Promise<IntentMatcherResponse<any>>

    • A promise that resolves to an object containing the analysis, matched tool, and parameters.

    Throws

    • Throws an error if the OpenAI client is not initialized.