18.7K Star!快速构建多模态智能体的轻量级框架,运行速度比LangGraph快5000倍!

Agno 是一个用于构建多模态智能体的轻量级框架。

  1. 核心功能:支持文本、图像、音频和视频等多种数据模态,创建智能体的速度比传统框架快 5000 倍。

  2. 技术原理:基于 Python 实现,无依赖性设计,支持与向量数据库集成,实现高效的检索增强生成(RAG)或动态少样本学习。

一、Agno 是什么

在这里插入图片描述

Agno 是一个用于构建多模态智能体的轻量级框架。它支持多种数据模态(如文本、图像、音频和视频),并且可以快速创建智能体。Agno 提供了内存管理和知识库支持,能够将用户会话和智能体状态存储在数据库中,基于向量数据库实现动态少样本学习。此外,Agno 支持多智能体协作,帮助用户实时跟踪智能体会话和性能。

Agno 的设计目标是简化开发流程,提升性能,并确保灵活性。通过无依赖性架构和纯 Python 实现,开发者可以轻松上手并快速构建高效的智能体应用。

二、Agno 的主要功能

  • 极速智能体创建:创建智能体的速度比传统框架(如 LangGraph)快 5000 倍。

  • 模型无关性:支持任何模型和提供商,用户可以根据需要选择不同的模型,无需担心供应商锁定。

  • 多模态支持:原生支持文本、图像、音频和视频等多种数据模态。

  • 多智能体协作:支持将任务分配给多个专业化的智能体,实现高效的分工和协作。

  • 内存管理:将用户会话和智能体状态存储在数据库中,确保数据的持久化和安全性。

  • 知识库支持:基于向量数据库实现检索增强生成(RAG)或动态少样本学习,提升智能体的知识检索能力。

  • 结构化输出:智能体支持结构化数据格式响应,方便与其他系统集成。

  • 实时监控:在 agno.com 上实时跟踪智能体会话和性能,便于管理和优化。

三、Agno 的技术原理

  • 纯 Python 实现:Agno 基于 Python 编写,避免复杂的图结构、链式调用或其他复杂的模式,让代码更加简洁易懂,同时也便于开发者快速上手。

  • 无依赖性架构:用无依赖性设计,支持任何模型、任何提供商和任何模态。

  • 向量数据库集成:支持与向量数据库集成,利用向量数据库的高效检索能力,实现检索增强生成(RAG)或动态少样本学习。

  • 多智能体协作机制:基于任务分配和分工,将复杂任务分解为多个子任务,由不同的专业智能体分别处理。

四、如何运行 Agno

1. 安装 Agno
pip install -U agno   
2. 创建基本智能体
from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="You are an enthusiastic news reporter with a flair for storytelling!",
    markdown=True
)
agent.print_response("Tell me about a breaking news story from New York.", stream=True)

要运行该智能体,请安装依赖项并导出 OPENAI_API_KEY

pip install agno openai

export OPENAI_API_KEY=sk-xxxx

python basic_agent.py  
3. 创建带有工具的智能体
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="You are an enthusiastic news reporter with a flair for storytelling!",
    tools=[DuckDuckGoTools()],
    show_tool_calls=True,
    markdown=True
)
agent.print_response("Tell me about a breaking news story from New York.", stream=True)

安装依赖项并运行智能体:

pip install duckduckgo-search

python agent_with_tools.py
4. 创建带有知识库的智能体
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.embedder.openai import OpenAIEmbedder
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.knowledge.pdf_url import PDFUrlKnowledgeBase
from agno.vectordb.lancedb import LanceDb, SearchType

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="You are a Thai cuisine expert!",
    instructions=[
        "Search your knowledge base for Thai recipes.",
        "If the question is better suited for the web, search the web to fill in gaps.",
        "Prefer the information in your knowledge base over the web results."
    ],
    knowledge=PDFUrlKnowledgeBase(
        urls=["https://agno-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf"],
        vector_db=LanceDb(
            uri="tmp/lancedb",
            table_name="recipes",
            search_type=SearchType.hybrid,
            embedder=OpenAIEmbedder(id="text-embedding-3-small"),
        ),
    ),
    tools=[DuckDuckGoTools()],
    show_tool_calls=True,
    markdown=True
)

