Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 1, LLMs and Prompts)

LlamaIndex · Intermediate ·🧠 Large Language Models ·2y ago

Key Takeaways

The video series covers Bottoms-Up development with LlamaIndex, focusing on LLMs and Prompts, demonstrating how to test and debug each component using low-level APIs and customization options.

Full Transcript

hey guys welcome back Logan here from love index today we're starting a new video series Bottoms Up development with llama index now what do I mean by Bottoms Up development well within Luma index there are a ton of components and any number of these you're probably going to need to customize when you're building you know your own query pipeline for your own application and so this video series is going to kind of cover these low-level components how you can customize them and how you can kind of stitch them all together into your own query pipeline so in order to kind of demonstrate this we have a project that we're going to kind of cover across multiple videos we're going to be building a sort of query engine or query pipeline across the long index documentation and through this process we're going to go through a ton of like really low level components lom's documents and nodes retrievers and show you how to customize these and how you can kind of stitch them all together and as well as how you can test and debug each component and so starting off first we're going to cover llms so right now in lab index we have a ton of moms that were recently introduced we have open AI hugging face any LM from Lang chain is supported uh Azure was just added it's actually not even on this list uh and you know custom llms and each of these have really low level basic methods uh complete for basic text completion uh chat for like chat response to like a list of Nest chat messages as well as streaming for each of those and then as well as there's async versions of all of these and so using these at this low level is super simple as we can see in this example down here you can instantiate your LOM super easily and really quickly you know ask it tell you a joke it'll give you a response you can look at the response text or you can actually look at the raw Json that came from that LOM response in addition to that there's also the kind of chat methods so in this case now the input instead of a string is going to be a list of messages and so this in this simple example here we have a system message asking it to talk like a pirate and then the same thing again the user is asking to tell me a joke and here uh chat ubt does its best to tell a pirate joke I guess not quite following instructions but you know close enough and that's basically it to these LOM components they're super simple to set up and use and it's a really good way to start testing these llms for your application you know we can prompt it with specific things that we're going to ask it later using you know documents that it's going to read later and really get a feel for you know is this llm going to work for my use case or do I need to do prompt engineering or find a different LOM and so in order to kind of walk through this a bit more I'm going to go through a notebook here that actually you know demonstrates this so like I mentioned before we're going to try and build a kind of query engine over the Llama index documentation it's going to be highly customized and basically touch like everything that can be customized but starting with llms um you can set your API keys right now I've just cut copied the documentation from llama index so I'm going to read a quick markdown file it's the starter example gonna instantiate our llm just like we saw before here I've copied the kind of internal prompt templates from llama index the two main ones that get used the most are the text QA template and the refine template the main difference between these two is that the refine template takes an existing answer and tries to refine it so either updated or repeat it after reading some new context and this basically only gets used when the text retrieved for a query doesn't fit into a single LOM call so we need to refine it and so these are the two prompts that I want to test right now I'm going to set those up and from there we could basically just start testing so using the starter example I'm going to ask you know how can I install llama index to install on the index you can follow the okay yeah that good answer uh next we're going to ask it how to create an index this one's gonna be a bit more complicated I think there's a few more steps to how to do that yep so it gave us a response here a pretty detailed it looks pretty good but actually I don't need all this information I just want it with code so let's see if we can get it to write just answering using code in this case I'm also going to use the stream complete method so this is going to return a generator and for every response in this generator we're going to print the Delta which is just you know the new change that has come in from the LOM or the new text so it's going to stream that really fast and that example looks perfect so obviously this is working pretty well with this template and with this content that we've loaded uh and we know this because we're testing this low-level Lon API that's the refine template here as well um here I give it one of the answers it gave before as an existing answer and I'm going to say no I want this to write your answer using only code so let's see if you know the LM can handle this refined template now I gave it encode not entirely all in code but this does actually look really correct and this is a it's a good answer nice in addition to this there are also the chat endpoints which as I mentioned before need a list of chat messages this is useful if you maybe want to you know give it a system prompt in this case we're giving it a system prompt telling it that it's a QA bot answer questions about Lum index so if we ask it how to create an index again we should get something uh pretty helpful I would say and again a long detailed response uh which is fine by me so yeah that's basically it uh in this video we kind of covered how to use these logo element low level LOM apis uh and how to kind of quickly get started with testing inputs and outputs using your own data and this is super helpful because if you know if you have a super specific use case you want to make sure that the llm you're using can handle you know the use case that you have intended for it in this case it looks pretty good so in the next video we're going to move on to testing uh document loading and how we can construct documents and nodes from the Lum index documentation so see you in the next video thanks

