@@ -65,7 +65,7 @@ async def create_eval_set_run(self):
6565 method = spec .method ,
6666 url = spec .endpoint ,
6767 params = spec .params ,
68- content = spec .content ,
68+ json = spec .json ,
6969 headers = spec .headers ,
7070 )
7171 self ._eval_set_run_id = json .loads (response .content )["id" ]
@@ -84,7 +84,7 @@ async def create_eval_run(self, eval_item: dict[str, Any]):
8484 method = spec .method ,
8585 url = spec .endpoint ,
8686 params = spec .params ,
87- content = spec .content ,
87+ json = spec .json ,
8888 headers = spec .headers ,
8989 )
9090 return json .loads (response .content )["id" ]
@@ -116,7 +116,7 @@ async def update_eval_run(
116116 method = spec .method ,
117117 url = spec .endpoint ,
118118 params = spec .params ,
119- content = spec .content ,
119+ json = spec .json ,
120120 headers = spec .headers ,
121121 )
122122
@@ -127,7 +127,7 @@ async def update_eval_set_run(self):
127127 method = spec .method ,
128128 url = spec .endpoint ,
129129 params = spec .params ,
130- content = spec .content ,
130+ json = spec .json ,
131131 headers = spec .headers ,
132132 )
133133
@@ -201,18 +201,16 @@ def _update_eval_run_spec(
201201 endpoint = Endpoint (
202202 f"agentsruntime_/api/execution/agents/{ self ._project_id } /evalRun"
203203 ),
204- content = json .dumps (
205- {
206- "evalRunId" : eval_run_id ,
207- "status" : EvaluationStatus .COMPLETED .value ,
208- "result" : {
209- "output" : {"content" : {** actual_output }},
210- "evaluatorScores" : evaluator_scores ,
211- },
212- "completionMetrics" : {"duration" : int (execution_time )},
213- "assertionRuns" : assertion_runs ,
214- }
215- ),
204+ json = {
205+ "evalRunId" : eval_run_id ,
206+ "status" : EvaluationStatus .COMPLETED .value ,
207+ "result" : {
208+ "output" : {"content" : {** actual_output }},
209+ "evaluatorScores" : evaluator_scores ,
210+ },
211+ "completionMetrics" : {"duration" : int (execution_time )},
212+ "assertionRuns" : assertion_runs ,
213+ },
216214 headers = self ._tenant_header (),
217215 )
218216
@@ -222,18 +220,16 @@ def _create_eval_run_spec(self, eval_item: dict[str, Any]) -> RequestSpec:
222220 endpoint = Endpoint (
223221 f"agentsruntime_/api/execution/agents/{ self ._project_id } /evalRun"
224222 ),
225- content = json .dumps (
226- {
227- "evalSetRunId" : self ._eval_set_run_id ,
228- "evalSnapshot" : {
229- "id" : eval_item ["id" ],
230- "name" : eval_item ["name" ],
231- "inputs" : eval_item .get ("inputs" ),
232- "expectedOutput" : eval_item .get ("expectedOutput" , {}),
233- },
234- "status" : EvaluationStatus .IN_PROGRESS .value ,
235- }
236- ),
223+ json = {
224+ "evalSetRunId" : self ._eval_set_run_id ,
225+ "evalSnapshot" : {
226+ "id" : eval_item ["id" ],
227+ "name" : eval_item ["name" ],
228+ "inputs" : eval_item .get ("inputs" ),
229+ "expectedOutput" : eval_item .get ("expectedOutput" , {}),
230+ },
231+ "status" : EvaluationStatus .IN_PROGRESS .value ,
232+ },
237233 headers = self ._tenant_header (),
238234 )
239235
@@ -247,15 +243,13 @@ def _create_eval_set_run_spec(
247243 endpoint = Endpoint (
248244 f"agentsruntime_/api/execution/agents/{ self ._project_id } /evalSetRun"
249245 ),
250- content = json .dumps (
251- {
252- "agentId" : self ._project_id ,
253- "evalSetId" : self ._eval_set_id ,
254- "agentSnapshot" : agent_snapshot_dict ,
255- "status" : EvaluationStatus .IN_PROGRESS .value ,
256- "numberOfEvalsExecuted" : self ._no_of_evals ,
257- }
258- ),
246+ json = {
247+ "agentId" : self ._project_id ,
248+ "evalSetId" : self ._eval_set_id ,
249+ "agentSnapshot" : agent_snapshot_dict ,
250+ "status" : EvaluationStatus .IN_PROGRESS .value ,
251+ "numberOfEvalsExecuted" : self ._no_of_evals ,
252+ },
259253 headers = self ._tenant_header (),
260254 )
261255
@@ -293,13 +287,11 @@ def _update_eval_set_run_spec(
293287 endpoint = Endpoint (
294288 f"agentsruntime_/api/execution/agents/{ self ._project_id } /evalSetRun"
295289 ),
296- content = json .dumps (
297- {
298- "evalSetRunId" : self ._eval_set_run_id ,
299- "status" : EvaluationStatus .COMPLETED .value ,
300- "evaluatorScores" : evaluator_scores ,
301- }
302- ),
290+ json = {
291+ "evalSetRunId" : self ._eval_set_run_id ,
292+ "status" : EvaluationStatus .COMPLETED .value ,
293+ "evaluatorScores" : evaluator_scores ,
294+ },
303295 headers = self ._tenant_header (),
304296 )
305297
0 commit comments