# Comment out after the knowledge base is loaded
if agent.knowledge isnotNone:
    agent.knowledge.load()

agent.print_response("How do I make chicken and galangal in coconut milk soup", stream=True)
agent.print_response("What is the history of Thai curry?", stream=True) 

安装依赖项并运行智能体:

pip install lancedb tantivy pypdf duckduckgo-search

python agent_with_knowledge.py  
5. 创建多智能体协作
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.tools.yfinance import YFinanceTools

web_agent = Agent(
    name="Web Agent",
    role="Search the web for information",
    model=OpenAIChat(id="gpt-4o"),
    tools=[DuckDuckGoTools()],
    instructions="Always include sources",
    show_tool_calls=True,
    markdown=True,
)

finance_agent = Agent(
    name="Finance Agent",
    role="Get financial data",
    model=OpenAIChat(id="gpt-4o"),
    tools=[YFinanceTools(stock_price=True, analyst_recommendations=True, company_info=True)],
    instructions="Use tables to display data",
    show_tool_calls=True,
    markdown=True,
)

agent_team = Agent(
    team=[web_agent, finance_agent],
    model=OpenAIChat(id="gpt-4o"),
    instructions=["Always include sources", "Use tables to display data"],
    show_tool_calls=True,
    markdown=True,
)

agent_team.print_response("What's the market outlook and financial performance of AI semiconductor companies?", stream=True)

安装依赖项并运行智能体团队:

pip install duckduckgo-search yfinance

python agent_team.py

资源

  • GitHub 仓库:https://github.com/agno-agi/agno
  • Agno 文档:https://docs.agno.com

如何系统学习掌握AI大模型?

AI大模型作为人工智能领域的重要技术突破,正成为推动各行各业创新和转型的关键力量。抓住AI大模型的风口,掌握AI大模型的知识和技能将变得越来越重要。

学习AI大模型是一个系统的过程,需要从基础开始,逐步深入到更高级的技术。

这里给大家精心整理了一份全面的AI大模型学习资源,包括:AI大模型全套学习路线图(从入门到实战)、精品AI大模型学习书籍手册、视频教程、实战学习、面试题等,资料免费分享

1. 成长路线图&学习规划

要学习一门新的技术,作为新手一定要先学习成长路线图方向不对,努力白费

这里,我们为新手和想要进一步提升的专业人士准备了一份详细的学习成长路线图和规划。可以说是最科学最系统的学习成长路线。
在这里插入图片描述

2. 大模型经典PDF书籍

书籍和学习文档资料是学习大模型过程中必不可少的,我们精选了一系列深入探讨大模型技术的书籍和学习文档,它们由领域内的顶尖专家撰写,内容全面、深入、详尽,为你学习大模型提供坚实的理论基础(书籍含电子版PDF)

在这里插入图片描述

3. 大模型视频教程

对于很多自学或者没有基础的同学来说,书籍这些纯文字类的学习教材会觉得比较晦涩难以理解,因此,我们提供了丰富的大模型视频教程,以动态、形象的方式展示技术概念,帮助你更快、更轻松地掌握核心知识

在这里插入图片描述

4. 2024行业报告

行业分析主要包括对不同行业的现状、趋势、问题、机会等进行系统地调研和评估,以了解哪些行业更适合引入大模型的技术和应用,以及在哪些方面可以发挥大模型的优势。

在这里插入图片描述

5. 大模型项目实战

学以致用 ,当你的理论知识积累到一定程度,就需要通过项目实战,在实际操作中检验和巩固你所学到的知识,同时为你找工作和职业发展打下坚实的基础。

在这里插入图片描述

6. 大模型面试题

面试不仅是技术的较量,更需要充分的准备。

在你已经掌握了大模型技术之后,就需要开始准备面试,我们将提供精心整理的大模型面试题库,涵盖当前面试中可能遇到的各种技术问题,让你在面试中游刃有余。

在这里插入图片描述

全套的AI大模型学习资源已经整理打包,有需要的小伙伴可以微信扫描下方优快云官方认证二维码,免费领取【保证100%免费

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值