Skip to product information
Developing a Practical LLM App Using OpenAI's Google Gemini Upstage Solar API
Developing a Practical LLM App Using OpenAI, Google Gemini, and Upstage Solar APIs
Description
Book Introduction
Learn how to develop optimal LLM API applications using generative AI technology!

This book introduces how to develop AI applications using the latest LLM APIs, including OpenAI, Google Gemini, and Upstage Solar. It guides you step-by-step, from API integration and prompt engineering to RAG implementation, application development using LangChain and Flowise, and practical web/desktop app development using Streamlit and Flet.
If you have basic programming knowledge, you can grow into an LLM professional developer through this book.
Instead of complex theories, you'll learn how to make the most of your LLM with practical examples.
  • You can preview some of the book's contents.
    Preview

index
▣ Chapter 1: LLM API Programming Overview

1.1 Learning LLM Basics in the Playground
1.2 How to write better instructions
1.3 API of OpenAI, the LLM powerhouse
1.4 Digging into the Google Gemini API
1.5 Korea's Leading LLM, Upstage Solar API
1.6 From the basics of the Langchain to building RAG
1.7 Developing LLM Web Applications with Streamlet
1.8 Multi-platform LLM Application Development
1.9 Summary

▣ Chapter 2: Learning LLM Basics in the OpenAI Playground

2.1 OpenAI Signup and Payment Settings
__Join OpenAI
__Register a payment card
__Purchase credits
2.2 Exploring the OpenAI Playground
Enter the __playground
__Completions
__Chat mode
__TTS
2.3 Comparison of Chat Mode and Complete Mode
__Single-turn and multi-turn dialogue
__Text Summary
__Code Completion
2.4 Learn by looking at various prompt examples
2.5 tokens
__Token concept and number of tokens
__Checking OpenAI's tokenization
2.6 Adjusting parameters
__Model
__Temperature
__Maximum Tokens
__Stop sequences
__Top P
__Frequency penalty and Presence penalty
2.7 Simple comparison of model performance
__Text Summary
__Q&A
__Physics Problem Solving
__College Scholastic Ability Test Korean Language Score
2.8 Creating an Assistant that Leverages Tools Without Coding
__Creating Your First Assistant - A Counseling Bot
__Creating an Assistant to Create PPT Documents with a Code Interpreter
Creating an assistant that answers questions by referencing "knowledge" from PDF files and other sources
2.9 Realtime
__Experience real-time conversation
__The potential of Realtime API
2.10 Generation Frequency Limit
2.11 Summary

▣ Chapter 3: Writing Better Prompts

3.1 Give specific instructions
3.2 Finding the correct expression
__An example of how behavior changes depending on word selection
__Example of specifying the tone of a sentence
3.3 Positive rather than negative sentences
3.4 Answering the question together
3.5 Zero-shot, one-shot, few-shot, many-shot learning
__Zero Shot
__One Shot
__Pewshot
__Manyshot
3.6 Dividing the execution steps
__Simple query
__prompt chain
3.7 CoT: Asking people to think things through
__Example: Finding the price of 12 apples
__Example: Representing a number as the product of two numbers
3.8 Specifying the output format
__Short answer subjective test questions with multiple answers
__Preferred format by LLM
__How to get structured output
3.9 Generating Programming SQL Statements with LLM
__SQL Overview
Natural language query transformation using __LLM
__Security and Performance Risks and Solutions
__Use Cases
3.10 Improving Object Recognition Accuracy in Multimodal Models
3.11 ReAct
__What is ReAct?
__How ReAct Works
__Benefits of ReAct
Limitations of __ReAct
__How to write a ReAct prompt
__Additional information
3.12 Augmented Search Creation
What is __RAG?
__RAG's Advantages
__Disadvantages and Limitations of RAG
__RAG Problem Solution
__RAG vs.
Big context
__organize
3.13 Threats and Security of Prompt Engineering
__Example of a threat
__Best Practices
3.14 Summary
3.15 Further Reading

▣ Chapter 4: OpenAI API Programming

