-
Notifications
You must be signed in to change notification settings - Fork 0
Evals: Added prompt iteration & Real-time config display #241
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
13c3a3f
feat(*): added the iterate on prompt
Ayush8923 6681b62
Merge branch 'main' into feat/evals-prompt-iteration
Ayush8923 1bb9036
fix(evlas): added the markdown component which is geenrate via llm
Ayush8923 d33163b
fix(evals): added the score as a pill
Ayush8923 3936d7f
fix(evals): added the loader
Ayush8923 b651d40
Merge branch 'main' into feat/evals-prompt-iteration
Ayush8923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { apiClient } from "@/app/lib/apiClient"; | ||
|
|
||
| export async function POST( | ||
| request: NextRequest, | ||
| { params }: { params: Promise<{ id: string }> }, | ||
| ) { | ||
| try { | ||
| const { id } = await params; | ||
|
|
||
| let body: unknown = undefined; | ||
| try { | ||
| body = await request.json(); | ||
| } catch { | ||
| body = {}; | ||
| } | ||
|
|
||
| const { status, data } = await apiClient( | ||
| request, | ||
| `/api/v1/evaluations/${id}/improve-prompt`, | ||
| { | ||
| method: "POST", | ||
| body: JSON.stringify(body ?? {}), | ||
| }, | ||
| ); | ||
|
|
||
| return NextResponse.json(data ?? { error: "Backend error" }, { status }); | ||
| } catch (error: unknown) { | ||
| console.error("improve-prompt proxy error:", error); | ||
| return NextResponse.json( | ||
| { | ||
| success: false, | ||
| error: | ||
| error instanceof Error ? error.message : "Failed to improve prompt", | ||
| }, | ||
| { status: 500 }, | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import type { CommitMessageProps, ParsedCommit } from "@/app/lib/types/commit"; | ||
|
|
||
| const AI_GENERATED_PATTERN = | ||
| /^\[AI Generated\]\s*(?:improved from config version\s+v(\d+))?\s*(?:\(Evaluation:\s*([^)]+)\))?\s*(.*)$/i; | ||
|
|
||
| export function parseCommitMessage( | ||
| message: string | null | undefined, | ||
| ): ParsedCommit { | ||
| if (!message) return { isAIGenerated: false, body: "" }; | ||
| const match = message.match(AI_GENERATED_PATTERN); | ||
| if (!match) return { isAIGenerated: false, body: message }; | ||
| const [, fromVersionRaw, evalName, body] = match; | ||
| return { | ||
| isAIGenerated: true, | ||
| fromVersion: fromVersionRaw ? parseInt(fromVersionRaw, 10) : undefined, | ||
| evaluation: evalName?.trim(), | ||
| body: body?.trim() ?? "", | ||
| }; | ||
| } | ||
|
Ayush8923 marked this conversation as resolved.
|
||
|
|
||
| export default function CommitMessage({ | ||
| message, | ||
| className = "", | ||
| compact = false, | ||
| }: CommitMessageProps) { | ||
| const parsed = parseCommitMessage(message); | ||
|
|
||
| if (!parsed.isAIGenerated) { | ||
| return message ? <span className={className}>{message}</span> : null; | ||
| } | ||
|
|
||
| const metaParts: string[] = []; | ||
| if (parsed.fromVersion !== undefined) { | ||
| metaParts.push(`From v${parsed.fromVersion}`); | ||
| } | ||
| if (parsed.evaluation) { | ||
| metaParts.push(`Eval: ${parsed.evaluation}`); | ||
| } | ||
|
|
||
| return ( | ||
| <div className={`space-y-1 ${className}`}> | ||
| <div className="flex flex-wrap items-center gap-1.5"> | ||
| <span className="inline-flex items-center px-1.5 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wide bg-accent-primary/10 text-accent-primary"> | ||
| AI Generated | ||
| </span> | ||
| {metaParts.length > 0 && ( | ||
| <span className="text-xs text-text-secondary"> | ||
| {metaParts.join(" • ")} | ||
| </span> | ||
| )} | ||
| </div> | ||
| {parsed.body && ( | ||
| <div | ||
| className={ | ||
| compact | ||
| ? "text-xs text-text-primary max-h-24 overflow-y-auto pr-1 whitespace-pre-wrap" | ||
| : "text-xs text-text-primary whitespace-pre-wrap" | ||
| } | ||
| > | ||
| {parsed.body} | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| export interface ParsedCommit { | ||
| isAIGenerated: boolean; | ||
| fromVersion?: number; | ||
| evaluation?: string; | ||
| body: string; | ||
| } | ||
|
|
||
| export interface CommitMessageProps { | ||
| message: string | null | undefined; | ||
| className?: string; | ||
| compact?: boolean; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.