Building a Digital Sommelier on Top of ChatGPT and the OpenAI API

When treated as a platform, LLMs such as ChatGPT become powerful building blocks for custom, conversational agents. In this talk, we use the OpenAI API and Vercel AI SDK to build a digital sommelier that recommends the perfect wine.

This talk has been presented at React Day Berlin 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

According to Jan, starting to build with the Bracel.ai SDK is really simple and can be initiated in less than five minutes.

Jan provided examples of wine pairings with foods such as fresh oysters on ice, roast duck with red wine sauce, and Mousse au chocolat during his presentation.

Developers play a crucial role in shaping how generative AI tools are integrated and utilized, by building and designing interfaces that facilitate user interactions with these technologies.

The server sends a streaming response, which is turned into a readable stream that displays on the client side, simulating the AI typing out the response.

Jan uses the Bracel.ai SDK, OpenAI API, Next.js, and ShadeCN to build the digital sommelier.

Jan mentioned the temporary ousting of Sam Altman as CEO of OpenAI and a strike by most of its employees, which raised concerns about the longevity of the API's availability.

While Jan's digital sommelier can suggest wine pairings effectively, he does not claim that it will completely replace traditional sommeliers anytime soon.

Jan recommends deploying AI projects on platforms like RSL or Netlify to test and see how they perform.

Jan's main purpose is to demonstrate how to build a digital AI-powered sommelier using the Bracel.ai SDK and OpenAI API, showcasing the ease of creating applications with generative AI.

Jan Demmerle
Jan Demmerle
8 min
07 Dec, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Today's Talk introduces the concept of building a digital AI-powered sommelier using the Bracel.ai SDK. The speaker emphasizes the role of developers in shaping the impact of AI, particularly generative AI, on our work. The Talk showcases a simple digital sommelier built using the Resell AI SDK and OpenAI API, highlighting the ease of implementation and the potential of open source tools. The speaker encourages users to explore the possibilities of generative AI responsibly and recommends checking out And Why, a design and technology studio from Munich.

1. Introduction to AI-powered Sommelier

Short description:

Today I want to show you how to build a digital AI-powered sommelier through Bracel.ai SDK. AI, especially generative AI, will have a profound effect on how we work. We as developers can shape that how. We are the ones building and designing the interfaces that facilitate between users and large language models. It's really simple to get started.

Yes, thank you so much for having me. My name is Jan. I'm a lead developer at EddDwye and today I want to show you how to build a digital AI-powered sommelier through Bracel.ai SDK. And initially it was planned that this talk is part of the Remote Day on Tuesday. So when I recorded the first version a couple of weeks back, I talked about the frantic pace at which things are changing in the AI space. And I guess the latest development really proved that point. And I thought, is my talk still relevant? Because a couple of weeks back, we received custom versions of JetGPT. Maybe you have tried it out. You can build your own versions of JetGPT for any kind of topic. And guess what? There are plenty of sommeliers among them and they are actually pretty good. So I thought, great. What does it mean for my talk? And then Sam Altman was ousted as CEO at OpenAI. Most of its employees went on strike and I thought, okay, how long will this API still be around? But since then things calmed down a bit. Altman is back as CEO at OpenAI. And yeah, I think when I thought about it, the underlying message of my talk is still true. That is that AI, especially generative AI, will have a profound effect on how we work. The good thing is, we as developers can shape that how. We are the ones building and designing the interfaces that facilitate between users and large language models. And that gives us a really good position in this transition to using generative AI tools. The best thing is, it's actually really simple to get started. It doesn't take more than five minutes. So let's pick a challenge and see how far we get.

2. Building a Simple Digital Sommelier

Short description:

We can build a simple digital sommelier using the Resell AI SDK and the OpenAI API. The UI consists of two columns: a menu for food and a wine list for pairing. The code is straightforward, utilizing the Resell AI SDK's chat hook and helper functions. The server-side code involves initiating a client for the OpenAI API and specifying the model (GPT 3.5 TORGO). After sending the dish data to the API, we receive a streaming response that is rendered on the screen using the chat hook. It's a great example of what can be achieved with open source tools.

So maybe you guessed it from the topic. I am really into wine and I like pairing food and wine, but there are literally millions of possibilities from various regions and countries, France, Spain, Italy, you name it. So finding the right pairing can be really challenging. But we can build a really simple, hopefully smart, digital sommelier that helps us with finding that perfect pairing.