Original Description

In part 1 of this series, we start by diving into LLMs and Prompts, exploring different types and their basic methods. We'll also demonstrate how to test and debug each component. No action required from you, just sit back and learn! Our brand-new Bottoms Up Development series is designed to help you understand the low-level building blocks of LLM application development. It's important to play around with the basic concepts before composing more complex LLM software systems - our end goal is to help you learn all the fundamental concepts to build a chatbot over our documentation. Follow along on our Github repo: https://github.com/run-llama/llama_docs_bot
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LlamaIndex · LlamaIndex · 13 of 60

1 LlamaIndex Virtual Meetup (May 4th, 2023)
LlamaIndex Virtual Meetup (May 4th, 2023)
LlamaIndex
2 LlamaIndex + MongoDB Workshop/Fireside Chat
LlamaIndex + MongoDB Workshop/Fireside Chat
LlamaIndex
3 Discover LlamaIndex: Ask Complex Queries over Multiple Documents
Discover LlamaIndex: Ask Complex Queries over Multiple Documents
LlamaIndex
4 Discover LlamaIndex: Document Management
Discover LlamaIndex: Document Management
LlamaIndex
5 Discover LlamaIndex: Joint Text to SQL and Semantic Search
Discover LlamaIndex: Joint Text to SQL and Semantic Search
LlamaIndex
6 Discover LlamaIndex: JSON Query Engine
Discover LlamaIndex: JSON Query Engine
LlamaIndex
7 LlamaIndex Webinar: Active Retrieval Augmented Generation
LlamaIndex Webinar: Active Retrieval Augmented Generation
LlamaIndex
8 LlamaIndex Webinar: Demonstrate-Search-Predict (DSP) with Omar Khattab
LlamaIndex Webinar: Demonstrate-Search-Predict (DSP) with Omar Khattab
LlamaIndex
9 LlamaIndex Sessions: Practical challenges of building a Legal Chatbot over your PDFs
LlamaIndex Sessions: Practical challenges of building a Legal Chatbot over your PDFs
LlamaIndex
10 LlamaIndex Webinar: Graph Databases, Knowledge Graphs, and RAG with Wey (NebulaGraph)
LlamaIndex Webinar: Graph Databases, Knowledge Graphs, and RAG with Wey (NebulaGraph)
LlamaIndex
11 LlamaIndex Webinar: Community Project Showcase (07/07/2023)
LlamaIndex Webinar: Community Project Showcase (07/07/2023)
LlamaIndex
12 LlamaIndex Webinar: LLMs for Investment Research (with Didier Lopes, co-founder/CEO at OpenBB)
LlamaIndex Webinar: LLMs for Investment Research (with Didier Lopes, co-founder/CEO at OpenBB)
LlamaIndex
Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 1, LLMs and Prompts)
Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 1, LLMs and Prompts)
LlamaIndex
14 Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 2, Documents and Metadata)
Discover LlamaIndex: Bottoms-Up Development With LLMs (Part 2, Documents and Metadata)
LlamaIndex
15 Discover LlamaIndex: Key Components to build QA Systems
Discover LlamaIndex: Key Components to build QA Systems
LlamaIndex
16 Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 3, Evaluation)
Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 3, Evaluation)
LlamaIndex
17 LlamaIndex Webinar: From Prompt to Schema Engineering with Pydantic  (with @jxnlco)
LlamaIndex Webinar: From Prompt to Schema Engineering with Pydantic (with @jxnlco)
LlamaIndex
18 Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 4, Embeddings)
Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 4, Embeddings)
LlamaIndex
19 Discover LlamaIndex: Custom Retrievers + Hybrid Search
Discover LlamaIndex: Custom Retrievers + Hybrid Search
LlamaIndex
20 LlamaIndex Webinar: Document Metadata and Local Models for Better, Faster Retrieval
LlamaIndex Webinar: Document Metadata and Local Models for Better, Faster Retrieval
LlamaIndex
21 LlamaIndex Webinar: Build Personalized AI Characters with RealChar
LlamaIndex Webinar: Build Personalized AI Characters with RealChar
LlamaIndex
22 LlamaIndex Webinar: Make RAG Production-Ready
LlamaIndex Webinar: Make RAG Production-Ready
LlamaIndex
23 LlamaIndex Workshop: Building RAG with Knowledge Graphs
LlamaIndex Workshop: Building RAG with Knowledge Graphs
LlamaIndex
24 Discover LlamaIndex: Introduction to Data Agents for Developers
Discover LlamaIndex: Introduction to Data Agents for Developers
LlamaIndex
25 LlamaIndex Webinar: Finetuning + RAG
LlamaIndex Webinar: Finetuning + RAG
LlamaIndex
26 Discover LlamaIndex: SEC Insights, End-to-End Guide
Discover LlamaIndex: SEC Insights, End-to-End Guide
LlamaIndex
27 Discover LlamaIndex: Custom Tools for Data Agents
Discover LlamaIndex: Custom Tools for Data Agents
LlamaIndex
28 LlamaIndex Sessions: Building a Lending Criteria Chatbot in Production
LlamaIndex Sessions: Building a Lending Criteria Chatbot in Production
LlamaIndex
29 Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 5, Retrievers + Node Postprocessors)
Discover LlamaIndex: Bottoms-Up Development with LLMs (Part 5, Retrievers + Node Postprocessors)
LlamaIndex
30 LlamaIndex Webinar: How to Win a LLM Hackathon
LlamaIndex Webinar: How to Win a LLM Hackathon
LlamaIndex
31 LlamaIndex Webinar: LLM Challenges in Production (w/ Mayo Oshin, AI Jason, Dylan from Starmorph)
LlamaIndex Webinar: LLM Challenges in Production (w/ Mayo Oshin, AI Jason, Dylan from Starmorph)
LlamaIndex
32 LlamaIndex Webinar: Agents Showcase!
LlamaIndex Webinar: Agents Showcase!
LlamaIndex
33 LlamaIndex Webinar: Learn about DSPy
LlamaIndex Webinar: Learn about DSPy
LlamaIndex
34 LlamaIndex Webinar: Time-based retrieval for RAG (with Timescale)
LlamaIndex Webinar: Time-based retrieval for RAG (with Timescale)
LlamaIndex
35 LlamaIndex Webinar: Build/Break/Test LLM Apps Showcase (co-hosted with TrueEra, Pinecone)
LlamaIndex Webinar: Build/Break/Test LLM Apps Showcase (co-hosted with TrueEra, Pinecone)
LlamaIndex
36 LlamaIndex Workshop: Evaluation-Driven Development (EDD)
LlamaIndex Workshop: Evaluation-Driven Development (EDD)
LlamaIndex
37 LlamaIndex Webinar: Building LLM Apps for Production, Part 1 (co-hosted with Anyscale)
LlamaIndex Webinar: Building LLM Apps for Production, Part 1 (co-hosted with Anyscale)
LlamaIndex
38 LlamaIndex Webinar: Learn about Fine-tuning + RAG (w/ Victoria Lin, author of RA-DIT)
LlamaIndex Webinar: Learn about Fine-tuning + RAG (w/ Victoria Lin, author of RA-DIT)
LlamaIndex
39 LlamaIndex Webinar: What's next for AI after OpenAI Dev Day?
LlamaIndex Webinar: What's next for AI after OpenAI Dev Day?
LlamaIndex
40 Introducing create-llama
Introducing create-llama
LlamaIndex
41 LlamaIndex Webinar: PrivateGPT - Production RAG with Local Models
LlamaIndex Webinar: PrivateGPT - Production RAG with Local Models
LlamaIndex
42 Multi-modal Retrieval Augmented Generation with LlamaIndex
Multi-modal Retrieval Augmented Generation with LlamaIndex
LlamaIndex
43 LlamaIndex Webinar: LLaVa Deep Dive
LlamaIndex Webinar: LLaVa Deep Dive
LlamaIndex
44 A deep dive into Retrieval-Augmented Generation with Llamaindex
A deep dive into Retrieval-Augmented Generation with Llamaindex
LlamaIndex
45 LlamaIndex Workshop: Multimodal + Advanced RAG Workhop with Gemini
LlamaIndex Workshop: Multimodal + Advanced RAG Workhop with Gemini
LlamaIndex
46 LlamaIndex Webinar: Efficient Parallel Function Calling Agents with LLMCompiler
LlamaIndex Webinar: Efficient Parallel Function Calling Agents with LLMCompiler
LlamaIndex
47 Introduction to Query Pipelines (Building Advanced RAG, Part 1)
Introduction to Query Pipelines (Building Advanced RAG, Part 1)
LlamaIndex
48 LLMs for Advanced Question-Answering over Tabular/CSV/SQL Data (Building Advanced RAG, Part 2)
LLMs for Advanced Question-Answering over Tabular/CSV/SQL Data (Building Advanced RAG, Part 2)
LlamaIndex
49 LlamaIndex Webinar: Advanced Tabular Data Understanding with LLMs
LlamaIndex Webinar: Advanced Tabular Data Understanding with LLMs
LlamaIndex
50 Ollama X LlamaIndex Multi-Modal
Ollama X LlamaIndex Multi-Modal
LlamaIndex
51 Build Agents from Scratch (Building Advanced RAG, Part 3)
Build Agents from Scratch (Building Advanced RAG, Part 3)
LlamaIndex
52 LlamaIndex Webinar: Build No-Code RAG with Flowise
LlamaIndex Webinar: Build No-Code RAG with Flowise
LlamaIndex
53 LlamaIndex Sessions: Practical Tips and Tricks for Productionizing RAG (feat. Sisil @ Jasper)
LlamaIndex Sessions: Practical Tips and Tricks for Productionizing RAG (feat. Sisil @ Jasper)
LlamaIndex
54 Introduction to LlamaIndex v0.10
Introduction to LlamaIndex v0.10
LlamaIndex
55 Build SELF-DISCOVER from Scratch with LlamaIndex
Build SELF-DISCOVER from Scratch with LlamaIndex
LlamaIndex
56 Introducing LlamaCloud (and LlamaParse)
Introducing LlamaCloud (and LlamaParse)
LlamaIndex
57 LlamaIndex Sessions: 12 RAG Pain Points and Solutions
LlamaIndex Sessions: 12 RAG Pain Points and Solutions
LlamaIndex
58 LlamaIndex Webinar: RAG Beyond Basic Chatbots
LlamaIndex Webinar: RAG Beyond Basic Chatbots
LlamaIndex
59 A Comprehensive Cookbook for Claude 3
A Comprehensive Cookbook for Claude 3
LlamaIndex
60 LlamaIndex Webinar: RAPTOR - Tree-Structured Indexing and Retrieval
LlamaIndex Webinar: RAPTOR - Tree-Structured Indexing and Retrieval
LlamaIndex

