[API Chat] Issue when calling multiple connected resources from the API Chat
Description
I have an API with following resources
I issued following query
List all the station_id where city is London and get the platforms for each station_id
The expected outcome is first call /stations and get all the station_id from the payload and then call /stations/{station_id}
But API chat only executes the first part and stops responding (message saying it is trying to fetch rest). See below
Definition and the backend can be found in https://drive.google.com/drive/folders/1NajcZY7E2KOW6sSN7Sp-wzA-E0r64aZe
For single entry returned from GET /stations, it worked without an issue
ex: List all platforms in station 'Waterloo'
Addtionally, Noticed in the latest pack, there is a dummy request happening. See below
These issues were noticed because resource parameters were getting dropped from the API definition when feeding to the LLM. Thereby, the LLM was unaware that such path parameters were needed for API invocation, hence, the hallucinations.
A workaround for this issue is mentioned below.
Instead of having parameters under the path item object like shown below:
/stations/{station_id}:
parameters:
- in: path
name: station_id
required: true
schema:
type: string
description: ID of the station to retrieve
get:
summary: Get station by ID
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
put:
summary: Update station information
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
Specify parameters within the operation object (i.e. within get, put, post, etc.) like so:
/stations/{station_id}:
get:
summary: Get station by ID
parameters:
- in: path
name: station_id
required: true
schema:
type: string
description: ID of the station to retrieve
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
put:
summary: Update station information
parameters:
- in: path
name: station_id
required: true
schema:
type: string
description: ID of the station to retrieve
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
Since the provided API definition is valid, we will have to fix this from our codebase.