Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

categorize.mdx 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ---
  2. sidebar_position: 8
  3. slug: /categorize_component
  4. ---
  5. # Categorize component
  6. A component that classifies user inputs and applies strategies accordingly.
  7. ---
  8. A **Categorize** component is usually the downstream of the **Interact** component.
  9. ## Scenarios
  10. A **Categorize** component is essential when you need the LLM to help you identify user intentions and apply appropriate processing strategies.
  11. ## Configurations
  12. ### Query variables
  13. *Mandatory*
  14. Select the source for categorization.
  15. The **Categorize** component relies on query variables to specify its data inputs (queries). All global variables defined before the **Categorize** component are available in the dropdown list.
  16. ### Input
  17. The **Categorize** component relies on input variables to specify its data inputs (queries). Click **+ Add variable** in the **Input** section to add the desired input variables. There are two types of input variables: **Reference** and **Text**.
  18. - **Reference**: Uses a component's output or a user input as the data source. You are required to select from the dropdown menu:
  19. - A component ID under **Component Output**, or
  20. - A global variable under **Begin input**, which is defined in the **Begin** component.
  21. - **Text**: Uses fixed text as the query. You are required to enter static text.
  22. ### Model
  23. Click the dropdown menu of **Model** to show the model configuration window.
  24. - **Model**: The chat model to use.
  25. - Ensure you set the chat model correctly on the **Model providers** page.
  26. - You can use different models for different components to increase flexibility or improve overall performance.
  27. - **Freedom**: A shortcut to **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty** settings, indicating the freedom level of the model. From **Improvise**, **Precise**, to **Balance**, each preset configuration corresponds to a unique combination of **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**.
  28. This parameter has three options:
  29. - **Improvise**: Produces more creative responses.
  30. - **Precise**: (Default) Produces more conservative responses.
  31. - **Balance**: A middle ground between **Improvise** and **Precise**.
  32. - **Temperature**: The randomness level of the model's output.
  33. Defaults to 0.1.
  34. - Lower values lead to more deterministic and predictable outputs.
  35. - Higher values lead to more creative and varied outputs.
  36. - A temperature of zero results in the same output for the same prompt.
  37. - **Top P**: Nucleus sampling.
  38. - Reduces the likelihood of generating repetitive or unnatural text by setting a threshold *P* and restricting the sampling to tokens with a cumulative probability exceeding *P*.
  39. - Defaults to 0.3.
  40. - **Presence penalty**: Encourages the model to include a more diverse range of tokens in the response.
  41. - A higher **presence penalty** value results in the model being more likely to generate tokens not yet been included in the generated text.
  42. - Defaults to 0.4.
  43. - **Frequency penalty**: Discourages the model from repeating the same words or phrases too frequently in the generated text.
  44. - A higher **frequency penalty** value results in the model being more conservative in its use of repeated tokens.
  45. - Defaults to 0.7.
  46. :::tip NOTE
  47. - It is not necessary to stick with the same model for all components. If a specific model is not performing well for a particular task, consider using a different one.
  48. - If you are uncertain about the mechanism behind **Temperature**, **Top P**, **Presence penalty**, and **Frequency penalty**, simply choose one of the three options of **Preset configurations**.
  49. :::
  50. ### Message window size
  51. An integer specifying the number of previous dialogue rounds to input into the LLM. For example, if it is set to 12, the tokens from the last 12 dialogue rounds will be fed to the LLM. This feature consumes additional tokens.
  52. Defaults to 1.
  53. :::tip IMPORTANT
  54. This feature is used for multi-turn dialogue *only*. If your **Categorize** component is not part of a multi-turn dialogue (i.e., it is not in a loop), leave this field as-is.
  55. :::
  56. ### Category name
  57. A **Categorize** component must have at least two categories. This field sets the name of the category. Click **+ Add Item** to include the intended categories.
  58. :::tip NOTE
  59. You will notice that the category name is auto-populated. No worries. Each category is assigned a random name upon creation. Feel free to change it to a name that is understandable to the LLM.
  60. :::
  61. #### Description
  62. Description of this category.
  63. You can input criteria, situation, or information that may help the LLM determine which inputs belong in this category.
  64. #### Examples
  65. Additional examples that may help the LLM determine which inputs belong in this category.
  66. :::danger IMPORTANT
  67. Examples are more helpful than the description if you want the LLM to classify particular cases into this category.
  68. :::
  69. Once a new category is added, navigate to the **Categorize** component on the canvas, find the **+** button next to the case, and click it to specify the downstream component(s).
  70. #### Output
  71. The global variable name for the output of the component, which can be referenced by other components in the workflow. Defaults to `category_name`.