Skip to content

Commit 976e766

Browse files
committed
rpc eval endpoint not erroring :)
1 parent d3e296d commit 976e766

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

server/src/rpc/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ impl OllyllmService for OllyllmRpcDefinition {
7272
.order_by(eval_version::created_at.desc())
7373
.first::<EvalVersion>(repo.connection)
7474
.optional()
75-
.map_err(|_| tonic::Status::internal("Failed to fetch latest test registration"))?;
75+
.map_err(|e| {
76+
println!("{}", e);
77+
tonic::Status::internal("Failed to fetch eval version")
78+
})?;
7679

7780
let existing_eval_version = match existing_eval_version {
7881
Some(v) => v,
@@ -98,6 +101,7 @@ impl OllyllmService for OllyllmRpcDefinition {
98101
.table
99102
.order_by(eval_result::created_at.desc())
100103
.first::<EvalResult>(repo.connection)
104+
.optional()
101105
.map_err(|_| tonic::Status::internal("Failed to fetch latest test registration"))?;
102106

103107
let scores: EvalRunScores = eval_scores
@@ -116,10 +120,12 @@ impl OllyllmService for OllyllmRpcDefinition {
116120
})
117121
.map_err(|_| tonic::Status::internal("Failed to create new eval result"))?;
118122

119-
let previous_results: EvalRunScores =
120-
serde_json::from_value(previous_eval_result.scores).unwrap();
123+
if let Some(previous_result) = previous_eval_result {
124+
let previous_results: EvalRunScores =
125+
serde_json::from_value(previous_result.scores).unwrap();
121126

122-
compare_results(previous_results, scores);
127+
compare_results(previous_results, scores);
128+
}
123129

124130
Ok(tonic::Response::new(RecordEvalResponse {
125131
outcome: EvalOutcome::Unknown.into(),

0 commit comments

Comments
 (0)