Skip to content

Commit

Permalink
fix: get evaluation result (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed Apr 6, 2024
1 parent 8468f99 commit a4e6112
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"start:ml": ". ./packages/ml/venv/bin/activate && python3 packages/ml/main.py",
"build:frontend": "npm -w packages/frontend run build",
"migrate:db": "npm -w packages/backend run migrate:db",
"dev": "concurrently \"npm run dev:frontend\" \"npm run dev:backend\" \"npm run dev:radar\"",
"dev": "concurrently \"npm run dev:frontend\" \"npm run dev:backend\"",
"dev:frontend": "npm -w packages/frontend run dev",
"dev:backend": "npm -w packages/backend run dev",
"dev:radar": "npm -w packages/backend run dev:radar",
Expand Down
22 changes: 13 additions & 9 deletions packages/backend/src/api/v1/evaluations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,21 @@ evaluations.get(
checkAccess("evaluations", "read"),
async (ctx: Context) => {
const { evaluationId } = ctx.params
const { projectId } = ctx.state

const results = await sql`
select
*,
p.id as prompt_id
from
evaluation_result er
left join dataset_prompt p on p.id = er.prompt_id
left join dataset_prompt_variation pv on pv.id = er.variation_id
where
er.evaluation_id = ${evaluationId}`
select
*,
p.id as prompt_id
from
evaluation_result er
left join evaluation e on e.id = er.evaluation_id
left join dataset_prompt p on p.id = er.prompt_id
left join dataset_prompt_variation pv on pv.id = er.variation_id
where
er.evaluation_id = ${evaluationId}
and e.project_id = ${projectId}
`

ctx.body = results
},
Expand Down

0 comments on commit a4e6112

Please sign in to comment.