# 使用 FabriXAI API 與您的 AI 代理互動
本逐步教學將引導您如何在 FabriXAI 上複製一個 AI 代理,並使用 cURL 發送您的第一個 API 請求。我們將以 資源分配規劃工具 (opens new window) 作為示例代理進行操作。
本教學包含以下 5 個主要步驟:
現在就開始吧!
# 第一步:註冊 FabriXAI 帳戶
要使用 FabriXAI,您需要先建立一個帳戶。如果您已有帳戶,請直接跳至 第二步:複製代理範本。
- 前往 資源分配規劃工具 (Resource Allocation Planner) 詳細頁面 (opens new window)。
- 點擊 "Clone this Agent"(複製此代理) 按鈕。
- 點選 "Sign up"(註冊)。
- 填寫帳戶資訊並點擊 "Sign Up"(註冊)。
- 檢查您的電子郵件信箱,並點擊驗證信中的連結。
- 確認您的電子郵件地址後,點選 "Next"(下一步)。
- 等待系統建立您的工作區。建立完成後,您將收到一封歡迎信。
- 點擊信中的連結進入您的工作區。
# 第二步:複製代理範本
現在我們來開始使用 資源分配規劃工具 (Resource Allocation Planner) 這個範本代理。
- 在您的 FabriXAI 工作區中,從側邊欄點選 Templates(範本)。
- 搜尋 "Resource Allocation Planner"。
- 將滑鼠移至該範本上並點擊 "Clone to Edit"(複製並編輯)。
- 點選 "Create"(建立),將其加入您的工作區中。
# 第三步:建立 API 金鑰
若要使用 API,您需要建立一組 API 金鑰。
- 前往您剛複製的代理的 AI Agent Builder 頁面。
- 在左側選單中點選 Integrations > API(整合 > API)。
- 點擊 "API Key"(API 金鑰),然後選擇 "Create New API Key"(建立新金鑰)。
- 複製並妥善保存您的 API 金鑰。
請務必妥善保管您的 API 金鑰,切勿洩漏給他人,以避免未經授權的存取。
# 第四步:啟用 API 存取權限
在使用 API 前,請確保您的代理已啟用 API 存取功能(系統預設通常為啟用狀態):
- 前往您欲整合的 AI 代理的 AI Agent Builder。
- 點選左側選單的 Integrations > API(整合 > API)。
- 確認 Backend Service API 模組右上角的開關已設為 啟用 狀態。
# 第五步:使用 cURL 發送 API 請求
現在我們來透過 cURL 從命令列發送請求給您的 AI 代理。
- 開啟 命令提示字元(Windows) 或 終端機(Mac/Linux)。
- 複製並貼上以下的範例 cURL 指令:
以下命令適用於 資源分配規劃工具 (Resource Allocation Planner) (opens new window)。如果您使用的是其他 AI 代理,請根據該代理的設定輸入欄位調整 "inputs" 區塊的內容。
curl -X POST 'https://console.fabrixai.com/v1/completion-messages' \
--header 'Authorization: Bearer {api_key}' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {
"key_skills_expertise": "Communication, Customer service",
"project_name": "Demo Project"
},
"response_mode": "blocking",
"user": "user"
}'
將
{api_key}
替換為您在第三步中產生的 API 金鑰。按下 Enter 執行命令。稍待片刻,您將收到 AI 的回應。
- 以下是一個回應的範例:
{ "event": "message", "task_id": "84d20e75-d834-4f56-8b30-99f435bd8fef", "id": "f3d9242a-2e48-4e90-97aa-984d089f5340", "message_id": "dfbb5d22-9b7c-43cd-aa23-ce36caf57e42", "mode": "completion", "answer": "\n\nTo develop a comprehensive resource allocation plan for Demo Project, I will analyze the project's requirements and identify the necessary human, financial, and technological resources. Here's a detailed plan:\n\n**Project Requirements:**\n\n* Communication: Develop a communication strategy to engage with stakeholders, including customers, team members, and project sponsors.\n* Customer Service: Provide exceptional customer service to ensure customer satisfaction and loyalty.\n\n**Human Resources:**\n\n* Project Manager: 1 person, responsible for overseeing the project and ensuring its successful completion.\n* Communication Specialist: 1 person, responsible for developing and implementing the communication strategy.\n* Customer Service Representative: 2 people, responsible for providing customer service and support.\n* Team Members: 4 people, responsible for completing project tasks and delivering project deliverables.\n\n**Financial Resources:**\n\n* Project Budget: $200,000, allocated for project expenses, including personnel costs, training, and technology.\n* Personnel Costs: $150,000, allocated for salaries, benefits, and training for team members.\n* Technology Costs: $20,000, allocated for software, hardware, and other technology expenses.\n* Miscellaneous Costs: $30,000, allocated for project-related expenses, including travel, meetings, and marketing.\n\n**Technological Resources:**\n\n* Project Management Software: Asana or Trello, used for project planning, tracking, and collaboration.\n* Customer Relationship Management (CRM) Software: Salesforce or HubSpot, used for managing customer interactions and data.\n* Communication Tools: Email, phone, and video conferencing software, used for team communication and stakeholder engagement.\n\n**Timeline for Acquiring and Deploying Resources:**\n\n* Week 1-2: Hire Project Manager and Communication Specialist.\n* Week 3-4: Hire Customer Service Representatives and Team Members.\n* Week 5-6: Train team members on project management software, CRM software, and communication tools.\n* Week 7-8: Deploy project management software, CRM software, and communication tools.\n* Week 9-10: Develop and implement communication strategy and customer service plan.\n\n**Optimizing Resource Utilization:**\n\n* Implement cross-training for team members to ensure they have the necessary skills to complete project tasks.\n* Leverage external partnerships with customer service providers or communication specialists to supplement team resources.\n* Encourage team members to share knowledge and best practices to improve project efficiency and effectiveness.\n\n**Monitoring and Adjusting the Resource Allocation Plan:**\n\n* Regularly review project progress and adjust the resource allocation plan as needed.\n* Monitor project expenses and adjust the budget as necessary.\n* Conduct regular team meetings to ensure team members are aware of project requirements and can provide feedback on resource utilization.\n* Establish a process for escalating issues or concerns to the Project Manager or stakeholders.\n\n**Recommendations for Adjusting the Resource Allocation Plan:**\n\n* If project progress is behind schedule, consider hiring additional team members or outsourcing tasks to external providers.\n* If project expenses are exceeding budget, consider reducing personnel costs or negotiating with vendors for better rates.\n* If team members are struggling with project tasks, consider providing additional training or support to ensure they have the necessary skills to complete tasks effectively.\n\nBy following this comprehensive resource allocation plan, Demo Project can ensure that it has the necessary human, financial, and technological resources to deliver project deliverables on time, within budget, and to the required quality standards.", "metadata": { "usage": { "prompt_tokens": 125, "prompt_unit_price": "0", "prompt_price_unit": "0", "prompt_price": "0E-7", "completion_tokens": 679, "completion_unit_price": "0", "completion_price_unit": "0", "completion_price": "0E-7", "total_tokens": 804, "total_price": "0E-7", "currency": "USD", "latency": 8.433709602977615 } }, "created_at": 1741657635 }