Custom GPT: Actions keep timing out after 30 seconds

Lisa Park
Lisa ParkDec 12, 2024

I built a custom GPT with an action that queries my database, but it times out almost every time. The action calls my API which typically responds in 5-10 seconds, well under the 30-second limit.

My OpenAPI spec:

openapi: 3.1.0
info:
  title: My Database API
  version: 1.0.0
servers:
  - url: https://api.myapp.com
paths:
  /search:
    get:
      operationId: searchDatabase
      parameters:
        - name: query
          in: query
          required: true
          schema:
            type: string

The weird thing is it works fine when I test the endpoint directly. Is there something about how ChatGPT makes the request that's different?

3.8k views20 replies41 likesSolved
1 Reply
Logan K.
Logan K.StaffAccepted AnswerDec 13

This is a known limitation of the older JSON mode. When the output approaches max_tokens, the model may not have enough tokens to close all brackets. Two solutions:

1. Use Structured Outputs instead (guaranteed valid JSON) 2. Set a higher max_tokens value

Structured Outputs is the recommended approach going forward.

Log in to reply to this topic.