-
Notifications
You must be signed in to change notification settings - Fork 9
STT Evaluation: Refactor #601
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
Changes from all commits
ba6fe52
b1ee3de
0485949
b262cb6
6fc1234
23df9ea
a035718
7298e22
199c904
887e247
e5b44ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |||||
| from sqlmodel import Session | ||||||
|
|
||||||
| from app.core.batch import OpenAIBatchProvider, start_batch_job | ||||||
| from app.core.batch.base import BATCH_KEY | ||||||
| from app.core.util import now | ||||||
| from app.models import EvaluationRun | ||||||
|
|
||||||
|
|
@@ -58,7 +59,7 @@ def build_embedding_jsonl( | |||||
| Build JSONL data for embedding batch using OpenAI Embeddings API. | ||||||
|
|
||||||
| Each line is a dict with: | ||||||
| - custom_id: Langfuse trace_id (for direct score updates) | ||||||
| - BATCH_KEY: Langfuse trace_id (for direct score updates) | ||||||
| - method: POST | ||||||
| - url: /v1/embeddings | ||||||
| - body: Embedding request with input array [output, ground_truth] | ||||||
|
|
@@ -110,9 +111,9 @@ def build_embedding_jsonl( | |||||
| continue | ||||||
|
|
||||||
| # Build the batch request object for Embeddings API | ||||||
| # Use trace_id as custom_id for direct score updates | ||||||
| # Use trace_id as BATCH_KEY for direct score updates | ||||||
| batch_request = { | ||||||
| "custom_id": trace_id, | ||||||
| BATCH_KEY: trace_id, | ||||||
| "method": "POST", | ||||||
| "url": "/v1/embeddings", | ||||||
| "body": { | ||||||
|
|
@@ -155,10 +156,10 @@ def parse_embedding_results(raw_results: list[dict[str, Any]]) -> list[dict[str, | |||||
|
|
||||||
| for line_num, response in enumerate(raw_results, 1): | ||||||
| try: | ||||||
| # Extract custom_id (which is now the Langfuse trace_id) | ||||||
| trace_id = response.get("custom_id") | ||||||
| # Extract BATCH_KEY (which is now the Langfuse trace_id) | ||||||
| trace_id = response.get(BATCH_KEY) | ||||||
| if not trace_id: | ||||||
| logger.warning(f"Line {line_num}: No custom_id found, skipping") | ||||||
| logger.warning(f"Line {line_num}: No {BATCH_KEY} found, skipping") | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing The changed log message at line 162 is missing the required 🛠️ Proposed fix- logger.warning(f"Line {line_num}: No {BATCH_KEY} found, skipping")
+ logger.warning(f"[parse_embedding_results] Line {line_num}: No {BATCH_KEY} found, skipping")As per coding guidelines: "Prefix all log messages with the function name in square brackets: 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| continue | ||||||
|
|
||||||
| # Handle errors in batch processing | ||||||
|
|
||||||
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.
Avoid leaking internal exception details in the HTTP response.
detail=f"Failed to queue batch submission: {e}"exposes internal error information to the API client. Use a generic message instead; the detailed error is already logged on line 99.Suggested fix
raise HTTPException( status_code=500, - detail=f"Failed to queue batch submission: {e}", + detail="Failed to start evaluation. Please try again later.", )📝 Committable suggestion
🤖 Prompt for AI Agents