Agent Evals by Galileo

官方

透過 Galileo 的全新 MCP 伺服器,直接在您的 IDE 中免費使用代理評估、可觀測性與合成測試集生成功能。

你可以用 Agent Evals By Galileo MCP 做什麼?

  • 建立合成資料集 — 要求助理生成包含自訂查詢類型(如帳務問題或提示注入)的資料集。
  • 檢查資料集生成狀態 — 在資料集建立過程中追蹤進度,並預覽前幾筆資料列。
  • 建立可重複使用的提示模板 — 跨專案設定具備模型參數與溫度設定的命名提示模板。
  • 取得實驗設定指引 — 接收在 Python 中針對 RAG 或代理工作流程執行 Galileo 實驗的逐步說明。
  • 分析日誌串流以取得訊號 — 從生產環境的日誌串流中擷取近期訊號,並取得建議的程式碼修正。
  • 搜尋 Galileo 文件 — 直接從文件中查找 API 參考資料、程式碼範例與實作指南。

文件

Galileo MCP 伺服器

了解如何將 Galileo 的模型上下文協定 (MCP) 伺服器整合到 Cursor 和 VS Code 等支援 AI 的 IDE 中

Galileo 模型上下文協定 (MCP) 伺服器可讓支援 AI 的 IDE(例如 Cursor,或搭配 GitHub Copilot 的 VS Code)與 Galileo 的評估和可觀測性平台無縫整合。

透過 MCP,您可以直接從開發環境中存取 Galileo 的功能,包括:

  • 建立和管理資料集
  • 執行實驗
  • 設定提示範本
  • 取得日誌串流的訊號
  • 將 Galileo 與您的程式碼整合

先決條件

開始之前,請確保您具備以下條件:

