Repository: modelscope/evalscope
Issue: OpenAI API Error with tool_bench: Invalid 'function' role in ChatCompletionRequest
Root cause: Interface Contract Mismatch

## Self-Check List

Before submitting an issue, please ensure you have completed the following steps:
- [x] I have carefully read the [relevant user documentation](https://evalscope.readthedocs.io/en/latest/get_started/parameters.html)
- [x] I have reviewed the [Frequently Asked Questions](https://evalscope.readthedocs.io/en/latest/get_started/faq.html)
- [x] I have searched and reviewed existing issues to confirm this is not a duplicate problem

## Problem Description
We encountered an error when using the latest version of evalscope to run tool_bench evaluation. The error occurs with both local API and Mistral's official API.

## EvalScope Version (Required)
v0.17.0

## Tools Used
- [x] Native / Native framework
- [ ] Opencompass backend
- [ ] VLMEvalKit backend
- [ ] RAGEval backend
- [ ] Perf / Model inference stress testing tool
- [ ] Arena / Arena mode

## Executed Code or Instructions

```
evalscope eval --model devstral-small-2507 --datasets tool_bench --generation-config '{"temperature": 0.15, "top_p": 0.95, "max_tokens": 8192}' --api-url http://localhost:8020/v1 --eval-type service --timeout 6000 --work-dir ./results --eval-batch-size 1 --limit 2
```

## Error Log

**Local API Error:**
```
openai.BadRequestError: Error code: 400 - {'object': 'error', 'message': '1 validation error for ChatCompletionRequest\nmessages.3\n  Input tag \'function\' found using \'role\' does not match any of the expected tags: <Roles.system: \'system\'>, <Roles.user: \'user\'>, <Roles.assistant: \'assistant\'>, <Roles.tool: \'tool\'> [type=union_tag_invalid, input_value={\'role\': \'function\', \'con...id\\\'", "response": ""}\'}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.11/v/union_tag_invalid 1 validation error for ChatCompletionRequest\nmessages.3\n  Input tag \'function\' found using \'role\' does not match any of the expected tags: <Roles.system: \'system\'>, <Roles.user: \'user\'>, <Roles.assistant: \'assistant\'>, <Roles.tool: \'tool\'> [type=union_tag_invalid, input_value={\'role\': \'function\', \'con...id\\\'", "response": ""}\'}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.11/v/union_tag_invalid', 'type': 'BadRequestError', 'param': None, 'code': 400}
```

**Mistral Official API Error:**
```
openai.UnprocessableEntityError: Error code: 422 - {'detail': [{'type': 'union_tag_invalid', 'loc': ['body', 'messages', 3], 'msg': "Input tag 'function' found using 'role' does not match any of the expected tags: <Roles.system: 'system'>, <Roles.user: 'user'>, <Roles.assistant: 'assistant'>, <Roles.tool: 'tool'>", 'input': {'role': 'function', 'content': '{"error": "Function executing from my_tools.Location.spott.api import get_place_by_my_ip error...\\nget_place_by_my_ip() got an unexpected keyword argument \'is_id\'", "response": ""}'}, 'ctx': {'discriminator': "'role'", 'tag': 'function', 'expected_tags': "<Roles.system: 'system'>, <Roles.user: 'user'>, <Roles.assistant: 'assistant'>, <Roles.tool: 'tool'>"}}]}
```



## Running Environment

- Operating System: Ubuntu 22.04.5 LTS
- Python Version: Python 3.10.18

## Additional Information

**Command Used:**
```bash
evalscope eval --model devstral-small-2507 --datasets tool_bench --generation-config '{"temperature": 0.15, "top_p": 0.95, "max_tokens": 8192}' --api-url http://localhost:8020/v1 --eval-type service --timeout 6000 --work-dir ./results --eval-batch-size 1 --limit 2
```


You can pull the code from the main branch and try again.

OK 

> Thank you for your feedback! We will close this issue now. If you have any further questions, please feel free to reopen it. If EvalScope has been helpful to you, please consider giving us a STAR to show your support. Thank you!