This video series teaches how to develop and customize LLMs using LlamaIndex, covering low-level APIs, prompt engineering, and query pipeline construction. The first part focuses on LLMs and Prompts, demonstrating how to test and debug each component.

Key Takeaways
  1. Instantiate an LLM using LlamaIndex
  2. Test the LLM with basic methods (text completion, chat response, streaming)
  3. Customize the LLM with prompt templates (text QA, refine)
  4. Test the LLM with custom prompts and data
💡 Using low-level LLM APIs and customization options allows for effective testing and debugging of LLMs, ensuring they meet specific use case requirements.

Related Reads

📰
30 Prompt Techniques I Actually Use With Claude (Not a Copy-Paste Listicle)
Learn 30 prompt techniques to effectively use with LLMs like Claude, improving your productivity and results
Medium · LLM
📰
The 7 Vector Database Decisions Nobody Explains (Using Pinecone)
Learn the 7 key vector database decisions for effective RAG implementation using Pinecone, beyond just creating embeddings
Medium · LLM
📰
Your AI Is Showing — Post 9
Learn about the weaknesses of vector and embedding in LLMs, particularly in RAG systems, and how updates to the knowledge base can impact performance
Medium · Machine Learning
📰
Leveraging LLMs for Language Learning: A Comprehensive Guide
Learn to build a conversational language tutor using LLMs to correct grammar and track vocabulary in real-time, with a comprehensive guide and adaptable code for any target language
Dev.to AI
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →