Full text in search endpoint to improve CustomGPTs and other AI services #4905

Closed
opened 2026-02-05 09:25:17 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @Eseperio on GitHub (Aug 8, 2024).

API Endpoint or Feature

Enable the option of getting full article content when performing a search through the api instead of getting an excerpt

Use-Case

You can easily create a custom ChatGPT which feeds from bookstack app, but it is not as precise as it could be because it only has accesss to excerpts initially. I explain in additional context how i managed to create a powerful custom ChatGPT which can help our users to ask in a natural way

Additional context

To enhance the functionality of our application, I have developed a custom ChatGPT model that integrates with the Bookstack application. Here’s how you can create a similar setup:

  1. Create a Custom GPT: Start by creating a custom GPT using a ChatGPT Plus account.

  2. Define Actions: Set up the actions your custom GPT can use. In my case, I have configured it to interact with two API endpoints: search and full article.

  3. Design the Prompt: Craft a prompt to guide your custom GPT. The prompt should teach the model to generate the best query based on the user's question, perform a search, and then evaluate the results to determine which article best fits the user's query. Finally, it should provide a tailored response to the user.

Prompt Example

You are a help assistant for the YourBookStackInstallationName application. Your mission is to provide information from the manual according to the users' questions. To do this, you must understand what the user is saying and connect to the Bookstack application's API to find the relevant information. Currently, you only have one book at the URL https://yourbookstack.com/api/books/2. You can also use a search endpoint that will help you locate the information more quickly. The search query URL is constructed as follows: https://yourbookstack.com/api/search?query=price. For each result returned by the search, there is a parameter called url that will show you the page content so you can provide better information. When giving a response, you should provide the necessary information and include the link to the article where you found the information, so the user can view it. When conducting the search, do not use only the first result. Evaluate which results best match the query and choose the result based on this.

  1. OpenAPI Configuration: Configure the API endpoints using an OpenAPI JSON specification. This allows your custom GPT to interact with the Bookstack API effectively.

OpenAPI JSON Example

