How to pass the json content parameters in the ChatGPT action schema?

Hey everyone,

I am trying to build GPT agent action using my own API endpoint, and the endpoint parameter is a json content like below:

parameters:
  - name: filter
    in: query
    description: this is the search string.
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/search'

However, the ChatGPT agent action does not support content in the parameters, I encountered a schema is not an object error. Is there anyway to resolve it?

I think you’re just doing it wrong.

I’m not entirely sure how you intend to send a JSON object through the query string as a parameter, are you intending it to be a body parameter?

Hey thanks for the response, yes, the json object is part of query string, this is an example

/search?filter={"searchQuery":"monkeys","locationFilters":[]}&page=1&pageSize=10

The endpoint is designed in this way that I cannot change

Then I believe you will just need to pass it as a string, so it can be part of the query string.

If you share more of your schema I might be able to help more, it would also be useful to know anything about the endpoint you’re hitting.

Edit: It appears this is an OpenAPI v3 I wasn’t aware of since I’d not used this feature before.

But, I think we’d need to see the #/components/schemas/search definition to know more about what the issue is.

Sorry I do not have too much knowledge of the API, so please let me know if you need more information.

The #/components/schemas/search definition is very simple:

components:
  search:
    type: object
    properties:
      searchQuery:
        type: string
        example: "What is your product feature"

This is request I sent through postman, it is successful:

In my GPT agent, I would like to change the search query when call the API, so the ChatGPT could search first and use the result and answer the question.

This is how my GPT action schema looks like which throw me an invalid request error:

Try turning it off and on again.

Copy your schema, delete the action, and make a new action with the same schema.

There’s a weird issue with occasional action caching that only creating a new action can recover from.

I do not think it is the cache issue, I recreate the agent a few times.

I think pass the json as a string should work from format perspective:


But the GPT agent is not smart enough to dynamically generate the parameter like a json format string

Pass a json dictionary as a string worked. This is how the request parameter looks like:

{
  "filters": "{\"searchQuery\":\"what technology using\"}"
}

I used this description to tell GPT how to build this json string:

Allow users to search more information to answer the question, the parameter string should follow a json pattern like {searchQuery: }