Help consuming an endpoint(for an internalAction) from App.tsx

I'm new to the Convex platform, and while running the sample repository from this article(https://stack.convex.dev/ai-chat-using-langchain-and-convex#ingest-data-loading--splitting--embedding-data) I realized I don't know how to consume the endpoint they created with this line (https://github.com/get-convex/convex-ai-chat-langchain/blob/97610aa58f73ac5abaabdb1e926efceb6ff340f7/convex/ingest/load.ts#L35). I have tried different scripts I found in internet but nothing has worked so far. Can anyone help please? Thanks in advance!!!
Build AI Chat with LangChain and Convex
In this second post in our series, we’ll build an AI-powered chat interface using LangChain and its new Convex integration.
GitHub
convex-ai-chat-langchain/convex/ingest/load.ts at 97610aa58f73ac5ab...
AI chat with context retrieval using Convex and LangChain - get-convex/convex-ai-chat-langchain
8 Replies
ballingt
ballingt4mo ago
Internal actions generally can't be accessed from scripts; they can only be - run from other actions - scheduled from other actions or mutations - run via CLI npx convex run ingest/load:fetchAndEmbedSingle '{"arg": "value"}' - run from the dashboard function runner
Fredy D. | AmigoPago
thanks Tom, the CLI commands you wrote worked like a charm @ballingt regarding the option "run from other actions", do you have any example that I could try?
ballingt
ballingt4mo ago
Generally you don't need to do this, you can just write a helper function (just a TypeScript function) and call it.
ballingt
ballingt4mo ago
See https://docs.convex.dev/functions/actions for more about actions.
Actions | Convex Developer Hub
Actions can call third party services to do things such as processing a payment
ballingt
ballingt4mo ago
Is there a reason you wamt to call an action from another action? Generally scheduling actions is most useful https://docs.convex.dev/scheduling/scheduled-functions
Scheduled Functions | Convex Developer Hub
Convex allows you to schedule functions to run in the future. This allows you to
Fredy D. | AmigoPago
What I would like to do is to call the "fetchAndEmbedSingle" action when a user enters a website url(the knowledge base for the RAG) in a textfield and clicks a send button.
ballingt
ballingt4mo ago
Sounds like you want a public action like export const submitUrl = action(() => { ... }) that you call on button press. Or a public mutation like export const submitUrl = mutation(() => { ... }) that schedules the fetchAndEmbedSingle action to run. Have you tried the Tour of Convex ? It's very helpful for learning some of the basics like what queries, mutations, and actions are
Fredy D. | AmigoPago
Thx, I will take the tour

Did you find this page helpful?