LogoLogo
註冊/登入
  • 使用者手冊
  • 技術人員手冊
  • API 文件
  • AI 助理市集
  • 首頁
  • AI 助理
  • 附件與檔案
  • 知識庫
  • 對話與訊息
  • 對話 Widget
  • 組織與成員
  • 角色與權限
Powered by GitBook
On this page
  • 建立新 AI 助理
  • 列出 AI 助理有的設定項目
  • 列出 Embedding Model
  • 列出 Reranker Model
  • 取得 AI 助理列表
  • 取得特定 AI 助理
  • 更新 AI 助理
  • 部分更新 AI 助理
  • 刪除 AI 助理

Was this helpful?

AI 助理

建立新 AI 助理

POST /api/chatbots/

請求內容

請求參數

欄位
類型
必填
說明

name

string

是

AI助理名稱

largeLanguageModel

string (uuid)

是

大型語言模型的唯一識別碼

rag

string (uuid)

是

RAG檢索增強生成引擎的唯一識別碼

embeddingModel

string (uuid)

是

詞嵌入模型的唯一識別碼

rerankerModel

string (uuid)

是

重排序模型的唯一識別碼

instructions

string

否

AI助理的角色指令

organization

string (uuid)

否

組織的唯一識別碼

builtInWorkflow

string (uuid)

否

內建工作流的唯一識別碼

replyMode

string

否

回應模式,預設為'normal',可選:normal, template, hybrid, workflow, agent

template

string

否

回應模板

unanswerableTemplate

string

否

無法回答時的預設回應模板

totalWordsCount

integer

否

累積的使用總字數,預設為0

outputMode

string

否

輸出模式,預設為'text',可選:text, json_schema

rawOutputFormat

object

否

JSON格式的輸出格式設定

databaseUrl

string

否

資料庫連接URL

databaseType

string

否

資料庫類型

includeTables

array

否

包含的資料表列表

groups

array

是

關聯的群組列表

tools

array

否

直接指派的工具列表

請求結構範例

{
  "name": string
  "largeLanguageModel": string (uuid)
  "rag": string (uuid)
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "updatedAt": string (timestamp)
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "outputMode"?: object // 非必填
  "rawOutputFormat": json // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "includeTables"?: [string (uuid)] // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
  "tools"?: [string (uuid)]
}

請求範例值

{
  "name": "客戶服務助理",
  "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
  "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
  "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
  "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
  "instructions": "",
  "builtInWorkflow": "",
  "replyMode": "normal",
  "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
  "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
  "outputMode": "text",
  "rawOutputFormat": null,
  "databaseUrl": null,
  "databaseType": null,
  "groups": [
    {
      "id": "964c8c63-f8f1-4af2-b923-ae8ad11a4685",
      "name": "僅問答"
    }
  ],
  "tools": []
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/chatbots/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "客戶服務助理",
    "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
    "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
    "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
    "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
    "instructions": "",
    "builtInWorkflow": "",
    "replyMode": "normal",
    "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
    "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
    "outputMode": "text",
    "rawOutputFormat": null,
    "databaseUrl": null,
    "databaseType": null,
    "groups": [
      {
        "id": "964c8c63-f8f1-4af2-b923-ae8ad11a4685",
        "name": "僅問答"
      }
    ],
    "tools": []
}'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "客戶服務助理",
    "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
    "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
    "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
    "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
    "instructions": "",
    "builtInWorkflow": "",
    "replyMode": "normal",
    "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
    "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
    "outputMode": "text",
    "rawOutputFormat": null,
    "databaseUrl": null,
    "databaseType": null,
    "groups": [
      {
        "id": "964c8c63-f8f1-4af2-b923-ae8ad11a4685",
        "name": "僅問答"
      }
    ],
    "tools": []
  };

axios.post("https://api.maiagent.ai/api/chatbots/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbots/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
  "name": "客戶服務助理",
  "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
  "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
  "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
  "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
  "instructions": "",
  "builtInWorkflow": "",
  "replyMode": "normal",
  "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
  "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
  "outputMode": "text",
  "rawOutputFormat": null,
  "databaseUrl": null,
  "databaseType": null,
  "groups": [
    {
      "id": "964c8c63-f8f1-4af2-b923-ae8ad11a4685",
      "name": "僅問答"
    }
  ],
  "tools": []
}

