Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the capabilities of the AI Intent plugin #1482

Closed
johnlanni opened this issue Nov 6, 2024 · 0 comments · Fixed by #1605
Closed

Enhance the capabilities of the AI Intent plugin #1482

johnlanni opened this issue Nov 6, 2024 · 0 comments · Fixed by #1605

Comments

@johnlanni
Copy link
Collaborator

johnlanni commented Nov 6, 2024

Why do you need it?

The AI Intent plugin may need to complete intent recognition tasks under different requirement scenarios, such as:

  1. Identifying the complexity of the current request and the domain of the question, which is used for routing to different models (for example, coding-related questions to Claude);
  2. Identifying whether the current request has time sensitivity or characteristics that prevent returning cached content, which is used to control whether to enable AI caching capabilities;
  3. Identifying the purpose of the current request, which is recorded in logs for data organization and analysis.

But the current AI Intent plugin can only recognize one intent.

Implementation suggestions

Modify the implementation of the AI Intent plugin to support the following configuration:

prompt: |
  You are an intelligent category recognition assistant, responsible for determining which preset category a question belongs to based on the user's query and predefined categories, and providing the corresponding category. 
   The user's question is: '${question}'
   The preset categories are: 
   ${categories}

   Please respond directly with the category in the following manner:
   - {"useFor": "scene1", "result": "result1"}
   - {"useFor": "scene2", result: "result2"}
   Ensure that different `useFor` are on different lines, and that `useFor` and `result` appear on the same line.
categories:
- useFor: intent-route
  options: 
  - Finance
  - E-commerce 
  - Law
  - Others
- useFor: disable-cache
  options:
  - Time-sensitive
  - An innovative response is needed
  - Others
llm:
  serviceName: "qwen.dns"
  servicePort: "443"
  url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"
  model: "qwen-long"
  apiKey: "xxxxx"
  timeoutSeconds: "10"

Here, I have made some optimizations to the plugin configuration to make it easier for users to set up. I suggest that implementers refer to these changes and modify the original plugin configuration parsing logic.

example:

image

For the configuration example above, the category of intent-route is set in the property this way.

proxywasm.SetProperty([]string{"intent_category:intent-route"}, "Finance")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants