diff --git a/pybossa/api/__init__.py b/pybossa/api/__init__.py index 9b2f104a7..07d612ff5 100644 --- a/pybossa/api/__init__.py +++ b/pybossa/api/__init__.py @@ -879,7 +879,7 @@ def large_language_model(model_name): model_endpoint = endpoints.get(model_name.lower()) if not model_endpoint: - return abort(403, f'Model with name {model_name} does not exist.') + return abort(400, f'{model_name} LLM is unsupported on this platform.') proxies = current_app.config.get('PROXIES') cert = current_app.config.get('CA_CERT', False) @@ -899,7 +899,7 @@ def large_language_model(model_name): if isinstance(prompts, list): prompts = prompts[0] # Batch request temporarily NOT supported if not isinstance(prompts, str): - return abort(400, f'prompts should be a string a list of strings') + return abort(400, f'prompts should be a string or a list of strings') data = { "instances": [ { diff --git a/test/test_api/__init__.py b/test/test_api/__init__.py index 22f78007a..d939b2d6e 100644 --- a/test/test_api/__init__.py +++ b/test/test_api/__init__.py @@ -125,8 +125,8 @@ def test_invalid_model_name(self, mock_post): "prompts": "Identify the company name: Microsoft will release Windows 20 next year." }): response = large_language_model('invalid-model') - self.assertEqual(response.status_code, 403) - self.assertIn('Model with name', response.json.get('exception_msg')) + self.assertEqual(response.status_code, 400) + self.assertIn('LLM is unsupported', response.json.get('exception_msg')) @patch('requests.post') def test_invalid_json(self, mock_post):