response = requests.post(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/chatbots/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "客戶服務助理",
            "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
            "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
            "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
            "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
            "instructions": "",
            "builtInWorkflow": "",
            "replyMode": "normal",
            "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
            "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
            "outputMode": "text",
            "rawOutputFormat": null,
            "databaseUrl": null,
            "databaseType": null,
            "groups": [
              {
                "id": "964c8c63-f8f1-4af2-b923-ae8ad11a4685",
                "name": "僅問答"
              }
            ],
            "tools": []
          }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 201

回應結構範例

{
  "id": string (uuid)
  "name": string
  "largeLanguageModel": string (uuid)
  "rag": string (uuid)
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "updatedAt": string (timestamp)
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "enableChineseConversion"?: boolean // 非必填
  "outputMode"?: object // 非必填
  "rawOutputFormat": json // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "includeTables"?: [string (uuid)] // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
  "tools"?: [string (uuid)]
}

回應範例值

{
  "id": "826794b5-d5d1-468c-ac17-6e9908d6adfa",
  "name": "客戶服務助理",
  "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
  "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
  "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
  "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
  "instructions": "",
  "updatedAt": "1747136198000",
  "organization": "613c86f7-a45f-4e29-b255-29caf899e320",
  "builtInWorkflow": null,
  "replyMode": "normal",
  "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
  "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
  "totalWordsCount": 0,
  "outputMode": "text",
  "rawOutputFormat": null,
  "databaseUrl": null,
  "databaseType": null,
  "includeTables": null,
  "groups": [],
  "tools": []
}

列出 AI 助理有的設定項目

GET /api/chatbot-settings/

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/chatbot-settings/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/chatbot-settings/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbot-settings/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/chatbot-settings/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

[
  {
    "id": string (uuid)
    "name": string
    "llms": [ // 獲取與此 RAG 相容的 LLMs。
如果是 MAIAGENT 類型,則返回所有 LLMs。
如果是 OPENAI 類型,則只返回 OPENAI provider 的 LLMs。
      object
    ]
    "isDefault"?: boolean // 非必填
    "isSearchSelectable": string
    "isRerankerModelSelectable": string
    "isEmbeddingModelSelectable": string
  }
]

回應範例值

[
  [
    {
      "id": "8f92a7e5-d136-4c2a-9b45-7e31d8f06a12",
      "name": "MaiAgent RAG",
      "llms": [
        {
          "id": "2c48d91f-b537-4e8a-a259-1f83e6b8c73d",
          "name": "GPT-4 Turbo",
          "context_window": 128000,
          "is_default": true,
          "icon": "https://xxx.png",
          "is_multi_modal_support": true,
          "is_functional_calling_available": true,
          "is_template_available": true,
          "is_output_format_available": true,
          "reply_mode": [
            "NORMAL",
            "TEMPLATE",
            "HYBRID",
            "TEXT_TO_SQL",
            "WORKFLOW"
          ],
          "outputMode": [
            "TEXT",
            "JSON_SCHEMA"
          ]
        },
        {
          "id": "7a31e85b-2c49-4d7a-9f06-e482b5d1c03a",
          "name": "Claude 3 Opus",
          "context_window": 200000,
          "is_default": false,
          "icon": "https://xxx.png",
          "is_multi_modal_support": true,
          "is_functional_calling_available": true,
          "is_template_available": true,
          "is_output_format_available": true,
          "reply_mode": [
            "NORMAL",
            "TEMPLATE",
            "HYBRID",
            "TEXT_TO_SQL",
            "WORKFLOW"
          ],
          "outputMode": [
            "TEXT",
            "JSON_SCHEMA"
          ]
        }
      ],
      "is_default": true,
      "is_search_selectable": true,
      "is_reranker_model_selectable": true,
      "is_embedding_model_selectable": true
    }
  ]
]

列出 Embedding Model

GET /api/embedding-models/

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/embedding-models/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/embedding-models/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/embedding-models/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/embedding-models/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

[
  {
    "id": string (uuid)
    "name": string
    "isDefault"?: boolean // 非必填
  }
]

