UNPKG

@hashbrownai/openai

Version:
60 lines (40 loc) 1.84 kB
<h1 align="center">Hashbrown - Build Generative User Interfaces</h1> <p align="center"> <img src="https://hashbrown.dev/image/logo/brand-mark.svg" alt="Hashbrown Logo" width="144px" height="136px"/> <br> <em>Hashbrown is an open-source framework for building user interfaces <br />that converse with users, dynamically reorganize, and even code themselves.</em> <br> </p> <p align="center"> <a href="https://hashbrown.dev/"><strong>hashbrown.dev</strong></a> <br> </p> ## Getting Started ```sh npm install @hashbrownai/openai --save ``` Deploy an express server with a single /chat endpoint to use Hashbrown with OpenAI. ```ts import { HashbrownOpenAI } from '@hashbrownai/openai'; app.post('/chat', async (req, res) => { const stream = HashbrownOpenAI.stream.text({ apiKey: process.env.OPENAI_API_KEY!, request: req.body, // must be Chat.Api.CompletionCreateParams }); res.header('Content-Type', 'application/octet-stream'); for await (const chunk of stream) { res.write(chunk); // Pipe each encoded frame as it arrives } res.end(); }); ``` ## Docs [Read the docs for the Hashbrown OpenAI adapter](https://hashbrown.dev/docs/react/platform/openai). ## Contributing hashbrown is a community-driven project. Read our [contributing guidelines](https://github.com/liveloveapp/hashbrown?tab=contributing-ov-file) on how to get involved. ## Workshops and Consulting Want to learn how to build web apps with AI? [Learn more about our workshops](https://hashbrown.dev/workshops). LiveLoveApp provides hands-on engagement with our AI engineers for architecture reviews, custom integrations, proof-of-concept builds, performance tuning, and expert guidance on best practices. [Learn more about LiveLoveApp](https://liveloveapp.com). ## License MIT © [LiveLoveApp, LLC](https://liveloveapp.com)