4.1 Obtaining an OpenAI API Key
4.2 Keep your API key safe
__Registering an API key in Google Colab's secrets
__Registering API keys in computer environment variables
4.3 Trying the OpenAI API
4.4 Building a Conversation History
4.5 Structuring the Output of the OpenAI API
__Output Structuring Overview
__Comparing JSON Mode and Structured Outputs
__Practice structuring output using Pydantic
__Practice structuring output using JSON schema
4.6 Embedding using the OpenAI API
__What is embedding?
__Generating embeddings with the OpenAI API
__Cosine similarity
__Find words/sentences with similar meanings
4.7 Image Understanding Using Multimodal Models
__Describe an image on the web
__Describe local images
__Understand images containing text
4.8 Image Creation
__Basic example of image creation
__Create multiple images
4.9 Speech Synthesis
4.10 Voice Dictation with Whisper
__Select and install packages
__Dictation function definition
__Transcribe audio files
__Create YouTube video subtitles
__Explain context and create subtitles with prompts
__Create a transcript
4.11 Batch Processing Using the Batch API
__Sentiment Analysis and Naver Movie Review Dataset
__Different Approaches to Sentiment Analysis
__Single Sample Sentiment Analysis Test
__Sentiment Analysis Example Using the Batch API
__Results Analysis and Model Selection Guide
__Precautions when using the Batch API
4.12 Check for harmful text
__Categories of Moderation
__Moderation Practice
__Limitations of Korean Moderation
4.13 Assistant API
__Key components of the assistant
__Simple Assistant 'Easy Word Recommendation Bot v1'
__Function call function of Assistant API
'Easy Word Recommendation Bot v2' that utilizes the __ function
__Build an assistant that writes term descriptions using the Tabili Search API
__Things to consider when using the Assistant API
4.14 Fine Tuning
__Fine Tuning Overview and Pros and Cons
__Fine Tuning Practice Overview
__Preparing CSV/TSV data
__Data processing
__Upload data and run fine tuning
__test
4.15 OpenAI API Fees by Model
__GPT-4o
__GPT-4o mini
__o1 series
__GPT-4 Turbo and GPT-4
__GPT-3.5 Turbo
__Fine Tuning
__Audio Model
__Realtime API
4.16 Summary

▣ Chapter 5: Google Gemini API

5.1 Google Gemini API Overview
5.2 Gemini API Configuration
__Issue Google Gemini API Key
__Main models and free usage
__Setting Google Gemini AI environment variables and installing the SDK
5.3 Basic Use of Gemini AI
__Basic Usage 1 - Sending and Receiving Messages with Singleton
__Basic Usage 2 - Sending and Receiving Messages in Multiturn (1)
__Basic Usage 3 - Sending and Receiving Messages in Multiturn (2)
5.4 Using System Guidelines
__Creating a Persona
__Specify the answer format
5.5 Gemini AI I/O Architecture
__Gemini AI Input Data Structure
__Gemini AI Output Data Structure
5.6 Controlling Gemini AI
__Setting parameters
__Check safety
5.7 Recognizing YouTube Videos with the Gemini API
__YouTube video recognition pipeline
__Download YouTube videos
__Upload YouTube videos
5.8 Recognizing Voice Using the File API
__Voice recognition
5.9 Calling Functions with Gemini
__Function Call Basics
__LMM function call process
__Implementing function calls
__Implementing a smartphone ordering chatbot
__Implementing a two-step function call
5.10 Improving the Quality of Answers with Internet Search
__Using the grounding function
__Control Internet Search
5.11 OpenAI Compatibility
__How to call API without SDK
__Why OpenAI Compatibility Is Possible
__OpenAI Compatibility Application Strategy
5.12 Summary

▣ Chapter 6: Upstage API

6.1 Upstage API Overview
__Solar LLM-based API
__API for document processing
6.2 Experience the Upstage Model
__Upstage Playground
Chat at __Poe.com
Solar Custom Translate, where you can experience the solar translation model
6.3 Sign up for Upstage and get an API key
6.4 Implementing Chat with Solar LLM
__Check the example code in the official documentation
__Solar Chat API Practice
6.5 Using the Solr Translation API
__Basic usage of the Solar Translation API
__Input translation examples together
6.6 Solr Embedding API
__Simple embedding example
__Embedding function definition
__Find similar proverbs
6.7 Trying Document OCR
6.8 Crawling images on the web, extracting text, and answering questions
__Prepare API key
__Get image
__Extract text from images
__Q&A
6.9 Introducing Applications Using the Upstage API
6.10 Summary

▣ Chapter 7: Langchain and Flowy

7.1 Langchain Overview
__RangeChain Framework
__LangChain for Python and JavaScript
__Major changes by Langchain version
__LCEL
Criticism and Improvement of __Rangchain
__Langchain-based low-code/no-code tools
__Alternative to Langchain
7.2 Leveraging Langchain without Coding with Flowwise
__Installing Node.js
__Installing and running Flowwise
__Creating a Simple Chatbot
__Various nodes available in Flowwise
__Creating a Product Catalog Chatbot with Flowise
7.3 Components of the Langchain
__Model I/O
__search
__mixture
__Additional Components
7.4 Basic Langchain Practice
Simple Q&A and chat using the __Sola API
__Replace language model
__Prompt Template
7.5 LCEL
__LCEL Overview
__LCEL Practice
7.6 Agents using the Tabili search tool
7.7 Building a RAG System Using Gemini, Langchain, and ChromaDB
__Getting ready
__Creating a vector DB
__Creating a question-and-answer program based on a vector DB
7.8 Web Scraping and Summarization
__Configuring the Jupyter Practice Environment
__Python Practice
7.9 Creating a Custom Loader
Installing the __package
__Set the API key to an environment variable
__Loader class definition
__Load Wikidocs book contents
__Index creation and query answering
7.10 Building a Multilingual Review Sentiment Analysis System Using Runnable
Introducing the __Runnable concept
__Practice Code Overview
__Language detection settings
__Preparing to build a multilingual review sentiment analysis system
__Implementation of translation function
__Sentiment analysis and keypoint extraction settings
Defining a __Runnable component
__Configure the entire workflow
__System execution and result analysis
7.11 Creating a Lyric Generator Web App with Langservo
__Write code
__Running and testing the web server
__Automatic generation of API documentation
__API call
__Practice Ended
7.12 Langsmith
__Langsmith's main features
__Get an API key
__Code Practice
7.13 Summary

▣ Chapter 8: Building AI Web Applications with Streamlet

8.1 Streamlet Basics
__Creating Your First Streamlet App
__Running and quitting the Streamlet app
__Basic structure of a Streamlet app
__Creating a data converter for fine-tuning
__Build a Streamlet app that calculates BMI and draws a chart
__Storing confidential information safely
8.2 Creating a Streamlet App to Create Test Questions
8.3 Creating a Streamlet App to Classify and Visualize Product Reviews
8.4 Creating a Streamlit Chatbot Using the Gemini API
__Caching and Session State
__Message Container
__Step-by-step implementation of the Gemini chatbot
__Improving the response method
8.5 Creating a Streamlet App that Describes Images
8.6 Creating a Streamlet App that Generates Images with DALL·E 3
8.7 Creating a Streamlet app that extracts subtitles from YouTube videos and generates content
__Preparing for the practice
__Function to get YouTube video title and description
__Function to extract keywords from video descriptions
__Function to download the audio of a video
__Function to extract text from speech
__Content Type
__Create summaries, essays, blogs, and critiques
__Transcript/Subtitle Translation
__execution
8.8 Creating a Streamlet App that Extracts and Summarizes Text from Images
8.9 Creating a Streamlet App to Analyze Receipt Images
Step 1: Upload the receipt image and display it on the screen.
Step 2: Extract receipt information and display it on the screen.
Step 3: Complete by adding automatic expense classification function.
8.10 Building a Sentence Corrector Using a Fine-Tuned Model
__Sentence Corrector Overview
__AsyncOpenAI Introduction
__Implementing a sentence corrector
__Running and using the app
__Additional examples
8.11 Building a Chatbot Using Streamlet and Langchain
8.12 Summary

▣ Chapter 9: Building a Multilingual Chat App Using the Flet Framework and LLM API