回應範例值

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string",
    "isDefault": false
  }
]

列出 Reranker Model

GET /api/reranker-models/

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/reranker-models/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/reranker-models/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/reranker-models/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/reranker-models/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

[
  {
    "id": string (uuid)
    "name": string
    "isDefault"?: boolean // 非必填
  }
]

回應範例值

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "response_string",
    "isDefault": false
  }
]

取得 AI 助理列表

GET /api/chatbots/

參數

參數名稱
必填
類型
說明

page

❌

integer

A page number within the paginated result set.

pageSize

❌

integer

Number of results to return per page.

pagination

❌

string

是否分頁 (true/false)

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/chatbots/?page=1&pageSize=1&pagination=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/chatbots/?page=1&pageSize=1&pagination=example", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbots/?page=1&pageSize=1&pagination=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/chatbots/?page=1&pageSize=1&pagination=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

{
  "count": integer
  "next"?: string (uri) // 非必填
  "previous"?: string (uri) // 非必填
  "results": [
    {
      "id": string (uuid)
      "name": string
      "largeLanguageModel":  // LLM 的基礎序列化器,只包含基本字段
      {
        "id": string (uuid)
        "name": string
      }
      "rag":  // RAG 的基礎序列化器
      {
        "id": string (uuid)
        "name": string
      }
      "embeddingModel": 
      {
        "id": string (uuid)
        "name": string
        "isDefault"?: boolean // 非必填
      }
      "rerankerModel": 
      {
        "id": string (uuid)
        "name": string
        "isDefault"?: boolean // 非必填
      }
      "updatedAt": string (timestamp)
      "enableChineseConversion"?: boolean // 非必填
      "groups": [
        {
          "id": string (uuid)
          "name": string
        }
      ]
    }
  ]
}

回應範例值

{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "response_string",
      "largeLanguageModel": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "response_string"
      },
      "rag": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "response_string"
      },
      "embeddingModel": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "response_string",
        "isDefault": false
      },
      "rerankerModel": {
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "name": "response_string",
        "isDefault": false
      },
      "updatedAt": "response_string",
      "enableChineseConversion": false,
      "groups": [
        {
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "name": "response_string"
        }
      ]
    }
  ]
}

取得特定 AI 助理

GET /api/chatbots/{id}/

參數

參數名稱
必填
類型
說明

id

✅

string

A UUID string identifying this chatbot.

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "name": string
  "largeLanguageModel": string (uuid)
  "rag": string (uuid)
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "updatedAt": string (timestamp)
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "enableChineseConversion"?: boolean // 非必填
  "outputMode"?: object // 非必填
  "outputFormat"?: object // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "response_string",
  "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
  "rag": "550e8400-e29b-41d4-a716-446655440000",
  "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
  "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
  "instructions": "response_string",
  "updatedAt": "response_string",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
  "replyMode": {},
  "template": "response_string",
  "unanswerableTemplate": "response_string",
  "totalWordsCount": 456,
  "enableChineseConversion": false,
  "outputMode": {},
  "outputFormat": null,
  "databaseUrl": "response_string",
  "databaseType": "response_string",
  "groups": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "response_string"
    }
  ]
}

更新 AI 助理

PUT /api/chatbots/{id}/

參數

參數名稱
必填
類型
說明

id

✅

string

A UUID string identifying this chatbot.

請求內容

請求參數

欄位
類型
必填
說明

name

string

是

AI助理名稱

largeLanguageModel

string (uuid)

是

大型語言模型的唯一識別碼

rag

string (uuid)

是

RAG檢索增強生成引擎的唯一識別碼

embeddingModel

string (uuid)

是

詞嵌入模型的唯一識別碼

rerankerModel

string (uuid)

是

重排序模型的唯一識別碼

instructions

string

否

AI助理的角色指令

organization

string (uuid)

否

組織的唯一識別碼

builtInWorkflow

string (uuid)

否

內建工作流的唯一識別碼

replyMode

string

否

回應模式,可選:normal, template, hybrid, workflow, agent

template

string

否

回應模板

unanswerableTemplate

string

否

無法回答時的預設回應模板

totalWordsCount

integer

否

累積的使用總字數

outputMode

string

