Next Generation Apps: Enhancing User Experience with LLMs.pdf

nithishrw 70 views 29 slides Oct 18, 2024
Slide 1
Slide 1 of 29
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29

About This Presentation

This talk was delivered at PyCon Portugal 2024 (https://2024.pycon.pt/home/).

Large Language Models(LLMs) are good at reasoning based on their knowledge. This talk explores how you can use the power of LLMs to add intelligence like coding assistants, text-to-sequel, etc to existing applications.

...


Slide Content

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved.
Next Generation Apps:
Enhancing UX with LLMs
Nithish Raghunandanan
Developer Advocate
PyCon Portugal 2024

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 2
About Me
●Background in Data/ML Engineering
●Developer Advocate @ Couchbase
●Building Integrations with Developer Ecosystem
●Live in Munich, Germany
●Love Olympic Sports


@nithishr

3
Agend
a
●Motivation
●Guiding LLMs: Prompt
Engineering
●RAG: Grounding LLMs
●Dynamic Agents
●Conclusion

4
Motivation

5
What are Large Language Models?
●Models trained on huge corpus of data
●Extremely good at working with text
●Examples: GPT4, Llama3, Claude, Gemini, etc

6
LLMs are Powerful for certain use cases
●Chatbots
●Summarizing content
●Classifying content
●Language Translation
●Image Generation

7
LLMs are Powerful for certain use cases

8
And they have their Pitfalls

9
Guiding LLMs:
Prompt Engineering

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 10
Guiding the LLM to solve tasks

●Specific instructions
●Output structuring
●Zero Shot vs Few Shot Prompting
●Review of Prompting Techniques:
https://arxiv.org/pdf/2406.06608
Prompt Engineering

11
Demo
Prompt Engineering

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 12
Limitations
●Knowledge limitations: Hallucinations
●Prone to hijacks
Recommendations
●Provide context
●Concise prompts


Prompt Engineering

13
RAG: Grounding
LLMs with Vector
Search

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 14
What is Retrieval-Augmented Generation (RAG)?
Supplying an existing LLM with relevant context
Question
Retriever
(Database)
Knowledge
external to the
LLM
LLM
(GPT, Llama3,
Gemini, etc)
Answer
Retrieval
(your enterprise, data, application)
Generation
(3
rd
party LLM)
Augmentation

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 15
RAG Workflow

16
Demo
Basic RAG Example

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 17
●Ingestion of Documents
○Chunk Data
○Embedding Data using Embedding Models
●Retrieval of Documents
○Vector Search
○Reranker
●Generation of Answers
○Use the ranked documents as Context
Components of a RAG

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 18
●Support Follow up questions
●Get Source documents
●Observability
●Code:
https://github.com/couchbase-examples/
qa-bot-demo
Chat with Docs using RAG

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 19
RAG
Limitations
●Passive: Only retrieve data
Recommendations
●Measure the performance of RAGs
○Human evaluations
○LLM based evaluations (Ragas)

20
Dynamic Agents
powered by LLMs

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 21
●LLMs can interact with the environment
●LLMs augmented with Tools
●ReAct (Reason + Act) Agents
○Reason about the task
○Act based on Reasoning
○Call tools as needed
Agent

22
Demo
SQL++ Generator

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 23
●Generate SQL++ queries for Couchbase from
natural language

Text to SQL++ Generation

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 24
Limitations
●Complex workflows might be hard
●Might need human intervention
Recommendations
●Combine Agents with RAGs
●Check combination of Prompts & LLMs


Agents

25
Conclusion

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2024. All rights reserved. 26
●LLMs can be used to improve UX for end users.
●Privacy Considerations
●Rapidly advancing field & models.


Key Takeaways

Confidential and Proprietary. Do not distribute without Couchbase consent. © Couchbase 2023. All rights reserved. 27
●Q&A Chatbot
○https://github.com/couchbase-examples/qa-bot-demo
●Chat with PDF
○Python: https://github.com/couchbase-examples/rag-demo
○Node.JS: https://github.com/couchbase-examples/vector-search-nodejs
●SQL++ Agent
○https://github.com/nithishr/sql_plus_plus_agent
Resources
Check out demos

28
Thank you!
[email protected]
https://linkedin.com/in/nithishr
@nithishr
Use
Capella
for Free!

29
Q&A