Generative AI on Google Cloud with Langchain
Reseña del Libro — Por David Regalado
Hola, ¡bienvenido de nuevo! Hoy vamos a profundizar en un tema que ha estado en la mente de casi todos últimamente: la IA generativa. Pero no solo la teoría, estamos hablando de crear aplicaciones reales y prácticas. Y para ayudarnos a lograrlo, he estado leyendo un nuevo libro llamado “IA generativa en Google Cloud con LangChain”.
Sí, es un montón por digerir, ¡lo sé! Pero créeme, este libro está repleto de información que es realmente muy útil si estás tratando de navegar en este espacio de rápida evolución.
Ahora bien, he estado jugando con GenAI por un tiempo, ya sabes, las cosas habituales: jugar con demos, experimentar con prompts, ese tipo de cosas. Pero, ¿construir algo realmente, algo robusto y escalable? Eso es otro level. Y ahí es donde entra este libro.
Lo que realmente me gusta del libro es que no es solo un montón de conceptos abstractos. Está escrito por tres tipos que realmente trabajan en Google y que contribuyeron a LangChain:
Ellos han visto de primera mano lo que funciona y lo que no al crear aplicaciones de nivel empresarial, por lo que desde el inicio sabes que estás obteniendo información realmente práctica.
Entonces, el libro se centra básicamente en el uso de LangChain, que es un marco increíble, para conectar modelos de lenguaje grandes (LLM) a datos externos y otros servicios. Te explican cómo usar las herramientas de Google Cloud, como Gemini y Vertex AI.
Abordan temas como la generación de texto, los resúmenes, las respuestas a preguntas e incluso cosas como Retrieval-Augmented Generation o RAG. También tocan temas como los flujos de trabajo de agentes, que es algo bastante interesante. ¿Y la mejor parte? Obtienes ejemplos prácticos con los que trabajar a lo largo del camino.
Realmente aprecié que se tomaran el tiempo para explicar las cosas con claridad, incluso para alguien que no es un experto total. Si tienes algunos conocimientos básicos de Python y machine learning, podrás seguir y realmente crear estas aplicaciones. Los autores no solo te arrojan código; te explican por qué están usando un enfoque específico, lo que considero muy importante para el aprendizaje.
El libro trata una variedad de temas realmente útiles, por ejemplo, cómo trabajar con contextos extensos y crear chatbots, que son muy relevantes para muchos casos de uso. También se tratan herramientas y llamadas a funciones, que son clave para crear aplicaciones más complejas e interactivas. También hay una sección completa sobre cómo evaluar las aplicaciones GenAI, para que sepas si lo que estás creando funciona bien o no.
No se trata sólo de hacer que las cosas funcionen, sino de que funcionen bien.
Definitivamente me ayudó a entender todo el proceso de diseño de los sistemas GenAI y también enfatiza la importancia de aspectos como la ética en la inteligencia artificial. No se trata solo del aspecto técnico, sino de utilizar estas tecnologías de manera responsable.
Entonces, ¿para quién creo que es este libro?
Si eres un desarrollador de aplicaciones o un ingeniero de ML que busca adentrarse en el lado práctico de la IA generativa, este es definitivamente un libro para ti. Ya sea que seas nuevo en LangChain o Google Cloud, este libro hace un muy buen trabajo al guiarte a través de los pasos. Además, si eres un profesional que quiere explorar los productos GenAI de nivel empresarial de Google Cloud, ¡definitivamente debes revisar este libro!
En general, “Generative AI on Google Cloud with LangChain” es un gran recurso. No es solo otro libro teórico sobre GenAI, realmente es una guía práctica para cualquiera que busque crear aplicaciones reales y escalables.
Si tienes dificultades para descubrir cómo conectar el poder de los LLM con tu caso de negocio específico o estás intentando descubrir cómo construir un chatbot personalizado, ¡quizás quieras agregar esto a tu lista de lectura!
Tabla de Contenidos
Parte 1: Intro to LangChain and Generative Al on
Google Cloud
Capítulo 1: Using LangChain with Google Cloud
- Technical requirements
- LangChain
- LangChain primitives — chains and runnables
- LCEL
- RunnablePass Through and itemgetter - Main LangChain building blocks
- Data structures
- Interfaces - Lang Chain with Google Cloud
- LangChain integration with Google
- Summary
- References
Capítulo 2: Foundational Models on Google Cloud
- Technical requirements
- What is Vertex AI?
- Google Cloud console
- Using LangChain - Prompt templates
- Using chat models
- Using callbacks
- Other models besides Gemini
- Vertex Al Model Garden
- Open-source models
- Partner models - Prompt engineering for foundational models
- Summary
- References
Parte 2: Hallucinations and Grounding Responses
Capítulo 3: Grounding Responses
- Technical requirements
- Building a custom RAG application
- Overcoming hallucinations in LIMs
- Understanding RAG applications — closed-book versus open-book question-answering
- Vertex Al Agent Builder
- Creating a data store and indexing documents
- Querying Vertex Al Agent Builder
- Using Vertex Al Agent Builder - Building a custom RAG application
- Customizing the RAG application further
- Query expansion
- Filtering documents
- Further methods - Summary
- References
Capítulo 4: Vector Search on Google Cloud
- Technical requirements
- What is vector search?
- Overview of vector search architecture - LangChain interfaces — embeddings and vector stores
- Embeddings
- Vector stores - Vector store with Vertex Al Vector Search
- Creating the required infrastructure
- LangChain integration - Vectorstore with pgvector on Cloud SQL
- Creating a CloudSQL instance and database
- Enabling the pgVector extension
- LangChain integration - Vectorstore with BigQuery
- Creating a BigQuery dataset, table, and vector index
- LangChain integration - Summary
- References
Capítulo 5: Advanced Techniques for Parsing and Ingesting Documents
- Technical requirements
- Ingesting documents with LangChain
- Plain text documents
- CSV documents
- PDF documents
- GoogleDriveLoader
- Additional types
- Loading directories
- Integrating with Google Cloud Storage - Document chunking
- RecursiveCharacter TextSplitter
- Other Text Splitters
- Applying text splitters - Parsing documents with Document Al
- LangChain usage - Ingesting data with Vertex Al Agent Builder
- Website data
- Unstructured Data
- Structured data
- Parsing
- Chunking - Summary
- Links
Capítulo 6: Multimodality
- Technical requirements
- Multimodality with Gemini and LangChain
- Using Imagen with LangChain
- Developing multimodal RAGs
- Extracting images from PDF documents Multimodal context
- Parsing an image - Summary
- References
Parte 3: Common Generative Al Architectures
Capítulo 7: Working with Long Context
- Technical requirements
- What is summarization?
- Summarizing documents
- Summarizing text
- Using loaders
- MapReduce pattern
- Summarizing other modalities - Answering questions on long documents
- Summary
- References
Capítulo 8: Building Chatbots
- Technical requirements
- Introduction to conversational design
- Intent identification
- Conversation flow design
- Entity extraction
- Conversational design workflow - Building chatbots with LangChain
- Building a basic chatbot with LangChain messages
- Adding memory to your chatbot
- Handling memory using Runnables
- Automatically handling memory with LangGraph
- Optimizing your RAG for memory
- Caching memory in context - Detecting intents and routing messages
- Custom routing functions
- Semantic routing - Summary
- References
Capítulo 9: Tools and Function Calling
- Technical requirements
- Advanced prompt design
- Naive controlled generation
- Chain-of-Thought (CoT) - Enhancing LLMs capabilities with tools
- Constructing tools - ReACT pattern
- Using ToolConfig - Tools provided by Google
- Using Google Search
- Search grounding with Gemini - Summary
- References
Capítulo 10: Agents in Generative Al
- Technical requirements
- What is an agent?
- Components of an agent
- How agents work - Agents in LangChain
- Tools
- Model
- Prompt template
- Agent creation
- Agent usage
- Deploying with Reasoning Engine - Vertex Al Agent Builder
- Summary
Capítulo 11: Agentic Workflows
- Technical requirements
- Workflow state management
- Controlled generation
- Agentic RAG
- NL2SQL
- Summary
Parte 4: Designing Generative Al Applications
Capítulo 12: Evaluating GenAl Applications
- Technical requirements
- Evaluating GenAl applications
- LangSmith
- LangChain Hub for prompt management
- Datasets and benchmarks - Pointwise evaluations
- Comparison on benchmarks
- Evaluation metrics
- LangChain interfaces
- LangChain pointwise evaluators
- Vertex evaluators on LangChain - Pairwise evaluations
- Vertex pairwise evaluators - Summary
- References
Capítulo 13: GenAl System Design
- Architecture design framework
- The business process, or defining your use case
- Architecture capabilities
- Technical design
- Document ingestion and storage
- Context retrieval
- Model interaction
- User-facing components - Enterprise readiness and compliance
- RAI
- Summary
- References
Apéndice
Apéndice 1
Overview of Generative Al
- Exploring LLMs
- LLMs can solve tasks described as natural language
- How can LLMs solve almost any task?
- What is alignment, and how does it enhance LLM capabilities?
- Tuning LLMs - Are LIMs as smart as humans?
- Is it just hype or something big?
- Secrets of successful adoption
- Summary
- References
Apéndice 2
Google Cloud Foundations
- Setting up your organization
- Adding users and groups
- Next steps
- Assigning users to groups - Managing administrative users
- Understanding IAM roles
- Granting roles to groups
- Reviewing and customizing default roles
- The importance of regular review
- Additional tips - Setting up billing in Google Cloud
- Billing account types
- Associating a billing account - Centralizing logging in Google Cloud
- Setting up centralized logging - Securing your Google Cloud environment
- Enabling APis and setting up quotas
- Applying organization policies - Setting up your Google Cloud network infrastructure
- Creating your initial network configuration
- Additional tips - Enabling your Google Cloud environment for Al/machine learning experiments
- Deploying LangChain applications with Google Cloud Run
- Summary
- References
¡Échale un Vistazo!
Definitivamente aprendí mucho y creo que cualquiera que se tome en serio GenAI debería al menos echarle un vistazo.
Eso es todo por hoy. Cuéntame en los comentarios qué te pareció. ¿Estás trabajando con GenAI? ¿Cuál ha sido tu mayor obstáculo? Y como siempre, no olvides seguirme, compartir, etc.
¡Hasta el próximo artículo!
Bonus
Hice un video hablando sobre este libro. ¡Dale una mirada también!
Gracias por Leer. ¿Qué tal más Artículos?
¿Qué? ¿Querías Más?
Dale 50 veces al botón 👏 y comenta si quisieras más reseñas de libros.
- Sígue a para más contenido educativo.