{
  "openapi": "3.1.0",
  "info": {
    "title": "YourBookStackInstallationName API",
    "description": "API to interact with YourBookStackInstallationName.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://kb.yourbookstackinstallationname.com/api",
      "description": "Main server"
    }
  ],
  "paths": {
    "/search": {
      "get": {
        "operationId": "searchArticles",
        "summary": "Search articles.",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search term to find articles."
          }
        ],
        "responses": {
          "200": {
            "description": "List of found articles.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "integer"
                      },
                      "title": {
                        "type": "string"
                      },
                      "summary": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/pages/{id}": {
      "get": {
        "operationId": "getPageById",
        "summary": "View article details by ID.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Article details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "title": {
                      "type": "string"
                    },
                    "content": {
                      "type": "string"
                    },
                    "author": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Recommendation

I suggest adding a chapter in the README to highlight this possibility. It would provide users with a clear guide on how to create and implement a custom ChatGPT that enhances their interaction with the Bookstack application. This could significantly improve user experience by enabling more precise and contextually relevant information retrieval.

Originally created by @Eseperio on GitHub (Aug 8, 2024). ### API Endpoint or Feature Enable the option of getting full article content when performing a search through the api instead of getting an excerpt ### Use-Case You can easily create a custom ChatGPT which feeds from bookstack app, but it is not as precise as it could be because it only has accesss to excerpts initially. I explain in additional context how i managed to create a powerful custom ChatGPT which can help our users to ask in a natural way ### Additional context To enhance the functionality of our application, I have developed a custom ChatGPT model that integrates with the Bookstack application. Here’s how you can create a similar setup: 1. **Create a Custom GPT**: Start by creating a custom GPT using a ChatGPT Plus account. 2. **Define Actions**: Set up the actions your custom GPT can use. In my case, I have configured it to interact with two API endpoints: `search` and `full article`. 3. **Design the Prompt**: Craft a prompt to guide your custom GPT. The prompt should teach the model to generate the best query based on the user's question, perform a search, and then evaluate the results to determine which article best fits the user's query. Finally, it should provide a tailored response to the user. #### Prompt Example > You are a help assistant for the YourBookStackInstallationName application. Your mission is to provide information from the manual according to the users' questions. To do this, you must understand what the user is saying and connect to the Bookstack application's API to find the relevant information. Currently, you only have one book at the URL https://yourbookstack.com/api/books/2. You can also use a search endpoint that will help you locate the information more quickly. The search query URL is constructed as follows: https://yourbookstack.com/api/search?query=price. For each result returned by the search, there is a parameter called `url` that will show you the page content so you can provide better information. When giving a response, you should provide the necessary information and include the link to the article where you found the information, so the user can view it. When conducting the search, do not use only the first result. Evaluate which results best match the query and choose the result based on this. 4. **OpenAPI Configuration**: Configure the API endpoints using an OpenAPI JSON specification. This allows your custom GPT to interact with the Bookstack API effectively. #### OpenAPI JSON Example ```json { "openapi": "3.1.0", "info": { "title": "YourBookStackInstallationName API", "description": "API to interact with YourBookStackInstallationName.", "version": "1.0.0" }, "servers": [ { "url": "https://kb.yourbookstackinstallationname.com/api", "description": "Main server" } ], "paths": { "/search": { "get": { "operationId": "searchArticles", "summary": "Search articles.", "parameters": [ { "name": "query", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Search term to find articles." } ], "responses": { "200": { "description": "List of found articles.", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer" }, "title": { "type": "string" }, "summary": { "type": "string" } } } } } } } } } }, "/pages/{id}": { "get": { "operationId": "getPageById", "summary": "View article details by ID.", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "Article details.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "integer" }, "title": { "type": "string" }, "content": { "type": "string" }, "author": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" } } } } } } } } } } } ``` ### Recommendation I suggest adding a chapter in the README to highlight this possibility. It would provide users with a clear guide on how to create and implement a custom ChatGPT that enhances their interaction with the Bookstack application. This could significantly improve user experience by enabling more precise and contextually relevant information retrieval.
OVERLORD added the 🔩 API Request label 2026-02-05 09:25:17 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Aug 8, 2024):

Thanks for the suggestion @Eseperio.
Generally though I don't look to make changes to the API to suit specific requirements/limitations in external platforms, so I wouldn't be keen to make changes specifically for this use-case.

I suggest adding a chapter in the README to highlight this possibility.

I'd consider that outside the scope of the readme. I don't want to start maintaining guidance/options for use with external platforms, especially where proprietary.

@ssddanbrown commented on GitHub (Aug 8, 2024): Thanks for the suggestion @Eseperio. Generally though I don't look to make changes to the API to suit specific requirements/limitations in external platforms, so I wouldn't be keen to make changes specifically for this use-case. > I suggest adding a chapter in the README to highlight this possibility. I'd consider that outside the scope of the readme. I don't want to start maintaining guidance/options for use with external platforms, especially where proprietary.
Author
Owner

@ssddanbrown commented on GitHub (Oct 14, 2024):

I'll go ahead and close this off as per my thoughts above.

@ssddanbrown commented on GitHub (Oct 14, 2024): I'll go ahead and close this off as per my thoughts above.
Author
Owner

@Eseperio commented on GitHub (Oct 14, 2024):

Oh, but the request was having the possibility to get full content in search instead of excerpt.

@Eseperio commented on GitHub (Oct 14, 2024): Oh, but the request was having the possibility to get full content in search instead of excerpt.
Author
Owner

@ssddanbrown commented on GitHub (Oct 14, 2024):

Sure, which can be achieved via multiple requests, but this was desired to be usable (or more efficient) with a specific service. I'm not keen on adding additional options/data to endpoints just for convenience or external limitation otherwise we'll end up in a mess, with every endpoint full of data and options to suit all use-cases instead of having specific roles.

You could alternatively create some kind of middleware app (that combines the data into a single response for the required services) or even build custom endpoints for your use case via the logical theme system.

@ssddanbrown commented on GitHub (Oct 14, 2024): Sure, which can be achieved via multiple requests, but this was desired to be usable (or more efficient) with a specific service. I'm not keen on adding additional options/data to endpoints just for convenience or external limitation otherwise we'll end up in a mess, with every endpoint full of data and options to suit all use-cases instead of having specific roles. You could alternatively create some kind of middleware app (that combines the data into a single response for the required services) or even build custom endpoints for your use case via the logical theme system.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#4905