9.1 Introduction to the Flet Framework
9.2 Configuring the environment for Flet development
__Activate the virtual environment
__Flet installation
9.3 Creating Your First Flet App
Create a __Flet project
__Code Description
__Run the Flet app
9.4 Creating a Basic Chat App
__Understanding the basic structure of a chat app
__Creating a basic Flet chat app
__Enter username when entering
__Login and chat message distinction
__Change how messages are displayed
9.5 Added and completed multilingual chat translation feature
__Create app
__Code Description
__Run the app

▣ Appendix A: Comparison of Token Usage by Model

A.1 OpenAI model
__GPT-3.5 Turbo, GPT-4 Turbo, GPT-4
__GPT-4o, GPT-4o mini
A.2 Gemini Pro
A.3 Solar
A.4 Comparison

▣ Appendix B: Using Vertex Geminai on Google Cloud

B.1 Logical Path to Vertex Gemini
B.2 Getting Started with Vertex AI on Google Cloud Platform
__Sign up for Google Cloud Platform
__Create a service account
__Enabling the Vertex AI API
__Vertex Gemini API is working properly

▣ Appendix C: Using the OpenAI API in .NET

C.1 Prepare your OpenAI API key
C.2 Installing Visual Studio
C.3 Creating a New Project
C.4 Installing the OpenAI Package
C.5 Writing Example Code
C.6 Code Execution

▣ Appendix D: OpenAI Realtime API Practice

D.1 Installing Node.js
D.2 Download the example source code
__Method 1: Download and unzip the compressed file
__Second method: Clone the Git repository
D.3 Prepare your OpenAI API key
D.4 Running the Example Code
__Running relay server
__Run real-time console
__Real-time console testing

▣ Appendix E: Guardrails for LLM Application Stability

E.1 The concept and necessity of guardrails
__Types of guardrails
__Difference between cases with and without guardrails
E.2 Getting Started with Guardrails AI
__Sign up and get an API key
__Installation and Basic Setup
__Guardrails Hub
__Detecting phone numbers using RegexMath
__Detecting and masking personally identifiable information using Dectec PII
Validate SQL statements with __Valid SQL
Masking personally identifiable information with a custom detector
E.3 Conclusion
E.4 References

Detailed image
Detailed Image 1

Publisher's Review
★ What this book covers ★

◎ How to integrate and use LLM API


- Introduce the features and usage methods of major LLM APIs such as OpenAI, Google Gemini, and Upstage Solr, and acquire the basic knowledge required to utilize LLM APIs, such as issuing API keys, calling APIs, and processing responses.

◎ Learn the basics of LLM through the OpenAI Playground

- Learn the basics of using LLM, including prompt writing, tokenization, and parameter tuning, in the OpenAI Playground, and compare and analyze the performance of various LLM models.

◎ Core principles and techniques of prompt engineering

- Introduces the core principles of prompt engineering that maximize the performance of LLM, and learns effective prompt design methods through various prompt writing techniques and practical application cases.

How to Use the OpenAI, Google Gemini, and Upstage Solar APIs

- Learn in detail the features and usage of each LLM API, and practice how to utilize the LLM API for various tasks such as text generation, image captioning, translation, and chatbots.

◎ Building a knowledge-based AI system using augmented search generation (RAG).

- Introduces the Augmented Search Generation (RAG) technique and practices building an LLM application that leverages external knowledge using RankChain.

◎ LLM application development using Langchain and Flowwise

- Learn the main features and usage of the LangChain framework, and learn how to develop LLM applications without coding using Flowwise.

◎ Various AI web applications implemented with Streamlet

- Introduces how to develop various LLM-based web applications using Streamlet, and learns the skills required for actual web app development, such as data visualization, user interface design, and API integration.

◎ Real-time multilingual chat app created with Flet

- Implement a real-time multilingual chat app using the Flet framework and add an automatic translation function using the OpenAI API to enable real-time communication in a multilingual environment.
GOODS SPECIFICS
- Date of issue: January 15, 2025
- Page count, weight, size: 632 pages | 175*235*26mm
- ISBN13: 9791158395667

You may also like

카테고리