GitbookIO / GitbookIO/gitbook

"Test it" tool for AI ask is prepopulated with erroneous request body

Open
#2,433 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
TypeScript
Stars
29k
Forks
4k
Avg merge
1d 2h
Merged PRs (30d)
71

Description

It appears that all of the AI ask endpoints descriptions on this page show the body as only requiring a query parameter. However, if you go to run a request via the "Test it" button on that page, the editor loads with the following request body prepopulated:

{
  "query": "",
  "previousQueries": [
    null
  ]
}

If you fill in your query and run it as-is, without editing the contents of the previousQueries array, you'll get the following 422 error response:

{
  "error": {
    "code": 422,
    "message": "body.previousQueries.0: expected a string"
  }
}

Editing the body to make previousQueries be an empty array, or deleting previousQueries entirely causes the request to succeed. Given that previousQueries is deprecated and appears to no longer be functional, I'd think it should be removed from the "Test it" tool.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AI ask endpoint documentation at the linked search reference page and inspect the request body used by its “Test it” tool. Remove the deprecated previousQueries value from the prepopulated body, then verify that a request containing only query succeeds without the 422 response.

Written by the indexing model from the issue text.

Assessment

Domain
api, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.