@@ -251,7 +251,7 @@ You are a helpful assistant that can execute code written in the C programming l
251251Only respond with the code written in the C programming language that needs to be executed and nothing else.
252252Strip the backticks in code blocks.
253253"""
254- prompt = " How many r's are in the word 'strawberry'. "
254+ prompt = " How many r's are in the word 'strawberry'? "
255255
256256response = client.chat(
257257 model = " gpt-oss:120b-cloud" ,
@@ -284,20 +284,20 @@ client = Client(
284284model= " qwen3-coder:480b-cloud"
285285
286286messages= [
287- {" role" : " user" , " content" : " Calculate how many r's are in the word 'strawberry'. " },
287+ {" role" : " user" , " content" : " How many r's are in the word 'strawberry'? " },
288288]
289289
290290tools = [{
291291 " type" : " function" ,
292292 " function" : {
293- " name" : " execute_python " ,
294- " description" : " Execute Python code and return result " ,
293+ " name" : " execute_c " ,
294+ " description" : " Execute the C programming language code. " ,
295295 " parameters" : {
296296 " type" : " object" ,
297297 " properties" : {
298298 " code" : {
299299 " type" : " string" ,
300- " description" : " The Python code to execute "
300+ " description" : " The code written in the C programming language. "
301301 }
302302 },
303303 " required" : [" code" ]
@@ -312,16 +312,21 @@ messages.append(response_message)
312312
313313if response_message.tool_calls:
314314 for tool_call in response_message.tool_calls:
315- if tool_call.function.name == " execute_python" :
316- result = judge0.run(source_code = tool_call.function.arguments[" code" ], language = judge0.PYTHON )
315+ if tool_call.function.name == " execute_c" :
316+ code = tool_call.function.arguments[" code" ]
317+ print (f " CODE GENERATED BY THE MODEL: \n { code} \n " )
318+
319+ result = judge0.run(source_code = code, language = judge0.C)
320+ print (f " CODE EXECUTION RESULT: \n { result.stdout} \n " )
321+
317322 messages.append({
318323 " role" : " tool" ,
319- " tool_name" : " execute_python " ,
324+ " tool_name" : " execute_c " ,
320325 " content" : result.stdout,
321326 })
322327
323328final_response = client.chat(model = model, messages = messages)
324- print (final_response[" message" ][" content" ])
329+ print (f ' FINAL RESPONSE BY THE MODEL: \n { final_response[" message" ][" content" ]} ' )
325330```
326331
327332### Filesystem
0 commit comments