enhance: add comprehensive unit tests PR223

This commit is contained in:
Wendong-Fan 2025-09-06 06:17:32 +08:00
parent 1917d599e6
commit 7e72e6b115
6 changed files with 80 additions and 44 deletions

View file

@ -44,8 +44,16 @@ async def validate_model(request: ValidateModelRequest):
)
except Exception as e:
return ValidateModelResponse(is_valid=False, is_tool_calls=False, message=str(e))
is_valid = bool(response)
is_tool_calls = False
if response and hasattr(response, 'info') and response.info:
tool_calls = response.info.get("tool_calls", [])
if tool_calls and len(tool_calls) > 0:
is_tool_calls = tool_calls[0].result == "Tool execution completed successfully for https://www.camel-ai.org, Website Content: Welcome to CAMEL AI!"
return ValidateModelResponse(
is_valid=True if response else False,
is_tool_calls=response.info["tool_calls"][0].result == "Tool execution completed successfully for https://www.camel-ai.org, Website Content: Welcome to CAMEL AI!",
is_valid=is_valid,
is_tool_calls=is_tool_calls,
message="",
)