Validate the Name field for AI tools

After creating a new tool in Discourse AI I came upon the following error:

Job exception: {
  "error": {
    "message": "Invalid 'tools[0].function.name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.",
    "type": "invalid_request_error",
    "param": "tools[0].function.name",
    "code": "invalid_value"
  }
}

I had spaces in the name, which I replaced with underscores to match the pattern. :+1:

If that is expected, could we validate that field in the UI? We may also mention it in the descriptive text for that field.

2 Likes