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

feat(product-assistant): trends generation failover #25769

Merged
merged 28 commits into from
Oct 30, 2024

Conversation

skoob13
Copy link
Contributor

@skoob13 skoob13 commented Oct 23, 2024

Problem

There is always a chance that the schema generation step will produce an incorrect schema. Instead of showing an error to the user, we can ask LLMs to fix the error and make a new result based on the validation errors. This step will be repeated multiple times until it reaches a working schema or the recursion limit.

Changes

Add an optional fail-over step for the agent:

  • Three attempts to generate a parseable schema.
  • After the third attempt, it shows a failure message with the retry button.
  • Visual feedback when the message has failed validation.
  • Merge messages after retries: duplicated and failure messages are filtered out.

Additionally, I added handling of network/parsing errors, so it shows a similar error message.

2024-10-29 12 42 02

Does this work well for both Cloud and self-hosted?

N/A

How did you test this code?

Unit tests + manual testing

@skoob13 skoob13 changed the title Feat/trends generation failover feat(product-assistant): trends generation failover Oct 23, 2024
@skoob13 skoob13 force-pushed the feat/trends-generation-failover branch from 7598454 to 680ea43 Compare October 25, 2024 13:10
@skoob13 skoob13 requested a review from Twixes October 28, 2024 15:59
@skoob13 skoob13 marked this pull request as ready for review October 28, 2024 15:59
@skoob13 skoob13 enabled auto-merge (squash) October 28, 2024 16:40
@skoob13 skoob13 disabled auto-merge October 28, 2024 19:18
@skoob13 skoob13 marked this pull request as draft October 29, 2024 08:15
@skoob13 skoob13 marked this pull request as ready for review October 29, 2024 11:47
Copy link
Contributor

github-actions bot commented Oct 29, 2024

Size Change: 0 B

Total Size: 1.15 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.15 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

  • chromium: 0 added, 4 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -18,6 +29,11 @@ export type ThreadMessage = RootAssistantMessage & {
status?: MessageStatus
}

const failureMessage: FailureMessage = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Global constants are typically SCREAMING_SNAKE_CASE, e.g. FAILURE_MESSAGE

@skoob13 skoob13 enabled auto-merge (squash) October 30, 2024 12:50
@skoob13 skoob13 merged commit 8de5762 into master Oct 30, 2024
93 checks passed
@skoob13 skoob13 deleted the feat/trends-generation-failover branch October 30, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants