创建一个 Rememberizer GPT

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

前提条件

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

如果您对其他集成方法感兴趣,请查看LangChain 集成,以便以编程方式访问 Rememberizer 的语义搜索功能。

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

您需要添加一个回调 URL 来注册应用,但您只能在为您的 GPT 添加操作后找到回调 URL,目前只需将其留作虚拟值(例如 https://chat.openai.com)。在获得回调 URL 后,您需要为应用更新正确的 URL。 注意: GPT 在您更改其配置后会更新其回调 URL。确保复制最新的回调 URL。

创建应用后,复制 客户端 ID客户端密钥。我们将在创建 GPT 时使用它们。有关如何获取这些信息的说明,请访问授权 Rememberizer 应用

注册的应用凭据

创建一个 GPT

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

即将推出:GPT 集成架构图

该综合系统图将说明:

  • OpenAI GPT、Rememberizer API 和用户数据源之间的完整架构

  • 带有 OAuth 组件的身份验证流程

  • 用户查询流程从 GPT → Rememberizer → 数据源 → 返回用户

  • 安全边界和访问控制

  • Memento 过滤在此集成环境中的工作原理

  • 在典型交互中访问的不同端点

GPT 配置

您可以根据自己的需要填写信息。以下是您可以尝试的示例:

字段
示例值

名称

RememberizerGPT

描述

直接与您在 Google Drive 和 Slack 频道上的所有 PDF、文档、表格、幻灯片对话。

说明

Rememberizer 旨在与 Rememberizer 工具无缝互动,使用户能够高效地从多个来源(如 Google Drive 和 Slack)查询他们的数据。主要目标是提供快速准确的用户数据访问,利用 Rememberizer 的能力来优化搜索速度和精确度。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/

    • 范围 留空。

    • 点击 保存

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

Rememberizer_OpenAPI.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 备忘录的 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: 服务器内部错误。
  1. 将此链接添加为隐私政策: https://docs.rememberizer.ai/notices/privacy-policy

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

rememberizer app callback url

Last updated