Building Data-Driven Applications with LlamaIndex A Practical Guide to Retrieval-Augmented Generation (RAG) to Enhance LLM Applications
"Solve real-world problems easily with artificial intelligence (AI) using the LlamaIndex data framework to enhance your LLM-based Python applications Key Features Examine text chunking effects on RAG workflows and understand security in RAG app development Discover chatbots and agents and learn...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing Ltd
[2024]
|
Edición: | First edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009820417906719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Dedicated
- Contributors
- Table of Contents
- Preface
- Part 1: Introduction to Generative AI and LlamaIndex
- Chapter 1: Understanding Large Language Models
- Introducing GenAI and LLMs
- What is GenAI?
- What is an LLM?
- Understanding the role of LLMs in modern technology
- Exploring challenges with LLMs
- Augmenting LLMs with RAG
- Summary
- Chapter 2: LlamaIndex: The Hidden Jewel - An Introduction to the LlamaIndex Ecosystem
- Technical requirements
- Optimizing language models - the symbiosis of fine-tuning, RAG, and LlamaIndex
- Is RAG the only possible solution?
- What LlamaIndex does
- Discovering the advantages of progressively disclosing complexity
- An important aspect to consider
- Introducing PITS - our LlamaIndex hands-on project
- Here's how it will work
- Preparing our coding environment
- Installing Python
- Installing Git
- Installing LlamaIndex
- Signing up for an OpenAI API key
- Discovering Streamlit - the perfect tool for rapid building and deployment!
- Installing Streamlit
- Finishing up
- One final check
- Familiarizing ourselves with the structure of the LlamaIndex code repository
- Summary
- Part 2: Starting Your First LlamaIndex Project
- Chapter 3: Kickstarting your Journey with LlamaIndex
- Technical requirements
- Uncovering the essential building blocks of LlamaIndex - documents, nodes, and indexes
- Documents
- Nodes
- Manually creating the Node objects
- Automatically extracting Nodes from Documents using splitters
- Nodes don't like to be alone - they crave relationships
- Why are relationships important?
- Indexes
- Are we there yet?
- How does this actually work under the hood?
- A quick recap of the key concepts
- Building our first interactive, augmented LLM application.
- Using the logging features of LlamaIndex to understand the logic and debug our applications
- Customizing the LLM used by LlamaIndex
- Easy as 1-2-3
- The temperature parameter
- Understanding how Settings can be used for customization
- Starting our PITS project - hands-on exercise
- Let's have a look at the source code
- Summary
- Chapter 4: Ingesting Data into Our RAG Workflow
- Technical requirements
- Ingesting data via LlamaHub
- An overview of LlamaHub
- Using the LlamaHub data loaders to ingest content
- Ingesting data from a web page
- Ingesting data from a database
- Bulk-ingesting data from sources with multiple file formats
- Parsing the documents into nodes
- Understanding the simple text splitters
- Using more advanced node parsers
- Using relational parsers
- Confused about node parsers and text splitters?
- Understanding chunk_size and chunk_overlap
- Including relationships with include_prev_next_rel
- Practical ways of using these node creation models
- Working with metadata to improve the context
- SummaryExtractor
- QuestionsAnsweredExtractor
- TitleExtractor
- EntityExtractor
- KeywordExtractor
- PydanticProgramExtractor
- MarvinMetadataExtractor
- Defining your custom extractor
- Is having all that metadata always a good thing?
- Estimating the potential cost of using metadata extractors
- Follow these simple best practices to minimize your costs
- Estimate your maximal costs before running the actual extractors
- Preserving privacy with metadata extractors, and not only
- Scrubbing personal data and other sensitive information
- Using the ingestion pipeline to increase efficiency
- Handling documents that contain a mix of text and tabular data
- Hands-on - ingesting study materials into our PITS
- Summary
- Chapter 5: Indexing with LlamaIndex
- Technical requirements.
- Indexing data - a bird's-eye view
- Common features of all Index types
- Understanding the VectorStoreIndex
- A simple usage example for the VectorStoreIndex
- Understanding embeddings
- Understanding similarity search
- OK, but how does LlamaIndex generate these embeddings?
- How do I decide which embedding model I should use?
- Persisting and reusing Indexes
- Understanding the StorageContext
- The difference between vector stores and vector databases
- Exploring other index types in LlamaIndex
- The SummaryIndex
- The DocumentSummaryIndex
- The KeywordTableIndex
- The TreeIndex
- The KnowledgeGraphIndex
- Building Indexes on top of other Indexes with ComposableGraph
- How to use the ComposableGraph
- A more detailed description of this concept
- Estimating the potential cost of building and querying Indexes
- Indexing our PITS study materials - hands-on
- Summary
- Part 3: Retrieving and Working with Indexed Data
- Chapter 6: Querying Our Data, Part 1 - Context Retrieval
- Technical requirements
- Learning about query mechanics - an overview
- Understanding the basic retrievers
- The VectorStoreIndex retrievers
- The DocumentSummaryIndex retrievers
- The TreeIndex retrievers
- The KnowledgeGraphIndex retrievers
- Common characteristics shared by all retrievers
- Efficient use of retrieval mechanisms - asynchronous operation
- Building more advanced retrieval mechanisms
- The naive retrieval method
- Implementing metadata filters
- Using selectors for more advanced decision logic
- Understanding tools
- Transforming and rewriting queries
- Creating more specific sub-queries
- Understanding the concepts of dense and sparse retrieval
- Dense retrieval
- Sparse retrieval
- Implementing sparse retrieval in LlamaIndex
- Discovering other advanced retrieval methods
- Summary.
- Chapter 7: Querying Our Data, Part 2 - Postprocessing and Response Synthesis
- Technical requirements
- Re-ranking, transforming, and filtering nodes using postprocessors
- Exploring how postprocessors filter, transform, and re-rank nodes
- SimilarityPostprocessor
- KeywordNodePostprocessor
- PrevNextNodePostprocessor
- LongContextReorder
- PIINodePostprocessor and NERPIINodePostprocessor
- MetadataReplacementPostprocessor
- SentenceEmbeddingOptimizer
- Time-based postprocessors
- Re-ranking postprocessors
- Final thoughts about node postprocessors
- Understanding response synthesizers
- Implementing output parsing techniques
- Extracting structured outputs using output parsers
- Extracting structured outputs using Pydantic programs
- Building and using query engines
- Exploring different methods of building query engines
- Advanced uses of the QueryEngine interface
- Hands-on - building quizzes in PITS
- Summary
- Chapter 8: Building Chatbots and Agents with LlamaIndex
- Technical requirements
- Understanding chatbots and agents
- Discovering ChatEngine
- Understanding the different chat modes
- Implementing agentic strategies in our apps
- Building tools and ToolSpec classes for our agents
- Understanding reasoning loops
- OpenAIAgent
- ReActAgent
- How do we interact with agents?
- Enhancing our agents with the help of utility tools
- Using the LLMCompiler agent for more advanced scenarios
- Using the low-level Agent Protocol API
- Hands-on - implementing conversation tracking for PITS
- Summary
- Part 4: Customization, Prompt Engineering, and Final Words
- Chapter 9: Customizing and Deploying Our LlamaIndex Project
- Technical requirements
- Customizing our RAG components
- How LLaMA and LLaMA 2 changed the open source landscape
- Running a local LLM using LM Studio.
- Routing between LLMs using services such as Neutrino or OpenRouter
- What about customizing embedding models?
- Leveraging the Plug and Play convenience of using Llama Packs
- Using the Llama CLI
- Using advanced tracing and evaluation techniques
- Tracing our RAG workflows using Phoenix
- Evaluating our RAG system
- Introduction to deployment with Streamlit
- HANDS-ON - a step-by-step deployment guide
- Deploying our PITS project on Streamlit Community Cloud
- Summary
- Chapter 10: Prompt Engineering Guidelines and Best Practices
- Technical requirements
- Why prompts are your secret weapon
- Understanding how LlamaIndex uses prompts
- Customizing default prompts
- Using advanced prompting techniques in LlamaIndex
- The golden rules of prompt engineering
- Accuracy and clarity in expression
- Directiveness
- Context quality
- Context quantity
- Required output format
- Inference cost
- Overall system latency
- Choosing the right LLM for the task
- Common methods used for creating effective prompts
- Summary
- Chapter 11: Conclusion and Additional Resources
- Other projects and further learning
- The LlamaIndex examples collection
- Moving forward - Replit bounties
- The power of many - the LlamaIndex community
- Key takeaways, final words, and encouragement
- On the future of RAG in the larger context of generative AI
- A small philosophical nugget for you to consider
- Summary
- Index
- Other Books You May Enjoy.