Hacker News new | past | comments | ask | show | jobs | submit login

I am confused about the demo. Is the AI generating the `Weather` component that is used to render the response, or is it just returning the weather in a structure that the `Weather` component expects?

The example code is confusing me, because there is a `render()` method that references both `<Weather>` and `<Spinner>`, but neither of these JSX components are imported into the script. (In fact, `getWeather()` isn't defined, either.) Is that the part I'm missing? The LLM will just see these component references and know how to render them? Or is the codeblock wrong? Because this is technically invalid syntax (reference to undefined).




The AI is calling a function (https://platform.openai.com/docs/guides/function-calling) that is mapped to developer-controlled logic. The easiest thing to do is render specific UIs for every function call, but you can render however you'd like.

We kept the code snippets in the blog post brief, but you can see the full code for the demo here: https://github.com/vercel/ai/tree/main/examples/next-ai-rsc




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: