Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Generative AI Application Integration Patterns
Generative AI Application Integration Patterns

Generative AI Application Integration Patterns: Integrate large language models into your applications

Arrow left icon
Profile Icon Juan Pablo Bustos Profile Icon Luis Lopez Soria
Arrow right icon
€25.99 €37.99
Paperback Sep 2024 218 pages 1st Edition
eBook
€20.98 €29.99
Paperback
€25.99 €37.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Juan Pablo Bustos Profile Icon Luis Lopez Soria
Arrow right icon
€25.99 €37.99
Paperback Sep 2024 218 pages 1st Edition
eBook
€20.98 €29.99
Paperback
€25.99 €37.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€25.99 €37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Generative AI Application Integration Patterns

Identifying Generative AI Use Cases

In the previous chapter, we discussed how the use case exploration and proof of concept development process has shifted with the emergence of large language models (LLMs). Specifically, the ability for rapid experimentation with LLMs has led teams to favor an experimental approach over more traditional requirements analysis and design processes.

With LLMs, use cases can quickly be tested by creating prompts that demonstrate potential capabilities. This allows for greater flexibility and speed than meticulously mapping detailed requirements upfront. Of course, once promising use cases are identified, more rigorous analysis is highly recommended. Additionally, security, monitoring, and governance of production systems remain critical components.

In this chapter, we will discuss an approach to identify promising use cases to explore with LLMs. We categorize use cases based on how an application interacts with the LLM. This provides a framework...

When to consider generative AI

As we have been exploring, one of the powers of GenAI is the ability to automatically generate responses without being explicitly trained on it. Rather than just executing predefined tasks, LLMs can infer responses by drawing on their contextual understanding and knowledge. This aspect of emergent reasoning unlocks unique opportunities for rapid experimentation and iterative refinement of novel use cases.

When considering potential applications for GenAI, the first evaluation criterion centers on comprehension-based tasks. Sentiment analysis, content classification, intent classification, relationship extraction, summarization, and more all leverage innate language understanding. Developers can formulate prompts aligning to use cases that interpret, organize, or infer meaning. To unlock the full potential of LLMs, developers will iterate on these given prompts through thoughtful “prompt engineering.” Prompt engineering attempts to optimize...

Realizing business value

When assessing opportunities to solve business problems with GenAI, it’s critical that we analyze potential value in business terms – how does this technology shift affect structures, efficiency, competitive positioning, or revenue opportunities in an organization? Merely showcasing sophisticated technical capabilities alone is not enough to show value, as it lacks strategic rigor. Proposed projects should directly address tangible problems or sources of organizational leverage.

As thought leaders seeking executive buy-in, we need to develop skills and methodologies that translate potential productivity gains into compelling business cases, clarifying the return on investment. Specifically, constructing cost avoidance models resonates with executives focused on operational efficiencies and margins.

Quantifying assumptions in terms that the business can understand and measure is an essential step to a successful integration of GenAI into...

Identifying Generative AI use cases

As we evaluate potential applications for GenAI, two overarching categories emerge – comprehension applications and generative applications. By distinguishing use cases along this spectrum of understanding existing data vs synthesizing new artifacts, we can better match capabilities to appropriate business challenges:

  • Comprehension applications cover processing tasks applied to analyze and structure knowledge from existing content. This includes sentiment analysis, relationship extraction, intent classification, summarization, and more. The key focus areas center around interpreting, organizing, and tagging data to be used by subsequent systems.

Sources like chat history, customer tickets, and product catalogs yield richer insights when machine learning models classify topics, normalize entities, and summarize concepts at scale.

  • Generative applications move beyond pure comprehension applications to creatively...

Potential business-focused use cases

When exploring opportunities to apply GenAI, continuously evaluate any potential business value first rather than just the technical art of the possible. To spark ideas, the following list summarizes promising use cases organized by key value drivers. Consider cases where replicating human-quality comprehension or creation at a machine scale has a positive impact on workflows.

Cost and efficiency gains:

  • Automate high-volume/repetitive tasks. Here, your business key performance indicator (KPI) can be an automation rate, measured as a percentage of automated tasks.
  • Accelerate content development, enabling hybrid human/AI collaboration. Here, your business KPI can be an increase in the number of hours saved compared to the current amount of time taken to create content.
  • Content evaluation to reduce errors and rework. Here, your business KPI can be the delta in the number of tickets filed to update incorrect content.
  • ...

Generative AI deployment and hosting options

As we consider which types of use cases we are looking to pursue to provide business value, we must consider the infrastructure on which we will deploy and host our systems. With the new normal of leveraging cloud resources, we tend to assume that capacity is not a concern anymore, but is this right? Let’s dissect this thought – is the biggest model the right solution for all use cases? Realistically speaking, LLMs are nice and easy to test and get initial results, but when considering scale and productionalization, they are not as appealing as you would think. Some of the limitations are GPU availability, cost, and latency. This realization is steering the market into more specialized smaller models that solve a specific use case.

