创建 Rememberizer GPT

在本教程中,您将学习如何创建一个 Rememberizer 应用程序并连接 OpenAI GPT,使 GPT 能够访问 Rememberizer API 功能。

先决条件

首先,您需要注册一个Rememberizer应用并用适当的设置进行配置。

要创建GPT,您需要将Rememberizer应用的已授权请求源设置为https://chat.openai.com

您需要添加一个回调URL来注册应用,但只有在给您的GPT添加一个动作后才能找到回调URL,现在只需要将其设为一个虚设值(例如https://chat.openai.com)。获取到回调URL后,您需要为应用程序更新正确的URL。 注意: 每当您更改配置时,GPT将更新其回调URL。确保复制最新的回调URL。

创建应用后,复制客户端ID客户端密钥。我们将在创建GPT时使用它们。

创建一个GPT

您可以从在ChatGPT UI中创建一个GPT开始。

GPT 配置

您可以根据自己的需求填写信息。这里有一个示例供您尝试:

字段示例值

名称

记忆器

描述

直接与 Google Drive 和 Slack 频道上的所有 PDF、文档、表格和幻灯片进行交流。

说明

记忆器旨在与记忆器工具无缝交互,使用户可以高效地从 Google Drive 和 Slack 等多个来源查询他们的数据。主要目标是提供快速准确地访问用户数据的方式,利用记忆器的能力优化搜索速度和精度。GPT应引导用户制定他们的查询并解释结果,确保流畅且用户友好的体验。在处理数据检索和分析时,保持回应的清晰性和准确性至关重要。GPT 应该能够处理各种查询,从简单的数据查找到涉及多个参数或源的更复杂的搜索。重点是增强用户快速有效获取所需信息的能力,使过程尽可能的无需费力。

创建 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/

    • 范围 留空。

    • 点击 保存

  4. 填写 Rememberizer 的 OpenAPI 规范。复制下面可展开的内容并粘贴到 模式 字段中:

Rememberizer_OpenAPI.yaml
openapi: 3.0.0
info:
  title: Rememberizer API
  description: API用于与Rememberizer交互。
  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 渠道的元数据。
      operationId: documents_list_file_and_channel
      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, 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
                                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: 未授权
        "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 备忘录的 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:
                name:
                  type: string
                content:
                  type: string
              required:
                - name
                - content
      responses:
        "201":
          description: 内容成功存储
        "400":
          description: 错误请求
        "401":
          description: 未授权
        "500":
          description: 服务器内部错误
  1. 将此链接添加为隐私政策:https://docs.rememberizer.ai/notices/privacy-policy

  2. 创建操作后,复制回调 URL,并将其粘贴到您的 Rememberizer 应用中。

Last updated