安裝支援 AI 的 IDE,例如 [Cursor](https://cursor.sh) 或 [VS Code](https://code.visualstudio.com) 並具備 AI 功能 從 [API 金鑰頁面](https://app.galileo.ai/settings/api-keys) 產生您的 Galileo API 金鑰

設定您的 IDE

Galileo MCP 伺服器可與 Cursor 和 VS Code 搭配使用。請針對您的 IDE 遵循以下步驟:

如果尚未安裝,請安裝 [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) 擴充功能
  <Step title="Open MCP settings">
    開啟命令選擇區(Windows/Linux 上為 `Ctrl + Shift + P`,Mac 上為 `Cmd + Shift + P`)並搜尋 **"MCP: Open User Configuration"**
  </Step>

  <Step title="Add the Galileo MCP server configuration">
    複製並貼上以下設定。將 `YOUR-API-KEY` 替換為您實際的 Galileo API 金鑰。

    ```json VSCode MCP Configuration highlight={3-9} theme={null}
    {
      "servers": {
        "galileo_mcp_server": {
          "url": "https://api.galileo.ai/mcp/http/mcp",
          "headers": {
            "Galileo-API-Key": "YOUR-API-KEY",
            "Accept": "text/event-stream"
          }
        }
      },
      "inputs": []
    }
    ```

    此設定假設您使用的是 [app.galileo.ai](https://app.galileo.ai)。

    如果您使用的是自行託管的 Galileo 部署,請將 `https://api.galileo.ai/mcp/http/mcp` 網址替換為您的部署網址。此網址的格式基於您的主控台網址,將 `console` 替換為 `api` 並附加 `/mcp/http/mcp`。

    例如:

    * 如果您的主控台網址是 `https://console.galileo.example.com`,則 MCP 網址將為 `https://api.galileo.example.com/mcp/http/mcp`
    * 如果您的主控台網址是 `https://console-galileo.apps.mycompany.com`,則 MCP 網址將為 `https://api-galileo.apps.mycompany.com/mcp/http/mcp`
  </Step>

  <Step title="Reload VS Code">
    重新載入 VS Code,開啟命令選擇區並執行 **"Developer: Reload Window"** 以使變更生效
  </Step>
</Steps>
開啟 Cursor 命令選擇區(Windows/Linux 上為 `Ctrl + Shift + P`,Mac 上為 `Cmd + Shift + P`),然後選擇「Open MCP Settings」。
  <Step title="Open the MCP server configuration file">
    點擊 **Add Custom MCP** 以開啟 `mcp.json` MCP 設定檔,或者如果您已設定其他 MCP 伺服器,則點擊 **New MCP Server**。
  </Step>

  <Step title="Add the Galileo MCP server configuration">
    複製並貼上以下設定。將 `YOUR-API-KEY` 替換為您實際的 Galileo API 金鑰。

    ```json Cursor MCP Configuration highlight={3-9} theme={null}
    {
      "mcpServers": {
        "galileo_mcp_server": {
          "url": "https://api.galileo.ai/mcp/http/mcp",
          "headers": {
            "Galileo-API-Key": "YOUR-API-KEY",
            "Accept": "text/event-stream"
          }
        }
      }
    }
    ```

    此設定假設您使用的是 [app.galileo.ai](https://app.galileo.ai)。

    如果您使用的是自行託管的 Galileo 部署,請將 `https://api.galileo.ai/mcp/http/mcp` 網址替換為您的部署網址。此網址的格式基於您的主控台網址,將 `console` 替換為 `api` 並附加 `/mcp/http/mcp`。

    例如:

    * 如果您的主控台網址是 `https://console.galileo.example.com`,則 MCP 網址將為 `https://api.galileo.example.com/mcp/http/mcp`
    * 如果您的主控台網址是 `https://console-galileo.apps.mycompany.com`,則 MCP 網址將為 `https://api-galileo.apps.mycompany.com/mcp/http/mcp`
  </Step>

  <Step title="Save and restart">
    儲存設定並重新啟動 Cursor 以使變更生效
  </Step>
</Steps>
Cursor 和 VS Code 的設定相同。請確保將 `YOUR-API-KEY` 替換為您從 [API 金鑰頁面](https://app.galileo.ai/settings/api-keys) 取得的實際 Galileo API 金鑰。

驗證您的設定

設定完成後,您可以透過在 IDE 中詢問 AI 助理來驗證您的 MCP 設定:

```text Example Query theme={null} Can you show me how to add Galileo logging to my agent bot? ```
Help me create a synthetic dataset for customer support queries
How do I integrate Galileo with LangChain?

您的 AI 助理現在應該能夠存取 Galileo 的功能,並根據您的 Galileo 帳戶資訊做出回應。

工具

Galileo MCP 伺服器提供強大的工具,您可以透過與 AI 助理的自然對話來存取。只需提出問題或要求,AI 就會使用這些工具來協助您。

產生合成資料集或上傳您自己的資料,以測試和評估您的 AI 應用程式。此工具支援建立包含各種查詢類型的資料集,包括一般查詢、提示注入、離題內容和有毒內容情境。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  Create a dataset with 50 customer service queries about billing issues
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Generate a dataset of 30 chatbot queries, including some prompt injection attempts
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Make a dataset with product recommendation queries and include off-topic questions
  ```
</CodeGroup>
追蹤資料集產生的進度並預覽產生的內容。您將看到前 10 列資料,以及產生狀態和進度更新。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  Check the status of my dataset that's currently generating
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Show me the preview of dataset abc-123
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Is my customer service dataset ready yet?
  ```
</CodeGroup>
建立可重複使用的提示範本,以便在所有專案中使用。設定模型配置、溫度設定和其他參數,以實現一致的提示行為。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  Create a prompt template called "Friendly Assistant" for customer support responses
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Make a prompt template for summarizing technical documentation with lower temperature
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Set up a chat template for a code review assistant
  ```
</CodeGroup>
取得有關設定和執行 Galileo 實驗的完整指引,包括資料集準備、指標設定以及與現有程式碼的整合。適用於 Python 和其他支援的語言。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  How do I set up a Galileo experiment in Python?
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Show me how to run an experiment with my RAG application
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Guide me through creating an experiment for my agentic workflow
  ```
</CodeGroup>
分析應用程式的日誌串流,以找出問題、模式和改進機會。根據記錄的資料取得具體建議。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  What issues do you see in my production log stream?
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Fetch the most recent signals from Galileo and propose fixes for them in my code
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Get insights about my chatbot log stream and suggest improvements
  ```
</CodeGroup>
取得將 Galileo 可觀測性新增至 OpenAI 應用程式的逐步整合指南。以最少的程式碼變更自動記錄提示、回應、模型參數和 Token 使用量。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  How do I add Galileo logging to my OpenAI application?
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Show me how to integrate Galileo with OpenAI in TypeScript
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Help me set up Galileo observability for my GPT-4 chatbot
  ```
</CodeGroup>
取得將 Galileo 新增至 LangChain 應用程式的完整整合說明。透過自動記錄擷取鏈、代理和工具的完整追蹤。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  How do I integrate Galileo with my LangChain application?
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Show me how to add Galileo tracing to my LangChain agent
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Help me log my LangChain RAG pipeline with Galileo
  ```
</CodeGroup>
在所有 Galileo 文件中尋找相關資訊、程式碼範例、API 參考和實作指南。取得所需頁面的直接連結。
**您可以詢問:**

<CodeGroup>
  ```text Query wrap theme={null}
  How do I set up data logging in Galileo?
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Find documentation about custom metrics
  ```
</CodeGroup>

<CodeGroup>
  ```text Query wrap theme={null}
  Search for examples of agentic AI evaluation
  ```
</CodeGroup>

使用案例範例

建立合成資料集

詢問您的 AI 助理:

```text Query wrap theme={null} Create a synthetic dataset with 20 customer service queries about product returns. Include both general queries and off-topic queries. ```

MCP 伺服器將引導您完成資料集建立流程,並提供資料集 ID 以追蹤進度。

取得整合協助

詢問您的 AI 助理:

```text Query wrap theme={null} How do I integrate Galileo with my LangChain application in Python? ```

MCP 伺服器將提供完整的整合程式碼範例和設定說明。

取得訊號

詢問您的 AI 助理:

```text Query wrap theme={null} Fetch the most recent signals from Galileo and propose fixes for them in my code ```

MCP 伺服器將分析您的日誌串流並提出改進建議。

疑難排解

* 檢查 MCP 伺服器網址是否設定為 `https://api.galileo.ai/mcp/http/mcp` * 確保 `Accept` 標頭設定為 `text/event-stream` * 在進行設定變更後重新啟動 IDE 的 MCP 連線 * 確認您的 API 金鑰已在設定中正確設定 * 檢查您的 API 金鑰是否尚未過期 * 從 [API 金鑰頁面](https://app.galileo.ai/settings/api-keys) 產生新的 API 金鑰

後續步驟

了解如何使用 Galileo 記錄您的第一個追蹤 設定並執行實驗以評估您的 AI 應用程式 了解 Galileo 與第三方框架的整合