Lista Modelli AI
L'API per l'ottenimento dei modelli di app.neoagent.co fornisce la funzionalità per creare un nuovo chatbot inviando una richiesta GET all'endpoint /chat/Chatbot/ModelList.
Endpoint
URL della Richiesta: https://app.neoagent.co/chat/Chatbot/ModelList
Metodo: GET
Headers richiesti
La richiesta API deve includere i seguenti header:
Authorization: <Your-Secret-Key>- string, obbligatorio - La chiave segreta per autenticare la richiesta APIContent-Type: application/json- string, obbligatorio - Il tipo di contenuto del payload della richiesta (deve essere application/json)
Esempi di Richiesta
- JavaScript (Fetch API)
- Python (Requests)
- cURL
- HTTP Raw
const res = await fetch('https://app.neoagent.co/chat/Chatbot/ModelList', {
method: 'GET',
headers: {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
},
body: JSON.stringify({})
});
const data = await res.json();
console.log(data);
import requests
import json
url = 'https://app.neoagent.co/chat/Chatbot/ModelList'
headers = {
"Authorization": "<Your-Secret-Key>",
"Content-Type": "application/json"
}
data = {}
response = requests.get(url, headers=headers, json=data)
data = response.json()
print(data)
curl 'https://app.neoagent.co/chat/Chatbot/ModelList' \
-X GET \
-H 'Authorization: <Your-Secret-Key>' \
-H 'Content-Type: application/json' \
-d '{}'
GET /chat/Chatbot/ModelList HTTP/1.1
Host: app.neoagent.co
Authorization: <Your-Secret-Key>
Content-Type: application/json
{}
Risposta
La risposta API sarà un oggetto JSON con la seguente struttura:
{
// array - List of knowledge items
"Data": [
{
"Key": "2",
"Value": "gpt-4o",
"Status": true
},
{
"Key": "3",
"Value": "gpt-4o-mini",
"Status": true
},
{
"Key": "22",
"Value": "claude-3.5-sonnet",
"Status": false
},
{
"Key": "23",
"Value": "claude-3.5-haiku",
"Status": false
}
],
// string - API version
"Version": "1.0.0",
// boolean - Operation success status
"Success": true,
// integer - HTTP status code
"Code": 200,
// string - Error message if any
"Message": ""
}
Gestione degli Errori
Se la richiesta fallisce, dovresti:
- Controllare il codice di stato HTTP per errori a livello di rete
- Esaminare i campi
CodeeMessagenella risposta per errori a livello business - Il campo
Messageconterrà informazioni dettagliate sull'errore