TL;DR: I’m trying to build my GPTs and integrate them with my Flask server hosting on Replit as a source of action. GPTs keep giving me errors, and upon looking at my flask server, it seems it’s not honoring my OpenAPI specs.
My GPTs: ChatGPT - Tic Tac Toe Game with Direct API Play
My endpoint: APIFlaskEndpoint - Replit
So, I tried very hard to integrate my API endpoint to my GPTs. Right now, GPTs is calling my endpoint correctly but it’s not getting useful back. There’s this weird errors: when I ask GPT it says the error is method not allowed (405). basically my OpenAPI config says it needs to be POST request, but I’m getting GET request, and I believe that’s why it’s failing. BTW I didn’t have any auth so I think it should not be auth related. I curled my host endpoint and it’s working fine.
OpenAI request intercepted at my flask app:
<Request 'http://apiflaskendpoint--yjianghong.repl.co/human_move' [GET]>
Headers:
Host: apiflaskendpoint--yjianghong.repl.co
User-Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot
Accept: */*
Accept-Encoding: gzip, deflate
Content-Type: application/json
Openai-Conversation-Id: 1138d991-a8be-5b9b-8ce9-24425ed88ce0
Openai-Ephemeral-User-Id: 771bad20-2f10-50cc-8785-18e8e26261ac
Openai-Gpt-Id: g-gLuNmwdjS
Openai-Subdivision-1-Iso-Code: US-NJ
Traceparent: 00-00000000000000002f205fed3920fb6d-5c0198402ac8a203-00
Tracestate: dd=s:0
X-Datadog-Parent-Id: 6629747527829201411
X-Datadog-Sampling-Priority: 0
X-Datadog-Trace-Id: 3395819591507704685
X-Forwarded-For: 13.66.11.98
X-Forwarded-Proto: https
X-Replit-User-Bio:
X-Replit-User-Id:
X-Replit-User-Name:
X-Replit-User-Profile-Image:
X-Replit-User-Roles:
X-Replit-User-Teams:
X-Replit-User-Url:
Body:
b''
My OpenAPI config:
{
"openapi": "3.0.3",
"info": {
"title": "APIFlask",
"version": "0.1.0"
},
"servers": [
{
"url": "https://apiflaskendpoint--yjianghong.repl.co/"
}
],
"paths": {
"/human_move": {
"post": {
"summary": "This API endpoint is responsible for responding a tic tac toe game. The input is the board after human player played, and the output is the board after AI played",
"operationId": "Provide",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"board"
],
"properties": {
"board": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 1
}
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"board"
],
"properties": {
"board": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 1
}
}
}
}
}
}
}
},
"422": {
"description": "Validation error",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"detail": {
"type": "object",
"properties": {
"<location>": {
"type": "object",
"properties": {
"<field_name>": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Board": {
"type": "object",
"required": [
"board"
],
"properties": {
"board": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 1
}
}
}
}
},
"ValidationError": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"detail": {
"type": "object",
"properties": {
"<location>": {
"type": "object",
"properties": {
"<field_name>": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
}
}
}
Please advice how to debug this issue, thanks!