openai gpt Assistant api, or embeddings template? How to select version when git cloning?
Hey when i git clone the project i get the ai gpt scheduler/task manager as the openai demoapp page template. (as said in earlier question I dont get the latest version of the code running: wasp start > selecting 1-4 templates (static, todo, saas, embeddings?). But i would want to have the openai template that was in that version, and also use the embeddings?
Alternatively, or also a new template using the openai gpt Assistants api would be great. SInce that has built in embedding vector search context. But Could i at least get the latest code with the template that is in wasp start template Saas? This is not a schedule/task manager but was more of a chat with gpt.
27 Replies
if i can get this template but on the latest code, since i guess it can mess stuff up if i just copy from an older version? Ill try and port i guess.
~~~~~~~~~~
also im trying myself to use the gpt assistant api but im not sure how to import openai into the actions.ts file, the new Assistant api code doesnt seem to work in actions.ts file.
@Vinny (@Wasp) could you take a look at this?
@Nurium you can find it in the old version of the Saas template https://github.com/wasp-lang/SaaS-Template-GPT
you'll specifically want the
client/GptPage.tsx
and the associated actions in server/actions.ts
https://github.com/wasp-lang/SaaS-Template-GPT/blob/master/src/server/actions.ts#L71-L148i tried to port it but didnt work
from the version i dl the other day, ill try with the git link
since there is a change in the other code
you just want to copy and paste the client code from
GptPage
into the DemoAppPage
on the new tempalte
as well as the actionsoh ok
in the links above
got it, seems my own version might have older code, at least the stripe logic
i don't think the stripe logic really relates to the GPT generation. As long as the
user.hasPaid
property is true, it will workseems i used my own client ui, ill try the original as u said
[Server!] HttpError: Bad response from OpenAI
[Server!] at generateGptResponse (file:///home/nurium_ubuntu/Projects/tezty/open-saas/app/.wasp/out/server/dist/ext-src/actions.js:88:19)
[Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[Server!] at async file:///home/nurium_ubuntu/Projects/tezty/open-saas/app/.wasp/out/server/dist/middleware/operations.js:9:24
[Server!] at async file:///home/nurium_ubuntu/Projects/tezty/open-saas/app/.wasp/out/server/dist/utils.js:15:9 {
[Server!] statusCode: 500
[Server!] }
[Server] POST /operations/generate-gpt-response 500 1839.256 ms - 38
not sure im replacing the right code:
"[Server] src/ext-src/actions.ts(68,67): error TS2304: Cannot find name 'RelatedObject'.
[Server] src/ext-src/actions.ts(116,45): error TS2304: Cannot find name 'OpenAIResponse'.
[Server] src/ext-src/actions.ts(118,29): error TS2339: Property 'RelatedObject' does not exist on type '{ User: UserDelegate<RejectOnNotFound | RejectPerOperation, DefaultArgs>; GptResponse: GptResponseDelegate<RejectOnNotFound | RejectPerOperation, DefaultArgs>; Task: TaskDelegate<...>; }'."
make sure you update the actions in your
main.wasp
file, along with the proper related entitiesoh ok
if you run into trouble, read this: https://wasp-lang.dev/docs/data-model/operations/overview
Overview | Wasp
While Entities enable help you define your app's data model and relationships, Operations are all about working with this data.
remove one not used and add used i guess
ok thx 🙂
you're welcome
also do you know why openai Assistant api doesnt seem to work in the actions.ts file?
~~~~~~
[Server] > npx tsc
[Server]
[Server] src/ext-src/actions.ts(84,36): error TS2339: Property 'beta' does not exist on type 'typeof import("/home/nurium_ubuntu/Projects/tezty/open-saas/app/.wasp/out/server/node_modules/openai/index")'.~~~~
In this n simular code:
const assistant = await openai.beta.assistants.create({
name: "Math Tutor",
[Server] src/ext-src/actions.ts(84,36): error TS2339: Property 'beta' does not exist on type 'typeof import("/home/nurium_ubuntu/Projects/tezty/open-saas/app/.wasp/out/server/node_modules/openai/index")'.
Property 'beta' does not exist...
probably related to whatever beta is
what's the version of openai in your main.wasp
dependencies?
the newest version is 4.24.7
if that doesn't work then you have to reference the openai documentationnot sure it seems i just cant access the openai module through the actions.ts file
import openai from 'openai';*
have you added openai to your dependencies in
main.wasp
?looks so, it was alredy there but i updated to .x.x.7
" ("@google-analytics/data", "4.1.0"),
("openai", "^4.24.7"),
("prettier", "3.1.1"),
("prettier-plugin-tailwindcss", "0.5.11"),
("zod", "3.22.4")
],
}"
im trying to implement the embedding template you have done into the saas-gpt-template i get the error when tryna run wasp db seed
"nurium_ubuntu@DESKTOP-NUD60OH:~/Projects/tezty4/open-saas/app$ wasp db seed
i tried using "NODE_OPTIONS="--max_old_space_size=4096" in .env.server
now its just loading when i try wasp db-seed
[Db] > [email protected] build
[Db] > npx tsc
[Db]
[Db] ⛔️ STRIPE_CUSTOMER_PORTAL_LINK is not defined [Db] Running seed: embedSeedScript~~~~
ben there for 1-2hours
its a big 40mb pdf im using tho, 2-3k pages
[Db] ⛔️ STRIPE_CUSTOMER_PORTAL_LINK is not defined [Db] Running seed: embedSeedScript
ChatGPT
A conversational AI system that listens, learns, and challenges