W
Wasp-langā€¢8mo ago
fpopa

I tried using "wasp ai" like this video https://www.youtube.com/watch?v=0 shows but it doesn't work

Generating plan (slowest step, usually takes 30 to 90 seconds)... Code agent failed with the http error: 404
20 Replies
kapa.ai
kapa.aiā€¢8mo ago
Hi @fpopa. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the video link you provided seems to be incomplete or incorrect, as it doesn't lead to a specific video. However, based on the information provided in the knowledge sources, the wasp ai command is used to create a new Wasp project using AI, just based on the app name and the description. Here is how you can use it:
wasp new:ai <app-name> <app-description> [<config-json>]
wasp new:ai <app-name> <app-description> [<config-json>]
This command uses AI to create a new Wasp project just based on the app name and the description. You can do the same thing with wasp new interactively. Run wasp new:ai for more info. If you're still having trouble, it might be helpful to check the official Wasp documentation (https://wasp-lang.dev/docs) or ask for help in the Wasp Discord community (https://discord.gg/rzdnErX). Please note that as of now, Wasp AI doesn't offer any additional help for developing your Wasp app with AI beyond initial generation. This is something the Wasp team is actively exploring. In the meantime, you might find the AI pair programming tool aider (https://github.com/paul-gauthier/aider) helpful. It's a third-party tool, not affiliated with Wasp, but some Wasp users have found it useful when working on Wasp apps. Sources: - Wasp CLI Reference (https://wasp-lang.dev/docs/general/cli#overview) - Developing Existing App with AI (https://wasp-lang.dev/docs/wasp-ai/developing-existing-app) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fpopa, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
fpopa
fpopaOPā€¢8mo ago
I understood how to generate it but it didn't work. I exported the generated API KEYs from a personal account as well as a company premium account. it might be some bad code used as the request ends up with 404 šŸ™‚
miho
mihoā€¢8mo ago
Which Wasp version are you using? wasp version
miho
mihoā€¢8mo ago
Creating New App with AI | Wasp
Wasp comes with its own AI: Wasp AI, aka Mage (Magic web App GEnerator).
fpopa
fpopaOPā€¢8mo ago
0.13.2 yep, that's what I'm trying - but it fails with 404 after I input the required description and the other things it requests after
miho
mihoā€¢8mo ago
Hmm @sodic could you test this locally? I'm not near a laptop this weekend
Filip
Filipā€¢8mo ago
Sure, I'll test it out as soon as get behind my computer (probably tomorrow morning) Hey @fpopa, I've tried it out and everything seems to be working as expected for my inputs. Can you copy the exact inputs and commands you give to wasp-ai and I'll try with those? I tried to run it both directly and interactively, and it succeeded both times. Here's how my output looks like when I run it non-interactively:
āÆ wasp new:ai expenses "Build an expense tracker that supports multiple users" "{}"

Generating a new Wasp project named expenses!

Using gpt-4-0613 (temp 0.7) for planning and gpt-3.5-turbo-0125 (temp 0.7) for coding.

Generating project skeleton...
> Wrote to file: expenses/tsconfig.json
> Wrote to file: expenses/.wasproot
> Wrote to file: expenses/.gitignore
> Wrote to file: expenses/.waspignore
> Wrote to file: expenses/src/vite-env.d.ts
> Wrote to file: expenses/public/.gitkeep
> Wrote to file: expenses/main.wasp
> Wrote to file: expenses/package.json
> Wrote to file: expenses/src/pages/auth/Login.jsx
> Wrote to file: expenses/src/pages/auth/Signup.jsx
> Wrote to file: expenses/.env.server
> Wrote to file: expenses/tailwind.config.cjs
> Wrote to file: expenses/postcss.config.cjs
> Wrote to file: expenses/src/Layout.jsx
> Wrote to file: expenses/src/Main.css
Generated project skeleton.

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Initial plan generated!
- 2 queries: ["getExpenses","getExpense"]
- 2 actions: ["createExpense","deleteExpense"]
- 2 entities: ["User","Expense"]
- 3 pages: ["ExpensesPage","ExpensePage","HomePage"]
Fixing initial plan...
Plan fixed!
...
Total tokens usage: ~31.8k

Done!
āÆ
āÆ wasp new:ai expenses "Build an expense tracker that supports multiple users" "{}"

Generating a new Wasp project named expenses!

Using gpt-4-0613 (temp 0.7) for planning and gpt-3.5-turbo-0125 (temp 0.7) for coding.

Generating project skeleton...
> Wrote to file: expenses/tsconfig.json
> Wrote to file: expenses/.wasproot
> Wrote to file: expenses/.gitignore
> Wrote to file: expenses/.waspignore
> Wrote to file: expenses/src/vite-env.d.ts
> Wrote to file: expenses/public/.gitkeep
> Wrote to file: expenses/main.wasp
> Wrote to file: expenses/package.json
> Wrote to file: expenses/src/pages/auth/Login.jsx
> Wrote to file: expenses/src/pages/auth/Signup.jsx
> Wrote to file: expenses/.env.server
> Wrote to file: expenses/tailwind.config.cjs
> Wrote to file: expenses/postcss.config.cjs
> Wrote to file: expenses/src/Layout.jsx
> Wrote to file: expenses/src/Main.css
Generated project skeleton.

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Initial plan generated!
- 2 queries: ["getExpenses","getExpense"]
- 2 actions: ["createExpense","deleteExpense"]
- 2 entities: ["User","Expense"]
- 3 pages: ["ExpensesPage","ExpensePage","HomePage"]
Fixing initial plan...
Plan fixed!
...
Total tokens usage: ~31.8k

Done!
āÆ
. And here's what I get when I run it interactively:
āÆ wasp new
Enter the project name (e.g. my-project) ā–ø expenses2
Choose a starter template
[1] basic (default)
Simple starter template with a single page.
[2] todo-ts
Simple but well-rounded Wasp app implemented with Typescript & full-stack type safety.
[3] saas
Everything a SaaS needs! Comes with Auth, ChatGPT API, Tailwind, Stripe payments and more. Check out https://opensaas.sh/ for more details.
[4] embeddings
Comes with code for generating vector embeddings and performing vector similarity search.
[5] ai-generated
šŸ¤– Describe an app in a couple of sentences and have Wasp AI generate initial code for you. (experimental)
ā–ø 5

šŸ --- Creating your project from the "ai-generated" template... ------------------

Describe your app in a couple of sentences ā–ø Build an expense tracker that supports multiple users
Choose GPT model(s) you want to use:
[1] gpt-4 (planning) + gpt-3.5-turbo (coding) (default)
Ok results. Cheap and fast. Best cost/benefit ratio.
[2] gpt-4 (planning) + gpt-4-turbo-preview (coding)
Possibly better results, but somewhat slower and somewhat more expensive (~2-3x).
[3] gpt-4 (planning + coding)
Best results, but quite slower and quite more expensive (~5x).
ā–ø 1
Choose the creativity level (temperature):
[1] Balanced (0.7) (default)
Optimal trade-off between creativity and possible mistakes.
[2] Conventional (0.4)
Generates sensible code with minimal amount of mistakes.
[3] Creative (1.0)
Generates more creative code, but mistakes are more likely.
ā–ø 2

Generating a new Wasp project named expenses2!

Using gpt-4-0613 (temp 0.4) for planning and gpt-3.5-turbo-0125 (temp 0.4) for coding.

...

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Initial plan generated!
...

Total tokens usage: ~33.4k

Done!

=========
āÆ wasp new
Enter the project name (e.g. my-project) ā–ø expenses2
Choose a starter template
[1] basic (default)
Simple starter template with a single page.
[2] todo-ts
Simple but well-rounded Wasp app implemented with Typescript & full-stack type safety.
[3] saas
Everything a SaaS needs! Comes with Auth, ChatGPT API, Tailwind, Stripe payments and more. Check out https://opensaas.sh/ for more details.
[4] embeddings
Comes with code for generating vector embeddings and performing vector similarity search.
[5] ai-generated
šŸ¤– Describe an app in a couple of sentences and have Wasp AI generate initial code for you. (experimental)
ā–ø 5

šŸ --- Creating your project from the "ai-generated" template... ------------------

Describe your app in a couple of sentences ā–ø Build an expense tracker that supports multiple users
Choose GPT model(s) you want to use:
[1] gpt-4 (planning) + gpt-3.5-turbo (coding) (default)
Ok results. Cheap and fast. Best cost/benefit ratio.
[2] gpt-4 (planning) + gpt-4-turbo-preview (coding)
Possibly better results, but somewhat slower and somewhat more expensive (~2-3x).
[3] gpt-4 (planning + coding)
Best results, but quite slower and quite more expensive (~5x).
ā–ø 1
Choose the creativity level (temperature):
[1] Balanced (0.7) (default)
Optimal trade-off between creativity and possible mistakes.
[2] Conventional (0.4)
Generates sensible code with minimal amount of mistakes.
[3] Creative (1.0)
Generates more creative code, but mistakes are more likely.
ā–ø 2

Generating a new Wasp project named expenses2!

Using gpt-4-0613 (temp 0.4) for planning and gpt-3.5-turbo-0125 (temp 0.4) for coding.

...

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Initial plan generated!
...

Total tokens usage: ~33.4k

Done!

=========
fpopa
fpopaOPā€¢8mo ago
Cool, i did it interactively both times, i'll try the non-interactive way as well by supplying all the parameters. Let me get back to you later and thanks for looking into it
āžœ wasp wasp new:ai expenses "Build an expense tracker that supports multiple users" "{}"


Generating a new Wasp project named expenses!

Using gpt-4-0613 (temp 0.7) for planning and gpt-3.5-turbo-0125 (temp 0.7) for coding.

Generating project skeleton...
> Wrote to file: expenses/.wasproot
> Wrote to file: expenses/.waspignore
> Wrote to file: expenses/.gitignore
> Wrote to file: expenses/tsconfig.json
> Wrote to file: expenses/public/.gitkeep
> Wrote to file: expenses/src/vite-env.d.ts
> Wrote to file: expenses/main.wasp
> Wrote to file: expenses/package.json
> Wrote to file: expenses/src/pages/auth/Login.jsx
> Wrote to file: expenses/src/pages/auth/Signup.jsx
> Wrote to file: expenses/.env.server
> Wrote to file: expenses/tailwind.config.cjs
> Wrote to file: expenses/postcss.config.cjs
> Wrote to file: expenses/src/Layout.jsx
> Wrote to file: expenses/src/Main.css
Generated project skeleton.

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Code agent failed with the http error: 404
wasp-bin: HttpExceptionRequest Request {
host = "api.openai.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")]
path = "/v1/chat/completions"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutMicro 300000000
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
āžœ wasp wasp new:ai expenses "Build an expense tracker that supports multiple users" "{}"


Generating a new Wasp project named expenses!

Using gpt-4-0613 (temp 0.7) for planning and gpt-3.5-turbo-0125 (temp 0.7) for coding.

Generating project skeleton...
> Wrote to file: expenses/.wasproot
> Wrote to file: expenses/.waspignore
> Wrote to file: expenses/.gitignore
> Wrote to file: expenses/tsconfig.json
> Wrote to file: expenses/public/.gitkeep
> Wrote to file: expenses/src/vite-env.d.ts
> Wrote to file: expenses/main.wasp
> Wrote to file: expenses/package.json
> Wrote to file: expenses/src/pages/auth/Login.jsx
> Wrote to file: expenses/src/pages/auth/Signup.jsx
> Wrote to file: expenses/.env.server
> Wrote to file: expenses/tailwind.config.cjs
> Wrote to file: expenses/postcss.config.cjs
> Wrote to file: expenses/src/Layout.jsx
> Wrote to file: expenses/src/Main.css
Generated project skeleton.

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Code agent failed with the http error: 404
wasp-bin: HttpExceptionRequest Request {
host = "api.openai.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")]
path = "/v1/chat/completions"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutMicro 300000000
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
StatusCodeException (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Date","Sun, 21 Apr 2024 16:54:23 GMT"),("Content-Type","application/json; charset=utf-8"),("Transfer-Encoding","chunked"),("Connection","keep-alive"),("vary","Origin"),("x-request-id[......]
StatusCodeException (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"}, responseVersion = HTTP/1.1, responseHeaders = [("Date","Sun, 21 Apr 2024 16:54:23 GMT"),("Content-Type","application/json; charset=utf-8"),("Transfer-Encoding","chunked"),("Connection","keep-alive"),("vary","Origin"),("x-request-id[......]
host = "api.openai.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")]
path = "/v1/chat/completions"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutMicro 300000000
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
}) "")
host = "api.openai.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")]
path = "/v1/chat/completions"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutMicro 300000000
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
}) "")
i see the authorization header is redacted, but there might be some info in the cookie of the response which I decided not to fully paste šŸ¤”
MEE6
MEE6ā€¢8mo ago
Wohooo @fpopa, you just became a Waspeteer level 1!
fpopa
fpopaOPā€¢8mo ago
no rush folks, feel free to continue investigating this Monday šŸ™‚
Filip
Filipā€¢8mo ago
No worries, I'm picking up the slack I left on Friday anyway šŸ™‚ Hmm, I tried inputting an invalid token on purpose. That resulted in something similar to what you get. It's the exact same error output apart from my response code being 401 (which makes sense since the token is invalid). Now, since you're getting a 404, you're api key is obviously valid. Is it possible that your API doesn't include querying this particular endpoint? In other words, could it be that your subscription (API KEY) does not allow access to /chat/completions for GPT 4 (which Wasp AI uses for the planning stage) and Open API decided to pretend the endpoint doesn't exist by returning a 404? I have very limited knowledge of OpenAI's pricing plans, and my idea above is purely guessing. If you know more then I do, please correct me šŸ˜…. If not, let's test my theory and see if you get the 404 when you do the planning with GPT 3:
wasp new:ai expenses "Build an expense tracker that supports multiple users" '{ "planningGptModel": "gpt-3.5-turbo-0125" }'
wasp new:ai expenses "Build an expense tracker that supports multiple users" '{ "planningGptModel": "gpt-3.5-turbo-0125" }'
fpopa
fpopaOPā€¢8mo ago
got 429... how many requests do we do against the API for this simple app generation?
āžœ wasp wasp new:ai expenses "Build an expense tracker that supports multiple users" '{ "planningGptModel": "gpt-3.5-turbo-0125" }'