So let's do that in the next five minutes with the Resell AI SDK and the OpenAI API. So we'll start with a really simple UI. I'm not lying if I tell you that this took the longest to put together. So we have two columns, there is a menu on the left, so the food, and there is a wine list on the right to pair with the food. And on the bottom, you have a small form, a text area where you can add new dishes to the menu.

If you look at the code, it's really simple. We make use of the use chat hook provided by the Resell AI SDK, and it gives us a set of helper functions to interact with large language models. So it does all the heavy lifting, there's not much we need to do here. And we have the form itself, which uses some of these helper functions to send the data off to an API road. That is also actually quite simple. On the server, we have three things, we initiate a client to interact with the OpenAI API, we specify the model. In this case, it's GPT 3.5 TORGO. We provide our OpenAI API key. Unfortunately, it's not free. And that's it.

We read the form data from the request, so the dish in this case we want to pair a wine with, and we send it off to the OpenAI API. What we get back is a streaming response, or a response that we turn into a readable screen that we send back to the client. And here, there's not a lot more to it. Again, we use chat hook to render this streaming response on the screen. And that gives us that nice effect that looks like the AI is actually typing the response. Probably if you use chat GPT, you've seen it before. And that's really all there is to it. Maybe a hundred lines of code. But I think it's a good showcase of what you can do really quickly with open source tools. But let's see if that actually works. So I prepared a little example.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
This Talk discusses building a voice-activated AI assistant using web APIs and JavaScript. It covers using the Web Speech API for speech recognition and the speech synthesis API for text to speech. The speaker demonstrates how to communicate with the Open AI API and handle the response. The Talk also explores enabling speech recognition and addressing the user. The speaker concludes by mentioning the possibility of creating a product out of the project and using Tauri for native desktop-like experiences.
AI and Web Development: Hype or Reality
JSNation 2023JSNation 2023
24 min
AI and Web Development: Hype or Reality
Top Content
This talk explores the use of AI in web development, including tools like GitHub Copilot and Fig for CLI commands. AI can generate boilerplate code, provide context-aware solutions, and generate dummy data. It can also assist with CSS selectors and regexes, and be integrated into applications. AI is used to enhance the podcast experience by transcribing episodes and providing JSON data. The talk also discusses formatting AI output, crafting requests, and analyzing embeddings for similarity.
The Rise of the AI Engineer
React Summit US 2023React Summit US 2023
30 min
The Rise of the AI Engineer
Watch video: The Rise of the AI Engineer
The rise of AI engineers is driven by the demand for AI and the emergence of ML research and engineering organizations. Start-ups are leveraging AI through APIs, resulting in a time-to-market advantage. The future of AI engineering holds promising results, with a focus on AI UX and the role of AI agents. Equity in AI and the central problems of AI engineering require collective efforts to address. The day-to-day life of an AI engineer involves working on products or infrastructure and dealing with specialties and tools specific to the field.
Web Apps of the Future With Web AI
JSNation 2024JSNation 2024
32 min
Web Apps of the Future With Web AI
Web AI in JavaScript allows for running machine learning models client-side in a web browser, offering advantages such as privacy, offline capabilities, low latency, and cost savings. Various AI models can be used for tasks like background blur, text toxicity detection, 3D data extraction, face mesh recognition, hand tracking, pose detection, and body segmentation. JavaScript libraries like MediaPipe LLM inference API and Visual Blocks facilitate the use of AI models. Web AI is in its early stages but has the potential to revolutionize web experiences and improve accessibility.
The Ai-Assisted Developer Workflow: Build Faster and Smarter Today
JSNation US 2024JSNation US 2024
31 min
The Ai-Assisted Developer Workflow: Build Faster and Smarter Today
AI is transforming software engineering by using agents to help with coding. Agents can autonomously complete tasks and make decisions based on data. Collaborative AI and automation are opening new possibilities in code generation. Bolt is a powerful tool for troubleshooting, bug fixing, and authentication. Code generation tools like Copilot and Cursor provide support for selecting models and codebase awareness. Cline is a useful extension for website inspection and testing. Guidelines for coding with agents include defining requirements, choosing the right model, and frequent testing. Clear and concise instructions are crucial in AI-generated code. Experienced engineers are still necessary in understanding architecture and problem-solving. Energy consumption insights and sustainability are discussed in the Talk.
Code coverage with AI
TestJS Summit 2023TestJS Summit 2023
8 min
Code coverage with AI
Codium is a generative AI assistant for software development that offers code explanation, test generation, and collaboration features. It can generate tests for a GraphQL API in VS Code, improve code coverage, and even document tests. Codium allows analyzing specific code lines, generating tests based on existing ones, and answering code-related questions. It can also provide suggestions for code improvement, help with code refactoring, and assist with writing commit messages.

