跳转到内容

构建一个LLM应用

欢迎来到《理解LlamaIndex》系列。这是一系列简短易学的教程,涵盖构建智能体LLM应用的每个阶段,帮助您在深入学习更高级和精妙策略之前,熟悉如何使用LlamaIndex。如果您是经验丰富的程序员但刚接触LlamaIndex,这里是最佳起点。

本教程包含三个主要部分:构建RAG管道构建智能体构建工作流,前后还包含一些较小的章节。以下是内容概览:

  • 使用大型语言模型: hit the ground running by getting started working with LLMs. We’ll show you how to use any of our dozens of supported LLMs, whether via remote API calls or running locally on your machine.

  • 构建智能体: agents are LLM-powered knowledge workers that can interact with the world via a set of tools. Those tools can retrieve information (such as RAG, see below) or take action. This tutorial includes:

    • 构建单个智能体: We show you how to build a simple agent that can interact with the world via a set of tools.

    • 使用现有工具: LlamaIndex provides a registry of pre-built agent tools at LlamaHub that you can incorporate into your agents.

    • 维护状态: agents can maintain state, which is important for building more complex applications.

    • 流式输出与事件: providing visibility and feedback to the user is important, and streaming allows you to do that.

    • 人在回路: getting human feedback to your agent can be critical.

    • 使用AgentWorkflow的多智能体系统: combining multiple agents to collaborate is a powerful technique for building more complex systems; this section shows you how to do so.

  • 工作流: Workflows are a lower-level, event-driven abstraction for building agentic applications. They’re the base layer you should be using to build any advanced agentic application. You can use the pre-built abstractions you learned above, or build agents completely from scratch. This tutorial covers:

    • 构建一个简单的工作流: a simple workflow that shows you how to use the Workflow class to build a basic agentic application.

    • 循环与分支: these core control flow patterns are the building blocks of more complex workflows.

    • 并发执行: you can run steps in parallel to split up work efficiently.

    • 流式事件: your agents can emit user-facing events just like the agents you built above.

    • 有状态工作流: workflows can maintain state, which is important for building more complex applications.

    • 可观测性: workflows can be traced and debugged using various integrations like Arize Pheonix, OpenTelemetry, and more.

  • 为你的智能体添加RAG功能: Retrieval-Augmented Generation (RAG) is a key technique for getting your data to an LLM, and a component of more sophisticated agentic systems. We’ll show you how to enhance your agents with a full-featured RAG pipeline that can answer questions about your data. This includes:

    • 加载与数据摄取: Getting your data from wherever it lives, whether that’s unstructured text, PDFs, databases, or APIs to other applications. LlamaIndex has hundreds of connectors to every data source over at LlamaHub.

    • 索引与嵌入: Once you’ve got your data there are an infinite number of ways to structure access to that data to ensure your applications is always working with the most relevant data. LlamaIndex has a huge number of these strategies built-in and can help you select the best ones.

    • 存储: You will probably find it more efficient to store your data in indexed form, or pre-processed summaries provided by an LLM, often in a specialized database known as a Vector Store (see below). You can also store your indexes, metadata and more.

    • 查询: Every indexing strategy has a corresponding querying strategy and there are lots of ways to improve the relevance, speed and accuracy of what you retrieve and what the LLM does with it before returning it to you, including turning it into structured responses such as an API.

  • 整合所有内容: whether you are building question & answering, chatbots, an API, or an autonomous agent, we show you how to get your application into production.

  • 追踪与调试: also called observability, it’s especially important with LLM applications to be able to look into the inner workings of what’s going on to help you debug problems and spot places to improve.

  • 评估中: every strategy has pros and cons and a key part of building, shipping and evolving your application is evaluating whether your change has improved your application in terms of accuracy, performance, clarity, cost and more. Reliably evaluating your changes is a crucial part of LLM application development.

准备好深入了解了吗?前往使用LLMs