否

輸出模式,可選:text, json_schema

rawOutputFormat

object

否

JSON格式的輸出格式設定

databaseUrl

string

否

資料庫連接URL

databaseType

string

否

資料庫類型

includeTables

array

否

包含的資料表列表

groups

array

是

關聯的群組列表

tools

array

否

直接指派的工具列表

請求結構範例

{
  "name": string
  "largeLanguageModel": string (uuid)
  "rag": string (uuid)
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "enableChineseConversion"?: boolean // 非必填
  "outputMode"?: object // 非必填
  "rawOutputFormat"?: json // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "includeTables"?: [string (uuid)] // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
  "tools"?: [string (uuid)]
}

請求範例值

{
  "name": "request_string",
  "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
  "rag": "550e8400-e29b-41d4-a716-446655440000",
  "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
  "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
  "instructions": "request_string",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
  "replyMode": null,
  "template": "request_string",
  "unanswerableTemplate": "request_string",
  "totalWordsCount": 123,
  "enableChineseConversion": true,
  "outputMode": null,
  "outputFormat": null,
  "databaseUrl": "request_string",
  "databaseType": "request_string",
  "groups": [
    {}
  ]
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "客戶服務助理",
    "largeLanguageModel": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "rag": "7b9e8f32-4c21-4a56-9d23-8e7ab5c12e5f",
    "embeddingModel": "1e3d7a89-6c2f-4b5e-8d9a-0f1e2c3d4e5f",
    "rerankerModel": "9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
    "instructions": "你是一個專業的客戶服務助理,負責回答有關我們產品的問題。請保持禮貌和專業,並盡可能提供詳細的資訊。",
    "organization": "2d1e3c4b-5a6f-7e8d-9c0b-1a2b3c4d5e6f",
    "builtInWorkflow": "4f5e6d7c-8b9a-0f1e-2d3c-4b5a6c7d8e9f",
    "replyMode": "template",
    "template": "您好,感謝您的提問。\n\n{answer}\n\n如果您有其他問題,請隨時詢問。",
    "unanswerableTemplate": "感謝您的提問。目前我沒有足夠的資訊來回答您的問題。請提供更多細節,或聯繫我們的客戶服務團隊獲取幫助。",
    "outputMode": "text",
    "rawOutputFormat": {
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string",
            "description": "回答內容"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "參考資料來源"
          }
        },
        "required": ["answer"]
      }
    },
    "databaseUrl": "postgresql://username:password@host:port/database",
    "databaseType": "postgres",
    "includeTables": ["products", "categories", "faqs"],
    "groups": ["5f6e7d8c-9b0a-1f2e-3d4c-5b6a7c8d9e0f"],
    "toolkits": ["6e7f8d9c-0b1a-2f3e-4d5c-6b7a8c9d0e1f"],
    "tools": ["7f8e9d0c-1b2a-3f4e-5d6c-7b8a9c0d1e2f"]
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "客戶服務助理",
    "largeLanguageModel": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "rag": "7b9e8f32-4c21-4a56-9d23-8e7ab5c12e5f",
    "embeddingModel": "1e3d7a89-6c2f-4b5e-8d9a-0f1e2c3d4e5f",
    "rerankerModel": "9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
    "instructions": "你是一個專業的客戶服務助理,負責回答有關我們產品的問題。請保持禮貌和專業,並盡可能提供詳細的資訊。",
    "organization": "2d1e3c4b-5a6f-7e8d-9c0b-1a2b3c4d5e6f",
    "builtInWorkflow": "4f5e6d7c-8b9a-0f1e-2d3c-4b5a6c7d8e9f",
    "replyMode": "template",
    "template": "您好,感謝您的提問。\n\n{answer}\n\n如果您有其他問題,請隨時詢問。",
    "unanswerableTemplate": "感謝您的提問。目前我沒有足夠的資訊來回答您的問題。請提供更多細節,或聯繫我們的客戶服務團隊獲取幫助。",
    "outputMode": "text",
    "rawOutputFormat": {
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string",
            "description": "回答內容"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "參考資料來源"
          }
        },
        "required": ["answer"]
      }
    },
    "databaseUrl": "postgresql://username:password@host:port/database",
    "databaseType": "postgres",
    "includeTables": ["products", "categories", "faqs"],
    "groups": ["5f6e7d8c-9b0a-1f2e-3d4c-5b6a7c8d9e0f"],
    "toolkits": ["6e7f8d9c-0b1a-2f3e-4d5c-6b7a8c9d0e1f"],
    "tools": ["7f8e9d0c-1b2a-3f4e-5d6c-7b8a9c0d1e2f"]
  };

