-
Notifications
You must be signed in to change notification settings - Fork 6
feat: introduce autocorrected app selection based on fields #7
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
base: main
Are you sure you want to change the base?
feat: introduce autocorrected app selection based on fields #7
Conversation
|
@frikky Take a look at this when you get some time :) |
frikky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stop using and thinking in terms of for-loops and if-statements.
pkg/api.go
Outdated
|
|
||
| if strings.ToLower(value.AppName) == "http" { | ||
| // Smart app correction: Check if we should analyze intent and correct app selection | ||
| if strings.ToLower(value.AppName) == "http" && (value.Label == "api" || value.Label == "custom_action" || value.Action == "custom_action") && len(value.Query) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
custom_action is associated with having an app. We should not do re-selection in that case.
pkg/api.go
Outdated
| if !standalone { | ||
| tmpApps, tmpErr = shuffle.GetPrioritizedApps(ctx, user) | ||
| if tmpErr == nil && len(tmpApps) > 0 { | ||
| correctedAppName := AnalyzeIntentAndCorrectApp(ctx, value.Query, value.Fields, tmpApps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we passing in the "reason" as we discussed? ALL relevant information decided by the agent can and should be used.
pkg/api.go
Outdated
| // It caches results by URL | ||
| // Returns corrected app name or empty string if no correction needed | ||
| func AnalyzeIntentAndCorrectApp(ctx context.Context, | ||
| query string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wtf is this formatting 😆
Please just keep it one line.
pkg/api.go
Outdated
| - URL being called: "%s" | ||
| - Input fields provided: %s | ||
| Available apps: %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This SPECIFICALLY is an absolutely horrendous choice.
Again, when dealing with LLMs, stop thinking in terms of for-loops and if-statements!
You are forcing the user to have perfect information available already. That is not the right choice. Which I mentioned about 283 times in the last call.
pkg/api.go
Outdated
| func AnalyzeIntentAndCorrectApp(ctx context.Context, | ||
| query string, | ||
| fields []shuffle.Valuereplace, | ||
| availableApps []shuffle.WorkflowApp) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are absolutely intend on doing it based on "availableApps", why don't you just for-loop and search for it? LLM's are not necessary.
Bad choice of LLM use.
pkg/api.go
Outdated
| } | ||
|
|
||
| if len(foundApp) > 0 && foundApp != "http" { | ||
| // Cache for 3 days - same domain = same app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we doing domain name usage? What if we don't have it?
Stop using and thinking in terms of for-loops and if-statements.
What's Changed ?
This PR adds App detection when agents mistakenly select the generic HTTP app instead of a specific integration (e.g., Gmail, Slack).
It achieves this by adding a condition that automatically corrects to the appropriate app if a match is found using an LLM along with the fields and a special reason field sent by the agent and falls back to HTTP if no specific app matches or HTTP is genuinely correct.
Also look at this PR: Shuffle/shuffle-shared#291