Workshops on related topic

AI on Demand: Serverless AI
DevOps.js Conf 2024DevOps.js Conf 2024
163 min
AI on Demand: Serverless AI
Top Content
Featured WorkshopFree
Nathan Disidore
Nathan Disidore
In this workshop, we discuss the merits of serverless architecture and how it can be applied to the AI space. We'll explore options around building serverless RAG applications for a more lambda-esque approach to AI. Next, we'll get hands on and build a sample CRUD app that allows you to store information and query it using an LLM with Workers AI, Vectorize, D1, and Cloudflare Workers.
AI for React Developers
React Advanced 2024React Advanced 2024
142 min
AI for React Developers
Featured Workshop
Eve Porcello
Eve Porcello
Knowledge of AI tooling is critical for future-proofing the careers of React developers, and the Vercel suite of AI tools is an approachable on-ramp. In this course, we’ll take a closer look at the Vercel AI SDK and how this can help React developers build streaming interfaces with JavaScript and Next.js. We’ll also incorporate additional 3rd party APIs to build and deploy a music visualization app.
Topics:- Creating a React Project with Next.js- Choosing a LLM- Customizing Streaming Interfaces- Building Routes- Creating and Generating Components - Using Hooks (useChat, useCompletion, useActions, etc)
Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
JSNation 2024JSNation 2024
108 min
Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
Featured Workshop
Roy Derks
Shivay Lamba
2 authors
Today every developer is using LLMs in different forms and shapes, from ChatGPT to code assistants like GitHub CoPilot. Following this, lots of products have introduced embedded AI capabilities, and in this workshop we will make LLMs understandable for web developers. And we'll get into coding your own AI-driven application. No prior experience in working with LLMs or machine learning is needed. Instead, we'll use web technologies such as JavaScript, React which you already know and love while also learning about some new libraries like OpenAI, Transformers.js
Llms Workshop: What They Are and How to Leverage Them
React Summit 2024React Summit 2024
66 min
Llms Workshop: What They Are and How to Leverage Them
Featured Workshop
Nathan Marrs
Haris Rozajac
2 authors
Join Nathan in this hands-on session where you will first learn at a high level what large language models (LLMs) are and how they work. Then dive into an interactive coding exercise where you will implement LLM functionality into a basic example application. During this exercise you will get a feel for key skills for working with LLMs in your own applications such as prompt engineering and exposure to OpenAI's API.
After this session you will have insights around what LLMs are and how they can practically be used to improve your own applications.
Table of contents: - Interactive demo implementing basic LLM powered features in a demo app- Discuss how to decide where to leverage LLMs in a product- Lessons learned around integrating with OpenAI / overview of OpenAI API- Best practices for prompt engineering- Common challenges specific to React (state management :D / good UX practices)
Working With OpenAI and Prompt Engineering for React Developers
React Advanced 2023React Advanced 2023
98 min
Working With OpenAI and Prompt Engineering for React Developers
Top Content
Workshop
Richard Moss
Richard Moss
In this workshop we'll take a tour of applied AI from the perspective of front end developers, zooming in on the emerging best practices when it comes to working with LLMs to build great products. This workshop is based on learnings from working with the OpenAI API from its debut last November to build out a working MVP which became PowerModeAI (A customer facing ideation and slide creation tool).
In the workshop they'll be a mix of presentation and hands on exercises to cover topics including:
- GPT fundamentals- Pitfalls of LLMs- Prompt engineering best practices and techniques- Using the playground effectively- Installing and configuring the OpenAI SDK- Approaches to working with the API and prompt management- Implementing the API to build an AI powered customer facing application- Fine tuning and embeddings- Emerging best practice on LLMOps
Building AI Applications for the Web
React Day Berlin 2023React Day Berlin 2023
98 min
Building AI Applications for the Web
Workshop
Roy Derks
Roy Derks
Today every developer is using LLMs in different forms and shapes. Lots of products have introduced embedded AI capabilities, and in this workshop you’ll learn how to build your own AI application. No experience in building LLMs or machine learning is needed. Instead, we’ll use web technologies such as JavaScript, React and GraphQL which you already know and love.