axios.put("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "客戶服務助理",
    "largeLanguageModel": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "rag": "7b9e8f32-4c21-4a56-9d23-8e7ab5c12e5f",
    "embeddingModel": "1e3d7a89-6c2f-4b5e-8d9a-0f1e2c3d4e5f",
    "rerankerModel": "9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
    "instructions": "你是一個專業的客戶服務助理,負責回答有關我們產品的問題。請保持禮貌和專業,並盡可能提供詳細的資訊。",
    "organization": "2d1e3c4b-5a6f-7e8d-9c0b-1a2b3c4d5e6f",
    "builtInWorkflow": "4f5e6d7c-8b9a-0f1e-2d3c-4b5a6c7d8e9f",
    "replyMode": "template",
    "template": "您好,感謝您的提問。\n\n{answer}\n\n如果您有其他問題,請隨時詢問。",
    "unanswerableTemplate": "感謝您的提問。目前我沒有足夠的資訊來回答您的問題。請提供更多細節,或聯繫我們的客戶服務團隊獲取幫助。",
    "outputMode": "text",
    "rawOutputFormat": {
      "schema": {
        "type": "object",
        "properties": {
          "answer": {
            "type": "string",
            "description": "回答內容"
          },
          "references": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "參考資料來源"
          }
        },
        "required": ["answer"]
      }
    },
    "databaseUrl": "postgresql://username:password@host:port/database",
    "databaseType": "postgres",
    "includeTables": ["products", "categories", "faqs"],
    "groups": ["5f6e7d8c-9b0a-1f2e-3d4c-5b6a7c8d9e0f"],
    "toolkits": ["6e7f8d9c-0b1a-2f3e-4d5c-6b7a8c9d0e1f"],
    "tools": ["7f8e9d0c-1b2a-3f4e-5d6c-7b8a9c0d1e2f"]
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "客戶服務助理",
            "largeLanguageModel": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "rag": "7b9e8f32-4c21-4a56-9d23-8e7ab5c12e5f",
            "embeddingModel": "1e3d7a89-6c2f-4b5e-8d9a-0f1e2c3d4e5f",
            "rerankerModel": "9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
            "instructions": "你是一個專業的客戶服務助理,負責回答有關我們產品的問題。請保持禮貌和專業,並盡可能提供詳細的資訊。",
            "organization": "2d1e3c4b-5a6f-7e8d-9c0b-1a2b3c4d5e6f",
            "builtInWorkflow": "4f5e6d7c-8b9a-0f1e-2d3c-4b5a6c7d8e9f",
            "replyMode": "template",
            "template": "您好,感謝您的提問。\n\n{answer}\n\n如果您有其他問題,請隨時詢問。",
            "unanswerableTemplate": "感謝您的提問。目前我沒有足夠的資訊來回答您的問題。請提供更多細節,或聯繫我們的客戶服務團隊獲取幫助。",
            "outputMode": "text",
            "rawOutputFormat": {
              "schema": {
                "type": "object",
                "properties": {
                  "answer": {
                    "type": "string",
                    "description": "回答內容"
                  },
                  "references": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "參考資料來源"
                  }
                },
                "required": ["answer"]
              }
            },
            "databaseUrl": "postgresql://username:password@host:port/database",
            "databaseType": "postgres",
            "includeTables": ["products", "categories", "faqs"],
            "groups": ["5f6e7d8c-9b0a-1f2e-3d4c-5b6a7c8d9e0f"],
            "toolkits": ["6e7f8d9c-0b1a-2f3e-4d5c-6b7a8c9d0e1f"],
            "tools": ["7f8e9d0c-1b2a-3f4e-5d6c-7b8a9c0d1e2f"]
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "name": string
  "largeLanguageModel": string (uuid)
  "rag": string (uuid)
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "updatedAt": string (timestamp)
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "enableChineseConversion"?: boolean // 非必填
  "outputMode"?: object // 非必填
  "rawOutputFormat": json // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "includeTables"?: [string (uuid)] // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
  "tools": [string (uuid)]
}