Designing product architecture for LLMs requires careful consideration of several factors. Cost optimization strategies like Mixture-of-Depths can be employed to dynamically allocate resources...

Summary

This chapter explored the intricacies of evaluating potential use cases for GenAI, equipping you with the tools to discern optimal applications for this transformative technology. By examining different viewpoints and criteria, we’ve established a framework to determine whether a given use case aligns with GenAI’s strengths and limitations.

The key takeaways are as follows:

  • At the heart of every successful GenAI implementation lies clear and demonstrable business value. Ask yourself how GenAI will directly enhance your current operations, unlock new revenue streams, or improve customer experience. Without a tangible benefit, the technology itself holds little merit.
  • We identified two broad categories of use cases where GenAI shines: comprehension and generation. Comprehension focuses on analyzing and extracting meaning from data, while generation leverages that understanding to produce entirely new content. Consider which category your use...
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Get familiar with the most important tools and concepts used in real scenarios to design GenAI apps
  • Interact with GenAI models to tailor model behavior to minimize hallucinations
  • Get acquainted with a variety of strategies and an easy to follow 4 step frameworks for integrating GenAI into applications

Description

Explore the transformative potential of GenAI in the application development lifecycle. Through concrete examples, you will go through the process of ideation and integration, understanding the tradeoffs and the decision points when integrating GenAI. With recent advances in models like Google Gemini, Anthropic Claude, DALL-E and GPT-4o, this timely resource will help you harness these technologies through proven design patterns. We then delve into the practical applications of GenAI, identifying common use cases and applying design patterns to address real-world challenges. From summarization and metadata extraction to intent classification and question answering, each chapter offers practical examples and blueprints for leveraging GenAI across diverse domains and tasks. You will learn how to fine-tune models for specific applications, progressing from basic prompting to sophisticated strategies such as retrieval augmented generation (RAG) and chain of thought. Additionally, we provide end-to-end guidance on operationalizing models, including data prep, training, deployment, and monitoring. We also focus on responsible and ethical development techniques for transparency, auditing, and governance as crucial design patterns.

Who is this book for?

This book is not an introduction to AI/ML or Python. It offers practical guides for designing, building, and deploying GenAI applications in production. While all readers are welcome, those who benefit most include: Developer engineers with foundational tech knowledge Software architects seeking best practices and design patterns Professionals using ML for data science, research, etc., who want a deeper understanding of Generative AI Technical product managers with a software development background This concise focus ensures practical, actionable insights for experienced professionals

What you will learn

  • Concepts of GenAI: pre-training, fine-tuning, prompt engineering, and RAG
  • Framework for integrating AI: entry points, prompt pre-processing, inference, post-processing, and presentation
  • Patterns for batch and real-time integration
  • Code samples for metadata extraction, summarization, intent classification, question-answering with RAG, and more
  • Ethical use: bias mitigation, data privacy, and monitoring
  • Deployment and hosting options for GenAI models
Estimated delivery fee Deliver to Romania

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 05, 2024
Length: 218 pages
Edition : 1st
Language : English
ISBN-13 : 9781835887608
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Estimated delivery fee Deliver to Romania

Premium delivery 7 - 10 business days

€25.95
(Includes tracking information)

Product Details

Publication date : Sep 05, 2024
Length: 218 pages
Edition : 1st
Language : English
ISBN-13 : 9781835887608
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 73.97 107.97 34.00 saved
Generative AI Application Integration Patterns
€25.99 €37.99
Python Natural Language Processing Cookbook
€22.99 €33.99
AI-Assisted Programming for Web and Machine Learning
€24.99 €35.99
Total 73.97 107.97 34.00 saved Stars icon

Table of Contents

12 Chapters
Introduction to Generative AI Patterns Chevron down icon Chevron up icon
Identifying Generative AI Use Cases Chevron down icon Chevron up icon
Designing Patterns for Interacting with Generative AI Chevron down icon Chevron up icon
Generative AI Batch and Real-Time Integration Patterns Chevron down icon Chevron up icon
Integration Pattern: Batch Metadata Extraction Chevron down icon Chevron up icon
Integration Pattern: Batch Summarization Chevron down icon Chevron up icon
Integration Pattern: Real-Time Intent Classification Chevron down icon Chevron up icon
Integration Pattern: Real-Time Retrieval Augmented Generation Chevron down icon Chevron up icon
Operationalizing Generative AI Integration Patterns Chevron down icon Chevron up icon
Embedding Responsible AI into Your GenAI Applications Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela