跳转至内容
  • 版块
  • 最新
  • 标签
  • 热门
  • 世界
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠
品牌标识

AI量化投资实验室-社区&知识库

  1. 首页
  2. 大模型、智能体以及通用智能(AGI)
  3. 智能体开发与应用落地
  4. agno的使用教程

agno的使用教程

已定时 已固定 已锁定 已移动 智能体开发与应用落地
1 帖子 1 发布者 262 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • A 离线
    A 离线
    ailabx
    编写于 最后由 编辑
    #1

    如何使用工具:

    from agno.agent import Agent
    
    agent = Agent(
        # Add functions or Toolkits
        tools=[...],
        # Show tool calls in the Agent response
        show_tool_calls=True
    )
    

    也可以使用工具集:

    from agno.agent import Agent
    from agno.tools.duckduckgo import DuckDuckGoTools
    
    agent = Agent(tools=[DuckDuckGoTools()], show_tool_calls=True, markdown=True)
    agent.print_response("Whats happening in France?", stream=True)
    

    我们可以很容易自定义自己的工具,就是普通的python函数:

    import json
    import httpx
    
    from agno.agent import Agent
    
    def get_top_hackernews_stories(num_stories: int = 10) -> str:
        """Use this function to get top stories from Hacker News.
    
        Args:
            num_stories (int): Number of stories to return. Defaults to 10.
    
        Returns:
            str: JSON string of top stories.
        """
    
        # Fetch top story IDs
        response = httpx.get('https://hacker-news.firebaseio.com/v0/topstories.json')
        story_ids = response.json()
    
        # Fetch story details
        stories = []
        for story_id in story_ids[:num_stories]:
            story_response = httpx.get(f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json')
            story = story_response.json()
            if "text" in story:
                story.pop("text", None)
            stories.append(story)
        return json.dumps(stories)
    
    agent = Agent(tools=[get_top_hackernews_stories], show_tool_calls=True, markdown=True)
    agent.print_response("Summarize the top 5 stories on hackernews?", stream=True)
    

    技术让生活更简单。

    1 条回复 最后回复
    1
    回复
    • 在新帖中回复
    登录后回复
    • 从旧到新
    • 从新到旧
    • 最多赞同


    • 登录

    • 没有帐号? 注册

    Powered by NodeBB Contributors
    • 第一个帖子
      最后一个帖子
    0
    • 版块
    • 最新
    • 标签
    • 热门
    • 世界
    • 用户
    • 群组