回應範例值

{
  "id": "826794b5-d5d1-468c-ac17-6e9908d6adfa",
  "name": "客戶服務助理",
  "largeLanguageModel": "3259d569-07b6-453a-9f51-7cf5b4b30037",
  "rag": "66261b7a-bd3f-4214-9c48-364c2e122b0f",
  "embeddingModel": "c89c762e-40a0-45a3-9cfc-36b6e2182037",
  "rerankerModel": "cd333afc-0ce3-4158-8d55-ada51dbde8f9",
  "instructions": "",
  "updatedAt": "1747136198000",
  "organization": "613c86f7-a45f-4e29-b255-29caf899e320",
  "builtInWorkflow": null,
  "replyMode": "normal",
  "template": "您的問題與下面幾個 FAQ 有關:\n\n[loop]\n{@loopIndex}. {question}\n- {answer}\n\n[endloop]\n謝謝您的詢問。",
  "unanswerableTemplate": "很抱歉,目前我無法回答你的問題,請以其他的方式聯繫客服人員,謝謝。",
  "totalWordsCount": 0,
  "outputMode": "text",
  "rawOutputFormat": null,
  "databaseUrl": null,
  "databaseType": null,
  "includeTables": null,
  "groups": [],
  "tools": []
}

部分更新 AI 助理

PATCH /api/chatbots/{id}/

參數

參數名稱
必填
類型
說明

id

✅

string

A UUID string identifying this chatbot.

請求內容

請求參數

欄位
類型
必填
說明

name

string

否

AI助理名稱

largeLanguageModel

string (uuid)

否

大型語言模型的唯一識別碼

rag

string (uuid)

否

RAG檢索增強生成引擎的唯一識別碼

embeddingModel

string (uuid)

否

詞嵌入模型的唯一識別碼

rerankerModel

string (uuid)

否

重排序模型的唯一識別碼

instructions

string

否

AI助理的角色指令

organization

string (uuid)

否

組織的唯一識別碼

builtInWorkflow

string (uuid)

否

內建工作流的唯一識別碼

replyMode

string

否

回應模式,可選:normal, template, hybrid, workflow, agent

template

string

否

回應模板

unanswerableTemplate

string

否

無法回答時的預設回應模板

totalWordsCount

integer

否

累積的使用總字數

outputMode

string

否

輸出模式,可選:text, json_schema

rawOutputFormat

object

否

JSON格式的輸出格式設定

databaseUrl

string

否

資料庫連接URL

databaseType

string

否

資料庫類型

includeTables

array

否

包含的資料表列表

groups

array

否

關聯的群組列表

tools

array

否

直接指派的工具列表

請求結構範例

{
  "name"?: string // 非必填
  "largeLanguageModel"?: string (uuid) // 非必填
  "rag"?: string (uuid) // 非必填
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "enableChineseConversion"?: boolean // 非必填
  "outputMode"?: object // 非必填
  "rawOutputFormat"?: json // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "includeTables"?: [string (uuid)] // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
  "tools"?: [string (uuid)]
}

請求範例值

{
  "name": "request_string",
  "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
  "rag": "550e8400-e29b-41d4-a716-446655440000",
  "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
  "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
  "instructions": "request_string",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
  "replyMode": null,
  "template": "request_string",
  "unanswerableTemplate": "request_string",
  "totalWordsCount": 123,
  "enableChineseConversion": true,
  "outputMode": null,
  "outputFormat": null,
  "databaseUrl": "request_string",
  "databaseType": "request_string",
  "groups": [
    {}
  ]
}

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "request_string",
    "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
    "rag": "550e8400-e29b-41d4-a716-446655440000",
    "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
    "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
    "instructions": "request_string",
    "organization": "550e8400-e29b-41d4-a716-446655440000",
    "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
    "replyMode": null,
    "template": "request_string",
    "unanswerableTemplate": "request_string",
    "totalWordsCount": 123,
    "enableChineseConversion": true,
    "outputMode": null,
    "outputFormat": null,
    "databaseUrl": "request_string",
    "databaseType": "request_string",
    "groups": [
      {}
    ]
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "request_string",
    "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
    "rag": "550e8400-e29b-41d4-a716-446655440000",
    "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
    "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
    "instructions": "request_string",
    "organization": "550e8400-e29b-41d4-a716-446655440000",
    "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
    "replyMode": null,
    "template": "request_string",
    "unanswerableTemplate": "request_string",
    "totalWordsCount": 123,
    "enableChineseConversion": true,
    "outputMode": null,
    "outputFormat": null,
    "databaseUrl": "request_string",
    "databaseType": "request_string",
    "groups": [
      {}
    ]
  };

