FastGPTFastGPT
App Building/Workflow/Nodes

Question Classification

FastGPT Question Classification node overview

Characteristics

  • Can be added multiple times
  • Has external input
  • Requires manual configuration
  • Trigger-based execution
  • function_call module

What It Does

Classifies user questions into categories and executes different operations based on the result. Classification may be less effective in ambiguous scenarios.

Parameters

System Prompt

Placed at the beginning of the conversation to provide supplementary definitions for classification categories. For example, questions might be classified as:

  1. Greetings
  2. Billing FAQs
  3. Other questions

Since "billing" can cover multiple cases, define it in the system prompt:

Billing FAQs include plan prices, balance, credit usage, renewals, invoices, and refunds
Questions about why credits were deducted, how to recharge, or where to view bills should be classified as Billing FAQs
General product feature questions or greetings should not be classified as Billing FAQs

Chat History

Adding some chat history enables context-aware classification.

User Question

The user's input content.

Classification Categories

Using the same 3 categories as an example, here is the resulting Function composition. The return values are randomly generated by the system and can be ignored.

  1. Greetings
  2. Billing FAQs
  3. Other questions
const agentFunction = {
    name: agentFunName,
    description: 'Determine which category the user question belongs to and return the corresponding enum value',
    parameters: {
      type: 'object',
      properties: {
        type: {
          type: 'string',
          description: `Greetings, return: abc; Billing FAQs, return: vvv; Other questions, return: aaa`
          enum: ["abc","vvv","aaa"]
        }
      },
      required: ['type']
    }
};

The Function above always returns one of type = abc, vvv, aaa, achieving the classification.