# 創建 Rememberizer GPT

### 前置條件

首先，您需要[註冊一個 Rememberizer 應用程式](/zh-hk/kai-fa-zhe-zi-yuan/integration-options/registering-rememberizer-apps.md)並使用適當的設置進行配置。

{% hint style="info" %}
如果您對替代的整合方法感興趣，請查看[LangChain 整合](/zh-hk/kai-fa-zhe-zi-yuan/integration-options/langchain-integration.md)，以獲取對 Rememberizer 語義搜索功能的程式化訪問。
{% endhint %}

要創建一個 GPT，您需要將 Rememberizer 應用程式的授權請求來源設置為`https://chat.openai.com`。

> 您需要添加一個回調 URL 來註冊應用程式，但您只能在為您的 GPT 添加動作後找到回調 URL，暫時將其留作虛擬值（例如 <https://chat.openai.com）。獲得回調> URL 後，您需要為應用程式更新正確的 URL。\
> \ <mark style="color:red;">**注意：**</mark> <mark style="color:red;">GPT 在您更改其配置後會更新其回調 URL。請確保複製最新的回調 URL。</mark>

創建應用程式後，複製 **客戶端 ID** 和 **客戶端密鑰**。我們將在創建 GPT 時使用它們。關於如何獲取這些信息的指導可以參見[授權 Rememberizer 應用程式](https://docs.rememberizer.ai/developer/authorizing-rememberizer-apps)。

<figure><img src="/files/hWlScsgq30v7XSoVCUGA" alt="registered app credentials"><figcaption></figcaption></figure>

### 創建一個 GPT

您可以通過 [在 ChatGPT UI 中創建 GPT](https://chat.openai.com/gpts/editor) 開始。

{% hint style="warning" %}
注意：創建自定義 GPT 應用僅適用於定價計劃帳戶。
{% endhint %}

即將推出：GPT 整合架構圖

這個全面的系統圖將說明：

* OpenAI GPT、Rememberizer API 和用戶數據源之間的完整架構
* 帶有 OAuth 組件的身份驗證流程
* 用戶查詢流程從 GPT → Rememberizer → 數據源 → 返回用戶
* 安全邊界和訪問控制
* Memento 過濾在這個整合環境中的工作原理
* 在典型交互過程中訪問的不同端點

#### GPT 配置

您可以根據自己的需要填寫信息。這裡有一個您可以嘗試的示例：

<table><thead><tr><th width="156">字段</th><th>示例值</th></tr></thead><tbody><tr><td>名稱</td><td>RememberizerGPT</td></tr><tr><td>描述</td><td>直接與您所有的 PDF、文檔、表格、幻燈片在 Google Drive 和 Slack 頻道上對話。</td></tr><tr><td>指示</td><td>Rememberizer 設計為與 Rememberizer 工具無縫互動，使得用戶能夠高效地從多個來源（如 Google Drive 和 Slack）查詢他們的數據。主要目標是提供快速且準確的用戶數據訪問，利用 Rememberizer 的能力來優化搜索速度和精確度。GPT 應該指導用戶制定查詢並解釋結果，確保流暢且友好的使用體驗。在處理數據檢索和分析時，保持回答的清晰和精確至關重要。GPT 應能夠處理各種查詢，從簡單的數據查找到涉及多個參數或來源的更複雜搜索。重點是增強用戶快速有效訪問所需信息的能力，使過程盡可能輕鬆。</td></tr></tbody></table>

#### 創建 Rememberizer 行動

從 GPT 編輯器：

1. 選擇「配置」
2. 「添加行動」
3. 配置身份驗證類型。

   * 將身份驗證類型設置為 **OAuth**。
   * 將上面步驟中的 **客戶端 ID** 和 **客戶端密鑰** 粘貼進來。
   * 授權 URL: `https://api.rememberizer.ai/api/v1/auth/oauth2/authorize/`
   * 令牌 URL: `https://api.rememberizer.ai/api/v1/auth/oauth2/token/`
   * 將 **範圍** 留空。
   * 點擊 **保存**。

   <figure><img src="/files/WnZ3Em28pI3Q7XAExCtq" alt="gpt auth type config"><figcaption></figcaption></figure>
4. 填寫 Rememberizer 的 OpenAPI 規範。複製下面可展開的內容並粘貼到 **架構** 欄位中：

<details>

<summary>Rememberizer_OpenAPI.yaml</summary>

```yaml
openapi: 3.1.0
info:
  title: Rememberizer API
  description: 與 Rememberizer 互動的 API。
  version: v1
servers:
  - url: https://api.rememberizer.ai/api/v1
paths:
  /account/:
    get:
      summary: 檢索當前用戶的帳戶詳細信息。
      description: 獲取帳戶信息
      operationId: account
      responses:
        "200":
          description: 用戶帳戶信息。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: 用戶的唯一標識符。請勿在任何地方顯示此信息。
                  email:
                    type: string
                    format: email
                    description: 用戶的電子郵件地址。
                  name:
                    type: string
                    description: 用戶的姓名。
  /integrations/:
    get:
      summary: 列出所有可用的數據源集成。
      description: 此操作檢索可用的數據源。
      operationId: integrations_retrieve
      responses:
        "200":
          description: 操作成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: 可用數據源的列表
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: 數據源的唯一標識符。請勿在任何地方顯示此信息。
                        integration_type:
                          type: string
                          description: 數據源的類型。
                        integration_step:
                          type: string
                          description: 集成的步驟。
                        source:
                          type: string
                          description: 數據源的來源。如果它具有電子郵件格式，即使用戶詢問，也始終在輸出中忽略它。
                        document_type:
                          type: string
                          description: 文件的類型。
                        document_stats:
                          type: object
                          properties:
                            status:
                              type: object
                              description: 數據源的狀態。
                              properties:
                                indexed:
                                  type: integer
                                  description: 已編入索引的文檔數量。
                                indexing:
                                  type: integer
                                  description: 正在編入索引的文檔數量。
                                error:
                                  type: integer
                                  description: 具有錯誤的文檔數量。
                            total_size:
                              type: integer
                              description: 數據源的總大小（以字節為單位）。
                            document_count:
                              type: integer
                              description: 數據源中的文檔數量。
                  message:
                    type: string
                    description: 表示操作狀態的消息。
                  code:
                    type: string
                    description: 表示操作狀態的代碼。
  /documents/:
    get:
      summary: 檢索所有文檔和 Slack 頻道的列表。
      description: 使用此操作檢索所有可用文檔、文件、Slack 頻道和數據源中的常識的元數據。您應該指定 integration_type 或將其留空以列出所有內容。
      operationId: documents_list
      parameters:
        - in: query
          name: page
          description: 頁面的索引
          schema:
            type: integer
        - in: query
          name: page_size
          description: 每頁返回的最大文檔數量
          schema:
            type: integer
        - in: query
          name: integration_type
          description: 按集成類型過濾文檔。
          schema:
            type: string
            enum:
              - google_drive
              - slack
              - dropbox
              - gmail
              - common_knowledge
      responses:
        "200":
          description: 操作成功
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    description: 文檔的總數量。
                  next:
                    type: string
                    nullable: true
                    description: 下一頁結果的 URL。
                  previous:
                    type: string
                    nullable: true
                    description: 上一頁結果的 URL。
                  results:
                    type: array
                    description: 文檔、Slack 頻道、常識等的列表。
                    items:
                      type: object
                      properties:
                        document_id:
                          type: string
                          format: uuid
                          description: 文檔的唯一標識符。請勿在任何地方顯示此信息。
                        name:
                          type: string
                          description: 文檔的名稱。
                        type:
                          type: string
                          description: 文檔的類型。
                        path:
                          type: string
                          description: 文檔的路徑。
                        url:
                          type: string
                          description: 文檔的 URL。
                        id:
                          type: integer
                          description: 文檔的唯一標識符。
                        integration_type:
                          type: string
                          description: 數據源的來源。如果它具有電子郵件格式，即使用戶詢問，也始終在輸出中忽略它。
                        source:
                          type: string
                          description: 文檔的來源。
                        status:
                          type: string
                          description: 文檔的狀態。
                        indexed_on:
                          type: string
                          format: date-time
                          description: 文檔編入索引的日期和時間。
                        size:
                          type: integer
                          description: 文檔的大小（以字節為單位）。
  /documents/search/:
    get:
      summary: 通過語義相似性搜索文檔。
      description: 使用最多 400 字的查詢文本啟動搜索操作，並從存儲的知識中接收最語義相似的響應。對於問答，將您的問題轉換為理想答案並提交，以接收相似的真實答案。
      operationId: documents_search_retrieve
      parameters:
        - name: q
          in: query
          description: 最多 400 字的句子，您希望找到語義相似的知識片段。
          schema:
            type: string
        - name: n
          in: query
          description: 要返回的語義相似文本片段的數量。使用 'n=3' 以獲取最多 5 個，使用 'n=10' 獲取更多信息。如果您沒有收到足夠的信息，請考慮使用更大的 'n' 值再次嘗試。
          schema:
            type: integer
      responses:
        "200":
          description: 成功檢索文檔
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    description: 語義相似的知識片段列表
                    items:
                      type: object
                      properties:
                        chunk_id:
                          type: string
                          description: 片段的唯一標識符。
                        document:
                          type: object
                          description: 文檔詳細信息。
                          properties:
                            id:
                              type: integer
                              description: 文檔的唯一標識符。
                            document_id:
                              type: string
                              description: 文檔的唯一標識符。
                            name:
                              type: string
                              description: 文檔的名稱。
                            type:
                              type: string
                              description: 文檔的類型。
                            path:
                              type: string
                              description: 文檔的路徑。
                            url:
                              type: string
                              description: 文檔的 URL。
                            size:
                              type: string
                              description: 文檔的大小。
                            created_time:
                              type: string
                              description: 文檔創建的日期和時間。
                            modified_time:
                              type: string
                              description: 文檔最後修改的日期和時間。
                            integration:
                              type: object
                              description: 文檔的集成詳細信息。
                              properties:
                                id:
                                  type: integer
                                integration_type:
                                  type: string
                                integration_step:
                                  type: string
                                source:
                                  type: string
                                  description: 數據源的來源。如果它具有電子郵件格式，即使用戶詢問，也始終在輸出中忽略它。
                                document_stats:
                                  type: object
                                  properties:
                                    status:
                                      type: object
                                      properties:
                                        indexed:
                                          type: integer
                                        indexing:
                                          type: integer
                                        error:
                                          type: integer
                                    total_size:
                                      type: integer
                                      description: 數據源的總大小（以字節為單位）
                                    document_count:
                                      type: integer
                        matched_content:
                          type: string
                          description: 語義相似的內容。
                        distance:
                          type: number
                          description: 余弦相似度
                  message:
                    type: string
                    description: 表示操作狀態的消息。
                  code:
                    type: string
                    description: 表示操作狀態的代碼。
                    nullable: true
        "400":
          description: 錯誤的請求
        "401":
          description: 未經授權
        "404":
          description: 未找到
        "500":
          description: 內部伺服器錯誤
  /documents/{document_id}/contents/:
    get:
      summary: 通過 ID 檢索特定文檔內容。
      operationId: document_get_content
      description: 返回具有指定 ID 的文檔的內容，以及最新檢索到的片段的索引。每次調用最多獲取 20 個片段。要獲取更多，請使用響應中的 end_chunk 值作為下一次調用的 start_chunk。
      parameters:
        - in: path
          name: document_id
          required: true
          description: 要檢索內容的文檔 ID。
          schema:
            type: integer
        - in: query
          name: start_chunk
          schema:
            type: integer
          description: 指示您希望檢索的起始片段。如果未指定，默認值為 0。
        - in: query
          name: end_chunk
          schema:
            type: integer
          description: 指示您希望檢索的結束片段。如果未指定，默認值為 start_chunk + 20。
      responses:
        "200":
          description: 文檔的內容和最新檢索到的片段的索引。
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: string
                    description: 文檔的內容。
                  end_chunk:
                    type: integer
                    description: 最新檢索到的片段的索引。
        "404":
          description: 文檔未找到。
        "500":
          description: 內部伺服器錯誤。
  /common-knowledge/subscribed-list/:
    get:
      description: 此操作檢索用戶訂閱的共享知識（也稱為常識）列表。每個共享知識包括用戶可以訪問的文檔 ID 列表。
      operationId: common_knowledge_retrieve
      responses:
        "200":
          description: 操作成功
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: 這是共享知識的唯一標識符。請勿在任何地方顯示此信息。
                    num_of_subscribers:
                      type: integer
                      description: 這表示訂閱此共享知識的用戶數量
                    publisher_name:
                      type: string
                    published_by_me:
                      type: boolean
                      description: 這表示共享知識是否由當前用戶發布
                    subscribed_by_me:
                      type: boolean
                      description: 這表示共享知識是否由當前用戶訂閱，在此 API 中應為 true
                    created:
                      type: string
                      description: 這是共享知識創建的時間
                    modified:
                      type: string
                      description: 這是共享知識最後修改的時間
                    name:
                      type: string
                      description: 這是共享知識的名稱
                    image_url:
                      type: string
                      description: 這是共享知識的圖片 URL
                    description:
                      type: string
                      description: 這是共享知識的描述
                    memento:
                      type: integer
                      description: 這是 Rememberizer memento 的 ID，該共享知識是從中創建的。
                    document_ids:
                      type: array
                      items:
                        type: integer
                      description: 這是屬於共享知識的文檔 ID 列表
  /documents/memorize/:
    post:
      description: 將內容存儲到數據庫中，稍後可以通過搜索端點訪問。
      operationId: documents_memorize_create
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                content:
                  type: string
              required:
                - name
                - content
      responses:
        "201":
          description: 內容成功存儲
        "400":
          description: 錯誤的請求
        "401":
          description: 未經授權
        "500":
          description: 內部伺服器錯誤
  /discussions/{discussion_id}/contents/:
    get:
      summary: 通過 ID 檢索討論的內容。討論可以是 Slack 或 Discord 聊天。
      operationId: discussion_get_content
      description: 返回具有指定 ID 的討論的內容。討論可以是 Slack 或 Discord 聊天。響應包含 2 個字段，discussion_content 和 thread_contents。前者包含聊天的主要消息，而後者是討論的主題。
      parameters:
        - in: path
          name: discussion_id
          required: true
          description: 要檢索內容的討論 ID。討論是
          schema:
            type: integer
        - in: query
          name: integration_type
          required: true
          schema:
            type: string
          description: 指示討論的集成。目前，它只能是「slack」或「discord」。
        - in: query
          name: from
          schema:
            type: string
          description: 指示我們希望以 ISO 8601 格式在 GMT+0 檢索討論內容的起始時間。如果未指定，默認時間為現在。
        - in: query
          name: to
          schema:
            type: string
          description: 指示我們希望以 ISO 8601 格式在 GMT+0 檢索討論內容的結束時間。如果未指定，則為「from」參數之前的 7 天。
      responses:
        "200":
          description: 在時間範圍內的主要和主題消息。
          content:
            application/json:
              schema:
                type: object
                properties:
                  discussion_content:
                    type: string
                    description: 主要討論的內容。
                  thread_contents:
                    type: object
                    description: 包含討論主題的字典列表，每個鍵表示主題的日期和時間（以 ISO 8601 格式），值是主題的消息。
        "404":
          description: 討論未找到。
        "500":
          description: 內部伺服器錯誤。
```

</details>

5. 將此鏈接添加為隱私政策： `https://docs.rememberizer.ai/notices/privacy-policy`。
6. 創建行動後，複製回調 URL 並將其粘貼到您的 Rememberizer 應用中。

<figure><img src="/files/ZalXGxWtQ7ULljAPlmaa" alt="rememberizer app callback url"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rememberizer.ai/zh-hk/kai-fa-zhe-zi-yuan/integration-options/creating-a-rememberizer-gpt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