axios.patch("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "request_string",
      "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
      "rag": "550e8400-e29b-41d4-a716-446655440000",
      "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
      "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
      "instructions": "request_string",
      "organization": "550e8400-e29b-41d4-a716-446655440000",
      "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
      "replyMode": null,
      "template": "request_string",
      "unanswerableTemplate": "request_string",
      "totalWordsCount": 123,
      "enableChineseConversion": true,
      "outputMode": null,
      "outputFormat": null,
      "databaseUrl": "request_string",
      "databaseType": "request_string",
      "groups": [
        {}
      ]
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "request_string",
            "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
            "rag": "550e8400-e29b-41d4-a716-446655440000",
            "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
            "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
            "instructions": "request_string",
            "organization": "550e8400-e29b-41d4-a716-446655440000",
            "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
            "replyMode": null,
            "template": "request_string",
            "unanswerableTemplate": "request_string",
            "totalWordsCount": 123,
            "enableChineseConversion": true,
            "outputMode": null,
            "outputFormat": null,
            "databaseUrl": "request_string",
            "databaseType": "request_string",
            "groups": [
                {}
            ]
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼: 200

回應結構範例

{
  "id": string (uuid)
  "name": string
  "largeLanguageModel": string (uuid)
  "rag": string (uuid)
  "embeddingModel"?: string (uuid) // 非必填
  "rerankerModel"?: string (uuid) // 非必填
  "instructions"?: string // 非必填
  "updatedAt": string (timestamp)
  "organization"?: string (uuid) // 非必填
  "builtInWorkflow"?: string (uuid) // 非必填
  "replyMode"?: object // 非必填
  "template"?: string // 非必填
  "unanswerableTemplate"?: string // 非必填
  "totalWordsCount"?: integer (int64) // 累積的使用總字數 (非必填)
  "enableChineseConversion"?: boolean // 非必填
  "outputMode"?: object // 非必填
  "rawOutputFormat": json // 非必填
  "databaseUrl"?: string // 非必填
  "databaseType"?: string // 非必填
  "includeTables"?: [string (uuid)] // 非必填
  "groups"?: [ // 非必填
    {
      "id": string (uuid)
      "name": string
    }
  ]
  "tools": [string (uuid)]
}

回應範例值

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "response_string",
  "largeLanguageModel": "550e8400-e29b-41d4-a716-446655440000",
  "rag": "550e8400-e29b-41d4-a716-446655440000",
  "embeddingModel": "550e8400-e29b-41d4-a716-446655440000",
  "rerankerModel": "550e8400-e29b-41d4-a716-446655440000",
  "instructions": "response_string",
  "updatedAt": "response_string",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "builtInWorkflow": "550e8400-e29b-41d4-a716-446655440000",
  "replyMode": {},
  "template": "response_string",
  "unanswerableTemplate": "response_string",
  "totalWordsCount": 456,
  "enableChineseConversion": false,
  "outputMode": {},
  "outputFormat": null,
  "databaseUrl": "response_string",
  "databaseType": "response_string",
  "groups": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "response_string"
    }
  ]
}

刪除 AI 助理

DELETE /api/chatbots/{id}/

參數

參數名稱
必填
類型
說明

id

✅

string

A UUID string identifying this chatbot.

程式碼範例

# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
import requests

url = "https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/chatbots/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>

回應內容

狀態碼
說明

204

No response body


Previous首頁Next附件與檔案

Last updated 1 month ago

Was this helpful?