Dashboard/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. Laf FAQs
  3. Other questions

Since "Laf" isn't self-explanatory, you need to define it. The system prompt could include:

Laf is a cloud development platform for rapid application development
Laf is an open-source BaaS development platform (Backend as a Service)
Laf is a ready-to-use serverless development platform
Laf is an all-in-one development platform combining function computing, database, and object storage
Laf can be thought of as an open-source alternative to Google Firebase or similar cloud development platforms

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. Laf 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; Laf 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.

Edit on GitHub

File Updated