LoginSignup
2
1

【GPTs】DocBaseと連携する

Posted at

GPTsとDocBaseを連携して、自然言語で検索できるようにする

DocBaseで目的の記事を見つけるのが手間になってきたため
GPTモデルを利用して自然言語のクエリを解釈し、それに基づいてDocbaseのAPIを通じて関連する記事を検索させるGPTsを作成する。

DocBaseのアクセストークンの取得

以下より、アクセストークンを発行する。
https://ドメイン.docbase.io/settings/tokens

GPTsのActionsの設定

Authentication

発行したアクセストークンを以下のように、設定する。
Custome Header Nameは、X-DocBaseToken にする。
image.png

Schema

記事一覧と、記事詳細のAPI schemaを登録する。

{
  "openapi": "3.1.0",
  "info": {
    "title": "Get Docbase Posts",
    "description": "Docbaseの記事を取得するAPIです",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://api.docbase.io"
    }
  ],
  "paths": {
    "/teams/ドメイン/posts": {
      "get": {
        "description": "DocBase記事一覧",
        "operationId": "GetDocBasePosts",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "docbase内のpostを絞り込むための検索文字列",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "ページ番号",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "1ページあたりの表示件数",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "deprecated": false
      }
    },
    "/teams/ドメイン/posts/{post_id}": {
      "get": {
        "description": "Docbase記事詳細",
        "operationId": "GetDocBasePost",
        "parameters": [
          {
            "name": "post_id",
            "in": "path",
            "description": "post_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "deprecated": false
      }
    }
  },
  "components": {
    "schemas": {}
  }
}

動作確認

スクリーンショット 2024-01-12 10.17.23.png

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1