ferrislucas / promptr

Promptr is a CLI tool that lets you use plain English to instruct GPT3 or GPT4 to make changes to your codebase.
MIT License
908 stars 37 forks source link

404 response #16

Closed glennfu closed 1 year ago

glennfu commented 1 year ago

I have GPT4 access, but I'm getting a 404 response, without any clues as to the where or why even with -v.

OPENAI_API_KEY=[key here] promptr -m gpt4 -x -t refactor $(git ls-tree -r --name-only HEAD | grep ".js" | tr '\n' ' ') -p "Remove any unused methods -v"

Prompt token count: 322002
(node:58364) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
    at createError (/Users/glenn/.nvm/versions/node/v14.19.0/lib/node_modules/@ifnotnowwhen/promptr/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/glenn/.nvm/versions/node/v14.19.0/lib/node_modules/@ifnotnowwhen/promptr/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/Users/glenn/.nvm/versions/node/v14.19.0/lib/node_modules/@ifnotnowwhen/promptr/node_modules/axios/lib/adapters/http.js:322:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:58364) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:58364) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ferrislucas commented 1 year ago

@glennfu thanks for opening this issue. I noticed the token count in your output is pretty large - I don’t know why that would cause a 404 though.

Do you still see the issue if you only send a single file? You can send a single file by just passing a single path instead of the ‘$(…)’

Also, are you seeing this with a codebase that I have access to?

glennfu commented 1 year ago

Testing it in the promptr project folder I got this:

promptr -m gpt4 -x -t refactor cliState.js -p "Remove any unused methods" -v

Prompt token count: 1044
(node:71961) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
    at createError (/Users/glenn/.nvm/versions/node/v14.19.0/lib/node_modules/@ifnotnowwhen/promptr/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/glenn/.nvm/versions/node/v14.19.0/lib/node_modules/@ifnotnowwhen/promptr/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/Users/glenn/.nvm/versions/node/v14.19.0/lib/node_modules/@ifnotnowwhen/promptr/node_modules/axios/lib/adapters/http.js:322:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:71961) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:71961) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
glennfu commented 1 year ago

Just for extra fun I built the project locally (M1 Mac) and got this:

cd dist && ./promptr -m gpt4 -x -t refactor cliState.js -p "Remove any unused methods" -v
...
Prompt token count: 354
(node:73649) UnhandledPromiseRejectionWarning: Error: Request failed with status code 404
    at createError (/snapshot/promptr/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/snapshot/promptr/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/snapshot/promptr/node_modules/axios/lib/adapters/http.js:322:11)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1333:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `promptr --trace-warnings ...` to show where the warning was created)
(node:73649) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:73649) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
glennfu commented 1 year ago

I just realized I don't think that I've been granted API access yet. I'm still on the waitlist. I can use GPT-4 on the frontend, but not the API. Loading the Playground doesn't show GPT-4 as an option. Switching to ./promptr -m gpt3 gives me results, so I guess that's all that it is!

ferrislucas commented 1 year ago

Ah okay glad to hear gpt3 is working for you. Let me know if you have other issues or ideas. Thanks for reaching out!