-
-
Notifications
You must be signed in to change notification settings - Fork 97
Description
I'd be great to have a tool that'd generate UI components based on user requirements. This would achieve 3 things in one:
- People wouldn't have to wait for the UI component library that I want to build - they could simply generate the components that they need in the meantime.
- It would be a good way to onboard people, as they would see how their needs are converted to the component code.
- The LLM prompt would include a system prompt designed by us. This would give us a place to distill our know-how / best practices.
The LLM would be asked to output a component that has the HTML/JS/CSS inlined, so the result could be pasted directly into Python code.
There's 2 ways how this could be done:
- Asking users to provide their own API keys
- Using our own API keys.
I'd prefer to go with option 2. Because if someone's not familiar or doesn't have a set up account with one of the LLM providers, having to obtain the API key would be quite a drag.
But that means we'd pay it out of our pockets. So there should also be a spending limit. Supposedly, with gpt-3.5-turbo, the cost could be ~$0.001 per component generation. So with the limit of ~$20/mo, that should offer up to 20k components per month.
If we used our own API key, we'd also have to hide them. So we'd want to deploy some serverless/lambda function that would be given this API key, would monitor it's own usage (via OpenAI's API), and would generate the code or return error.
By having the LLM call as a serverless function, it should be also easy to integrate this feature into our documentation site. The docs site uses markdown, but it should also handle (and leave intact) any HTML inlined in the markdown. So it'd be simply a form that sends the contents to the serverless function, and then inserts the result as text.