展示HN:实现卡帕西对自然语言编程的预测

3作者: amthewiz24 天前原帖
大家好, 安德烈·卡尔帕西(Andrej Karpathy)在2023年初发布了一条推文(链接:[https://x.com/karpathy/status/1617979122625712128](https://x.com/karpathy/status/1617979122625712128)): > “最热门的新编程语言是英语” 我多年来不懈努力,致力于实现这个愿景。我构建了一个自然语言编程栈,用于创建人工智能代理。我认为这是第一个真正的软件3.0栈。 核心理念:将大型语言模型(LLMs)作为CPU!你终于可以逐步调试你的提示,并获得可靠、可验证的执行。这个栈包括一种新语言、编译器以及开发工具,如VSCode扩展。 程序以Markdown格式编写。H1标签是代理,H2标签是自然语言剧本(即函数),Python剧本。所有代理中的剧本都在同一个调用栈上运行。自然语言和Python剧本可以相互调用。 快速介绍视频:[https://www.youtube.com/watch?v=ZX2L453km6s](https://www.youtube.com/watch?v=ZX2L453km6s) GitHub:[https://github.com/playbooks-ai/playbooks](https://github.com/playbooks-ai/playbooks)(MIT许可证) 文档:[https://playbooks-ai.github.io/playbooks-docs/getting-started/](https://playbooks-ai.github.io/playbooks-docs/getting-started/) 项目网站:runplaybooks.ai 示例剧本程序: ```plaintext # 国家事实代理 这个代理打印有关附近国家的有趣事实 ## 主程序 ### 触发器 - 在开始时 ### 步骤 - 询问用户他们来自哪个$country - 如果用户没有提供国家,进行对话并轻轻引导他们提供一个国家 - 列出5个靠近$country的$countries - 告诉用户附近的$countries - 通知用户你将告诉他们每个国家的一些有趣事实 - process_countries($countries) - 结束程序 ```python from typing import List @playbook async def process_countries(countries: List[str]): for country in countries: # 对每个国家调用自然语言剧本 'GetCountryFact' fact = await GetCountryFact(country) await Say("user", f"{country}: {fact}") ``` ## GetCountryFact($country) ### 步骤 - 返回关于$country的一个不寻常的历史事实 ``` 有许多非常有趣的功能。快速示例: - “排队调用提取每个候选文件的目录”——轻松调用MCP工具,多线程,工件管理,上下文管理 - “询问会计师税率是多少”是你与其他代理沟通的方式 - 你可以在同一个调用栈上无缝混合程序性自然语言剧本、ReAct剧本、原始提示剧本、Python剧本和外部剧本,如MCP工具 - “与厨师、市场专家和用户召开会议以设计新菜单”是你如何生成多代理工作流的方式,每个代理遵循自己的剧本进行会议 - 即将推出:观察代理(观察其他代理的代理——自动化内存存储,验证/认证执行,指导被观察的代理),程序性记忆的动态剧本生成等。 我希望这能改变我们未来构建人工智能代理的方式。期待讨论!我会在评论区与大家交流。
查看原文
Hi everyone,<p>Andrej Karpathy&#x27;s posted in early 2023 (<a href="https:&#x2F;&#x2F;x.com&#x2F;karpathy&#x2F;status&#x2F;1617979122625712128" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;karpathy&#x2F;status&#x2F;1617979122625712128</a>) -<p>&gt; &quot;The hottest new programming language is English&quot;<p>I have worked tirelessly years to realize this vision. I built a Natural Language Programming stack for building AI Agents. I think it is the first true Software 3.0 stack.<p>The core idea: Use LLMs as CPUs! You can finally step debug through your prompts and get reliable, verifiable execution. The stack includes a new language, compiler, developer tooling like VSCode extension.<p>Programs are written as markdown. H1 tags are agents, H2 tags are natural language playbooks (i.e. functions), python playbooks. All playbooks in an agents run on the same call stack. NL and python playbooks can call each other.<p>Quick intro video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZX2L453km6s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZX2L453km6s</a><p>Github: <a href="https:&#x2F;&#x2F;github.com&#x2F;playbooks-ai&#x2F;playbooks" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;playbooks-ai&#x2F;playbooks</a> (MIT license)<p>Documentation: <a href="https:&#x2F;&#x2F;playbooks-ai.github.io&#x2F;playbooks-docs&#x2F;getting-started&#x2F;" rel="nofollow">https:&#x2F;&#x2F;playbooks-ai.github.io&#x2F;playbooks-docs&#x2F;getting-starte...</a><p>Project website: runplaybooks.ai<p>Example Playbooks program -<p><pre><code> # Country facts agent This agent prints interesting facts about nearby countries ## Main ### Triggers - At the beginning ### Steps - Ask user what $country they are from - If user did not provide a country, engage in a conversation and gently nudge them to provide a country - List 5 $countries near $country - Tell the user the nearby $countries - Inform the user that you will now tell them some interesting facts about each of the countries - process_countries($countries) - End program ```python from typing import List @playbook async def process_countries(countries: List[str]): for country in countries: # Calls the natural language playbook &#x27;GetCountryFact&#x27; for each country fact = await GetCountryFact(country) await Say(&quot;user&quot;, f&quot;{country}: {fact}&quot;) ``` ## GetCountryFact($country) ### Steps - Return an unusual historical fact about $country </code></pre> There are a bunch of very interesting capabilities. A quick sample -<p>- &quot;Queue calls to Extract table of contents for each candidate file&quot; - Effortless calling MCP tools, multi-threading, artifact management, context management<p>- &quot;Ask Accountant what the tax rate would be&quot; is how you communicate with other agents<p>- you can mix procedural natural language playbooks, ReAct playbooks, Raw prompt playbooks, Python playbooks and external playbooks like MCP tools seamlessly on the same call stack<p>- &quot;Have a meeting with Chef, Marketing expert and the user to design a new menu&quot; is how you can spawn multi-agent workflows, where each agent follows their own playbook for the meeting<p>- Coming soon: Observer agents (agents observing other agents - automated memory storage, verify&#x2F;certify execution, steer observed agents), dynamic playbook generation for procedural memory, etc.<p>I hope this changes how we build AI agents going forward for the better. Looking forward to discussion! I&#x27;ll be in the comments.