Generating a new Wasp project named expenses!

Using gpt-3.5-turbo-0125 (temp 0.7) for planning and gpt-3.5-turbo-0125 (temp 0.7) for coding.

Generating project skeleton...
> Wrote to file: expenses/.wasproot
> Wrote to file: expenses/.waspignore
> Wrote to file: expenses/.gitignore
> Wrote to file: expenses/tsconfig.json
> Wrote to file: expenses/public/.gitkeep
> Wrote to file: expenses/src/vite-env.d.ts
> Wrote to file: expenses/main.wasp
> Wrote to file: expenses/package.json
> Wrote to file: expenses/src/pages/auth/Login.jsx
> Wrote to file: expenses/src/pages/auth/Signup.jsx
> Wrote to file: expenses/.env.server
> Wrote to file: expenses/tailwind.config.cjs
> Wrote to file: expenses/postcss.config.cjs
> Wrote to file: expenses/src/Layout.jsx
> Wrote to file: expenses/src/Main.css
Generated project skeleton.

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Caught retryable HTTP exception while doing ChatGPT request: Status code: 429; HttpExceptionRequest Request {
host = "api.openai.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")]
path = "/v1/chat/completions"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutMicro 300000000
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
(StatusCodeException (Response {responseStatus = Status {statusCode = 429, statusMessage = "Too Many Requests"}, responseVersion = HTTP/1.1, respon
āžœ wasp wasp new:ai expenses "Build an expense tracker that supports multiple users" '{ "planningGptModel": "gpt-3.5-turbo-0125" }'

Generating a new Wasp project named expenses!

Using gpt-3.5-turbo-0125 (temp 0.7) for planning and gpt-3.5-turbo-0125 (temp 0.7) for coding.

Generating project skeleton...
> Wrote to file: expenses/.wasproot
> Wrote to file: expenses/.waspignore
> Wrote to file: expenses/.gitignore
> Wrote to file: expenses/tsconfig.json
> Wrote to file: expenses/public/.gitkeep
> Wrote to file: expenses/src/vite-env.d.ts
> Wrote to file: expenses/main.wasp
> Wrote to file: expenses/package.json
> Wrote to file: expenses/src/pages/auth/Login.jsx
> Wrote to file: expenses/src/pages/auth/Signup.jsx
> Wrote to file: expenses/.env.server
> Wrote to file: expenses/tailwind.config.cjs
> Wrote to file: expenses/postcss.config.cjs
> Wrote to file: expenses/src/Layout.jsx
> Wrote to file: expenses/src/Main.css
Generated project skeleton.

Generating plan (slowest step, usually takes 30 to 90 seconds)...
Caught retryable HTTP exception while doing ChatGPT request: Status code: 429; HttpExceptionRequest Request {
host = "api.openai.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/json; charset=utf-8"),("Authorization","<REDACTED>")]
path = "/v1/chat/completions"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutMicro 300000000
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
(StatusCodeException (Response {responseStatus = Status {statusCode = 429, statusMessage = "Too Many Requests"}, responseVersion = HTTP/1.1, respon
interestingly my usage in https://platform.openai.com/usage shows 0 for everything, including API requests šŸ¤·
Filip
Filipā€¢8mo ago
got 429... how many requests do we do against the API for this simple app generation?
FYI (tangentially related), status code 429 is bit of a misnomer. "Too many reqeusts" suggests this happens after you exceed some number of requests, while in reality it's about how many requests you send in a certain time window (rate limiting). Therefore, you can get this status code with as little as two rapid requests (depending on the server's settings). More details on MDN: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429 As for your issue... If you're not in a rush, I'll leave the rest of this to @martinsos, he can pick it up tomorrow. Martin knows more about Open AI pricing plans and what exactly we do during the generation. Based on the 404 for GPT 4 and 429 for GPT 3, my best guess is that your Open AI plan is to restrictive for Wasp AI. The good news is: you can use our Open AI plan by generating your app in usemage.ai and downloading the Zip file. If this doesn't work for you, let's wait and see what @martinsos has to say.
fpopa
fpopaOPā€¢8mo ago
"Too many reqeusts" suggests this happens after you exceed some number of requests, while in reality it's about how many requests you send in a certain time window (rate limiting). Therefore, you can get this status code with as little as two rapid requests (depending on the server's settings).
yep, I totally agree šŸ™‚ I'm also a engineer - mostly doing backend nowadays
Based on the 404 for GPT 4 and 429 for GPT 3, my best guess is that your Open AI plan is to restrictive for Wasp AI.
do you have docs about which plans are supported and which not? I tried personal - not paid and a work paid plan No rush especially not on a Sunday evening šŸ™‚ thanks for checking things out @sodic didn't know about usemage.ai šŸ‘
Filip
Filipā€¢8mo ago
Great, we'll ping you tomorrow then! This is a surprise for sure because most of our users interested in AI generation find out about Wasp through usemage.ai Anyway, it's the same thing as running wasp new:ai but with our API key and through a web app, so it should help you out! šŸ™‚
fpopa
fpopaOPā€¢8mo ago
nice, I was spending some time researching wasp so I went to youtube as well, and that's where it poped up. just downloaded the zip, thanks for the help again, have a nice week ahead!
Filip
Filipā€¢8mo ago
Likewise!
martinsos
martinsosā€¢8mo ago
@sodic what you said sounds good -> I don't have any better idea than OpenAI not serving that API for some reason. 404 is weird though. We do about 10 to 20 requests per app, that doesn't trigger rate limiting for us (we can do 7 of these apps at the same time actually), but maybe your plan is different. Maybe you are behind some kind of VPN, with some access limited? Or maybe as @sodic said, for some reason your account doesn't have access to the GPT models in question? Maybe you are in a country that doesn't have access to OpenAI API (but I guess that is not the case or you would not be having all those keys, you are probably using them). But yeah, usemage.ai works excatly the same so you should be good with that! And it uses our tokens šŸ™‚
fpopa
fpopaOPā€¢8mo ago
yup, I just used usemage.ai in the end - quite weird šŸ¤· thanks anyway šŸ“ˆ
MEE6
MEE6ā€¢8mo ago
Wohooo @fpopa, you just became a Waspeteer level 2!
Want results from more Discord servers?
Add your server