-
Notifications
You must be signed in to change notification settings - Fork 319
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
New: Auto-Improve prompts feature + other tweaks #3185
Conversation
tinomarques
commented
Jan 31, 2025
- New: Auto-improve feature
- Update: Added support for streaming .reasoning from a message
- Misc: Variable changes no longer cause a dirty state
- Misc: Other ui tweaks
- Refactor: Variable state data type
- WIP (paused): Prompt evals panel
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Summary
🔍 Fume is reviewing this PR! 🔗 Track the review progress here: |
idx?: number; | ||
} | ||
|
||
export interface StateEval {} |
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.
Empty interfaces can cause type checking issues. Either remove this or add expected properties.
🔨 See the suggested fix
@@ -43,9 +43,14 @@
idx?: number;
}
-export interface StateEval {}
+export interface StateEval {
+ id: string;
+ name: string;
+ type: "classifier" | "test";
+ enabled: boolean;
+}
-// DB INTERFACE
+// DB INTERFACE
export interface PromptVersionReference {
id: string;
minor_version: number;
@@ -58,4 +63,4 @@
parent_prompt_version?: string | null;
experiment_id?: string | null;
updated_at?: string;
-}
+}
{content} | ||
</p> | ||
</div> | ||
); |
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.
No error handling if JSON parse fails. This could cause silent failures in the streaming response.
🔨 See the suggested fix
@@ -114,35 +114,25 @@
V{version + 1} <span className="">(Suggested)</span>
</h3>
<div className="flex flex-col gap-2">
- {parseImprovedMessages(improvement.content).map((msg, index) => (
- <MiniMessage
- key={index}
- role={msg.role}
- content={msg.content}
- />
- ))}
+ {(() => {
+ try {
+ return parseImprovedMessages(improvement.content).map((msg, index) => (
+ <MiniMessage
+ key={index}
+ role={msg.role}
+ content={msg.content}
+ />
+ ));
+ } catch (error) {
+ return (
+ <div className="text-red-500 text-sm p-4">
+ Error parsing improvement content. Please try again.
+ </div>
+ );
+ }
+ })()}
</div>
</div>
- </div>
- )}
-
- {/* Actions */}
- {improvement && !isImproving && (
- <div className="flex justify-center gap-2">
- <Button variant="outline" onClick={onCancel}>
- Cancel
- </Button>
- <Button
- className="bg-green-500 dark:bg-green-500 hover:bg-green-500/90 dark:hover:bg-green-500/90"
- onClick={onApplyImprovement}
- >
- Save Suggested Version
- </Button>
- </div>
- )}
- </div>
- );
-}
const MiniMessage = ({ role, content }: { role: string; content: string }) => (
<div className="flex flex-col gap-1">
const handleImprove = useCallback(async () => { | ||
setIsImproving(true); | ||
|
||
const prompt = autoImprovePrompt(state?.messages || []); |
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.
Add a guard clause to return early if state is null to prevent runtime errors.
Testing
|
@@ -210,7 +210,7 @@ const Sidebar = ({ changelog, setOpen, sidebarRef }: SidebarProps) => { | |||
// ], | |||
// }, | |||
], | |||
[pathname, user?.email] |
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 is this here?