<img decoding="async" alt="4 steps to become a generative ai developer” width=”100%” src=”https://technicalterrence.com/wp-content/uploads/2024/01/4-steps-to-become-a-generative-AI-developer.png”/><img decoding="async" src="https://technicalterrence.com/wp-content/uploads/2024/01/4-steps-to-become-a-generative-AI-developer.png" alt="4 steps to become a generative ai developer” width=”100%”/>
Sam Altman, CEO of OpenAI, presents product usage figures at the OpenAI Developer Day in October 2023. OpenAI considers three customer segments: developers, enterprises, and general users. link: https://www.youtube.com/watch?v=U9mJuUkhUzk&t=120s
At the OpenAI Developer Day in October 2023, Sam Altman, CEO of OpenAI, showed a slide on the use of the product in three different customer segments: developers, enterprises and general users.
In this article, we will focus on the developer segment. We'll cover what a generative ai developer does, what tools you need to master for this job, and how to get started.
While some companies are dedicated to making generative ai products, most generative ai developers are based in other companies where this has not been the traditional approach.
The reason for this is that generative ai has uses that apply to a wide range of businesses. Four common uses of generative ai apply to most businesses.
Chatbots
<img decoding="async" alt="4 steps to become a generative ai developer” width=”100%” src=”https://technicalterrence.com/wp-content/uploads/2024/01/1705187995_922_4-steps-to-become-a-generative-AI-developer.png”/><img decoding="async" src="https://technicalterrence.com/wp-content/uploads/2024/01/1705187995_922_4-steps-to-become-a-generative-AI-developer.png" alt="4 steps to become a generative ai developer” width=”100%”/>
Image generated by DALL·E 3
While chatbots have been common for over a decade, most of them have been horrible. Typically, the most common first interaction with a chatbot is to ask if it can talk to a human.
Advances in generative ai, particularly large language models and vector databases, mean that is no longer true. Now that chatbots can be enjoyable for customers to use, every business is busy (or at least should be busy) scrambling to update them.
Article ai-on-chatbots/” rel=”noopener” target=”_blank”>Impact of generative ai on chatbots from MIT technology Review has a good overview of how the world of chatbots is changing.
semantic search
Search is used in a wide variety of places, from documents to shopping websites to the Internet itself. Traditionally, search engines are keyword-intensive, which creates the problem that the search engine needs to be programmed to recognize synonyms.
For example, consider trying to search a marketing report to find the part about customer segmentation. You press CMD+F, type “targeting,” and it cycles through until you find something. Unfortunately, cases where the author of the document wrote “classification” instead of “segmentation” are missed.
Semantic search (searching in meaning) solves this synonym problem by automatically finding text with similar meanings. The idea is to use an embedding model (a deep learning model that converts text into a numerical vector based on its meaning) and then finding related text is just simple linear algebra. Even better, many embedding models allow other data types such as images, audio, and video as inputs, allowing you to provide different types of input data or types of output data for your search.
As with chatbots, many companies are trying to improve the search capabilities of their websites by using semantic search.
This tutorial on Semantic Search from Zillus, the maker of the Milvus vector database, provides a good overview of the use cases.
Custom content
<img decoding="async" alt="4 steps to become a generative ai developer” width=”100%” src=”https://technicalterrence.com/wp-content/uploads/2024/01/1705187995_2_4-steps-to-become-a-generative-AI-developer.png”/><img decoding="async" src="https://technicalterrence.com/wp-content/uploads/2024/01/1705187995_2_4-steps-to-become-a-generative-AI-developer.png" alt="4 steps to become a generative ai developer” width=”100%”/>
Image generated by DALL·E 3
Generative ai makes content creation cheaper. This makes it possible to create personalized content for different user groups. Some common examples are changing marketing copy or product descriptions based on what you know about the user. You can also provide localizations to make content more relevant to different countries or demographic groups.
This article about ai-platforms/” rel=”noopener” target=”_blank”>How to achieve hyper-personalization using generative ai platforms by Salesforce Chief Digital Evangelist Vala Afshar covers the benefits and challenges of using generative ai to personalize content.
Natural language interfaces for software.
As software becomes more complicated and feature-rich, the user interface becomes filled with menus, buttons, and tools that users can't find or know how to use. Natural language interfaces, where users want to explain what they want in one sentence, can dramatically improve the usability of software. “Natural language interface” can refer to spoken or written ways of controlling the software. The key is that you can use standard phrases that are understandable to humans.
Business intelligence platforms are some of the first to adopt this, with natural language interfaces that help business analysts write less data manipulation code. However, the applications for this are quite limitless: almost any feature-rich program could benefit from a natural language interface.
This Forbes article on ai-and-natural-language-interfaces/?sh=61379ae63798″ rel=”noopener” target=”_blank”>Embracing ai and natural language interfaces by Gaurav Tewari, founder and managing partner of Omega Venture Partners, has an easy-to-read description of why natural language interfaces can help software usability.
First of all, you need a generative ai model! For working with text, this means a large language model. GPT 4.0 is the current gold standard for performance, but there are many open source alternatives such as Llama 2, Falcon, and Mistral.
Second, you need a vector database. Pinecone is the most popular commercial vector database and there are some open source alternatives such as Milvus, Weaviate and Chroma.
In terms of programming language, the community seems to have settled around Python and JavaScript. JavaScript is important for web applications and Python is suitable for everyone else.
In addition to this, it is useful to use a generative ai application framework. The two main contenders are LangChain and LlamaIndex. LangChain is a broader framework that allows you to develop a wide range of generative ai applications, and LlamaIndex is more narrowly focused on developing semantic search applications.
If you are building a search application, use LlamaIndex; otherwise use LangChain.
It is worth noting that the landscape is changing very quickly and many new ai companies appear every week, along with new tools. If you want to develop an application, expect to change parts of the software stack more frequently than with other applications.
In particular, new models appear regularly and the one with the best performance for your use case is likely to change. A common workflow is to start using APIs (for example, the OpenAI API for the API and the Pinecone API for the vector database), as they develop quickly. As your user base grows, the cost of API calls can become onerous, so at this point you may want to switch to open source tools (the Hugging Face ecosystem is a good option here).
As with any new project, start simple! It's best to learn one tool at a time and then figure out how to combine them.
The first step is to set up accounts for any tools you want to use. You will need developer accounts and API keys to use the platforms.
A Beginner's Guide to the OpenAI API: Practical Tutorial and Best Practices contains step-by-step instructions on how to set up an OpenAI developer account and create an API key.
In addition, Tutorial to master vector databases with Pinecone: a complete guide contains the details to configure Pinecone.
What is face hugging? The open source oasis of the ai community explains how to get started with Hugging Face.
LLM Learning
To get started using LLM like GPT programmatically, the simplest thing is to learn how to call the API to send a message and receive a message.
While many tasks can be accomplished through a single exchange with the LLM, use cases like chatbots require a lengthy conversation. OpenAI recently announced a “threading” feature as part of its Wizards API, which you can learn more about in the ai-assistants-api-tutorial” rel=”noopener” target=”_blank”>OpenAI Wizard API Tutorial.
This is not supported by all LLMs, so you may also need to learn how to manually manage conversation status. For example, you must decide which of the previous messages in the conversation are still relevant to the current conversation.
Beyond this, there is no need to stop when only working with text. You can try working with other media; for example, transcribing audio (speech to text) or generating images from text.
Learn vector databases
The simplest use case for vector databases is semantic search. An embedding model is used here (see ai-api” rel=”noopener” target=”_blank”>Introduction to text embeddings with the OpenAI API) that converts text (or other input) into a numerical vector that represents its meaning.
It then inserts its embedded data (the numerical vectors) into the vector database. Searching simply means typing a search query and asking which database entries most closely match what you requested.
For example, you could take some frequently asked questions about one of your company's products, embed them, and load them into a vector database. It then asks a question about the product and will return the closest matches, converting a numeric vector back to the original text.
Combining LLM and vector databases
You may find that directly returning text input from the vector database is not enough. Often you want the text to be processed in a way that answers the query more naturally.
The solution to this is a technique known as recovery augmented generation (RAG). This means that after retrieving your text from the vector database, you write a message to an LLM and then include the retrieved text in your message (you increase the message with recovered text). Then, you ask the LLM to write a human-readable response.
In the example of answering user questions in the FAQ, you would write a message with placeholders, like the following.
"""
Please answer the user's question about {product}.
---
The user's question is : {query}
---
The answer can be found in the following text: {retrieved_faq}
"""
The last step is to combine your RAG skills with the ability to manage message threads to maintain a longer conversation. Voila! You have a chatbot!
DataCamp has ai-code-alongs” rel=”noopener” target=”_blank”>a series of nine codes to teach you how to become a generative ai developer. You need basic knowledge of Python to get started, but all ai concepts are taught from scratch.
The series is taught by top instructors from Microsoft, Pinecone, Imperial College London and Fidelity (and me!).
You'll learn about all the topics covered in this article, with six codes focused on the OpenAI API, Pinecone API, and LangChain business stack. The other three tutorials focus on the Hugging Face models.
By the end of the series, you will be able to create a chatbot and create NLP and computer vision applications.
rich cotton is a data evangelist at DataCamp. He is the host of the DataFramed podcast, has written two books on R programming, and has created 10 DataCamp courses on data science that have been taken by over 700,000 students.