langgraphjs-gen-ui-examples

news/2025/9/28 16:56:40/文章来源:https://www.cnblogs.com/lightsong/p/19117105

langgraphjs-gen-ui-examples

https://github.com/langchain-ai/langgraphjs-gen-ui-examples

LangGraph Generative UI Examples

This repository contains a series of agents intended to be used with the Agent Chat UI (repo).

Generative UI Example

 

https://deepwiki.com/langchain-ai/langgraphjs-gen-ui-examples

 

图片

 

Agents

Key

  • Supervisor
    • Stockbroker
    • Trip Planner
    • Open Code
    • Order Pizza
  • Chat Agent
  • Email Agent

Supervisor

This is the default agent, which has access to a series of subgraphs it can call, depending on the context of the conversation. This includes the following agents:

  • Stockbroker
  • Trip Planner
  • Open Code
  • Order Pizza

This agent works by taking in the input, and passing it, along with the rest of the chat history to a router node. This node passes the entire chat history to Gemini 2.0 Flash, and forces it to call a tool, with the route to take based on the conversation.

If the context does not have a clear subgraph which should be called, it routes to the General Input node, which contains a single LLM call used to respond to the user's input.

Stockbroker

The stockbroker agent has a series of tools available to it which will render generative UI components in the Agent Chat UI. It should be accessed via the agent graph ID, which means you'll need to go through the Supervisor agent to access it. The following are the prompts you can use to test the stockbroker agent:

  • What's the current price of <insert company/stock ticker here> - Will trigger a generative UI stockbroker agent which renders the current price of the stock.
  • I want to buy <insert quantity here> shares of <insert company/stock ticker here>. - Will trigger a generative UI stockbroker agent which renders a UI to buy a stock at its current price.
  • Show me my portfolio - Will trigger a generative UI stockbroker agent which renders a UI to show the user's portfolio.

Trip Planner

The trip planner agent has tools available to it which can render generative UI components for planning/booking trips. It should be accessed via the agent graph ID, which means you'll need to go through the Supervisor agent to access it. The following prompts will trigger the trip planner agent:

  • Show me places to stay in <insert location here> - Will trigger a generative UI travel agent which renders a UI to select accommodations.
  • Recommend some restaurants for me in <insert location here> - Will trigger a generative UI travel agent which renders a UI to select restaurants.

The agent will first extract the following information from your input, if present:

  • location - Required field. This can be the city, state, or some other location for the trip.
  • startDate - Optional field. The start date of the trip. Defaults to 4 weeks from now.
  • endDate - Optional field. The end date of the trip. Defaults to 5 weeks from now.
  • numberOfGuests - Optional field. The number of guests attending the trip. Defaults to 2.

The only field, location, is required, and the rest are optional.

Open Code

This is a dummy code writing agent, used to demonstrate how you can implement generative UI components in agents. It should be accessed via the agent graph ID, which means you'll need to go through the Supervisor agent to access it. It is triggered by requesting the agent to write a React TODO app, like this:

  • Write a React TODO app for me

This will then render a plan (these steps are static, and will always be the same). After that, it'll "generate" code (each plan item has a corresponding "generated code output") for each item in the plan. It only does this one at a time, and will not suggest the next part of generated code until after the previous suggestion has been accepted, rejected, or accepted for all future requests in this session. If you select that button, it will resume the graph, and continue through the rest of the steps, and suggest code without pausing to wait for your approval.

Order Pizza

The order pizza agent is used to demonstrate how tool calls/results are rendered in the UI. It should be accessed via the agent graph ID, which means you'll need to go through the Supervisor agent to access it. You can trigger it via the following query:

  • Order me a pizza <include optional topping instructions> in <include location here>

It will then call two tools, once to extract the fields from your input for the pizza order (order details, and location). After that, it calls the tool to "order" the pizza. Each of these tool calls will have corresponding tool call/result UI components rendered in the Agent Chat UI. These are the default UI components rendered when your graph calls a tool/returns a tool result.

Chat Agent

The chat agent is a single LLM call, used to demonstrate the plain back and forth of a chat agent. It should be accessed via the chat graph ID. It does not have access to any tools, or generative UI components.

Email Agent

The email agent is a dummy implementation of how you'd implement an email assistant with the Agent Chat UI. It is accessed via the email_agent graph ID. You can trigger it via the following query:

  • Write me an email to <insert email here> about <insert email description here>

This will then call the graph which extracts fields from your input (or responds with a request for more information). Once it's extracted all of the required information it will interrupt, passing the standardized HumanInterrupt schema. The Agent Chat UI is able to detect when interrupts with this schema are thrown, and when it finds one it renders a UI component to handle actions by the user which are used to resume the graph.

The allowed actions are:

  • Accept - If you accept the email as is, without making changes to any fields, it will "send" the email (emails aren't actually sent, just a message is displayed indicating the email was sent).
  • Edit - If you edit any of the email fields and submit, it will "send" the email with the new values.
  • Respond - If you send a text response back, it will be used to rewrite the email in some way, then interrupt again and wait for you to take an action.
  • Ignore - This will send back an ignore response, and the graph will end without taking any actions.
  • Mark as resolved - If you select this, it will resume the graph, but starting at the __end__ node, causing the graph to end without taking any actions.

Writer Agent

This is a dummy agent used to demonstrate how you can stream generative UI components as an artifact. It should be accessed via the writer graph ID. It should be accessed via the agent graph ID, which means you'll need to go through the Supervisor agent to access it. The following prompts will trigger the writer agent:

  • Write me a short story about a <insert topic here>

This will render a generative UI component that contains the title and content of your short story. The generative UI component will be rendered in a side panel to the right of the chat and the contents of the story will be streamed to the UI as it is generated.

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/920859.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

2025 年节能咨询公司最新权威推荐排行榜:覆盖工业 / 建筑 / 数据中心等领域 TOP5 优质企业综合测评与选型指南发电厂/燃气/全域增效/服务器节能公司推荐

在 “双碳” 目标深化推进的当下,企业对节能咨询服务的需求日益迫切,但市场现状却让企业面临诸多困扰。部分服务商技术单一,仅能解决局部能耗问题,无法实现全流程节能优化;有些服务商过度宣传,实际节能效果与承诺…

微算法科技(NASDAQ MLGO)探索全同态加密与安全多方计算融合,开启区块链隐私执行新时代

随着区块链应用场景不断拓展,跨分片复杂合约的隐私保护需求日益凸显。传统区块链技术在处理此类合约时,难以兼顾数据隐私与功能实现。交易数据和合约执行细节常以明文形式存储和处理,易导致敏感信息泄露。微算法科技…

杭州仪器网站制作海外运营是做什么的

戳蓝字“CSDN云计算”关注我们哦&#xff01;2019年7月9日&#xff0c;IBM史上最大的一笔收购案终于尘埃落定&#xff0c;IBM以每股现金190.0美元&#xff0c;完成对红帽所有已发行和流通在外普通股的收购交易&#xff0c;总股本价值约340亿美元。至此&#xff0c;红帽这家全球…

国产SUB-1G芯片DP4363F支持119-1050mhz超低功耗 - 动能世纪

DP4363是一款高性能、低电流的收发器,覆盖了从119MHZ到1050MHz的频段。它是系列完整发射器、接收器和收发器产品中的组成部分,适用于各种广泛的应用场景。该设备具有卓越的灵敏度,达到-126dBm,同时实现了极低的运行…

上海网站分站建设成都市建设质监站网站

【问题描述】 第200题 岛屿数量 给你一个由 1&#xff08;陆地&#xff09;和 0&#xff08;水&#xff09;组成的的二维网格&#xff0c;请你计算网格中岛屿的数量。岛屿总是被水包围&#xff0c;并且每座岛屿只能由水平方向和/或竖直方向上相邻的陆地连接形成。此外&#xf…

做设计用图片的网站为什么不做网站做公众号

有win10用户说他在更新完系统后&#xff0c;在切换输入法的时候发现竟然切换不了无法切换&#xff0c;都不知道该怎么办了&#xff0c;这个小问题也是常有的&#xff0c;那么win10更新后不能切换输入法怎么办呢&#xff0c;下面小编给大家分享win10输入法切换不了的解决方法。 …

2025 年棕刚玉源头厂家最新推荐排行榜:TOP 级生产厂家原料与烧结工艺权威解析,助力企业精准选购一级棕刚玉/棕刚玉磨料/优质棕刚玉/棕刚玉喷砂废料回收厂家推荐

在工业研磨、表面处理等关键领域,棕刚玉磨料的品质直接决定生产效率与成品精度,是下游企业保障生产质量的核心要素。当前市场中,棕刚玉厂家数量繁杂,部分厂家存在原料把控不严、烧结工艺落后等问题,导致产品杂质超…

杀疯了!GitHub 发布 Copilot CLI!!!

大家好,我是R哥。 今年 AI 编程赛道真是大乱斗啊,特别是面向「终端」的 AI 编程工具,自从 Anthropic 的 Claude Code CLI 问世以来,XX CLI 层出不穷:Google - Gemini CLI Cursor CLI OpenAI - CodeX CLI ……如果…

2025 年无尘金刚砂源头厂家最新推荐排行榜:权威精选企业产能与品质深度解析无尘金刚砂材料/无尘金刚砂批发/无尘金刚砂喷砂厂家推荐

在工业研磨、表面处理等核心领域,无尘金刚砂的品质直接决定加工精度、生产效率及工件成品质量,是众多企业生产环节中不可或缺的关键磨料。当前市场上,无尘金刚砂厂家数量众多,但产品质量差异显著,部分厂家因原料劣…

langgraph-genui

langgraph-genui https://github.com/fanqingsong/langgraph-genuiLangGraph GenUI 微服务架构这是一个基于 LangGraph 的微服务架构项目,包含智能体服务和前端对话界面两个独立的微服务。项目结构langgraph-genui/ ├…

外国网站邀请做编辑广州做网站找酷爱网络

开源项目专题系列(八)1.开源项目名称&#xff1a;magpie_fly2.github地址&#xff1a;https://github.com/wuba/magpie_fly3.简介&#xff1a;magpie_fly 是58集体出品组件库&#xff0c;统一管理日常开发中的基础组件及高阶组件&#xff0c;并提供了相对友好的方式介绍组件的具…

中国住房和城乡建设厅网站美食教做网站

过了面试&#xff0c;后面的在线测评还会刷人吗&#xff1f;完全有可能刷&#xff0c;如果不是为了刷&#xff0c;何必要给你做线上测评&#xff0c;我说的有道理不&#xff1f; 好吧&#xff0c;说到为什么在线测评要刷人&#xff0c;怎么刷&#xff1f; 怎么才能确保不被刷&…

web服务器配置步骤有哪些?如何建立一个web服务器

建立一个 Web 服务器 并配置它,是托管网站、应用程序或服务的基础任务。以下是完整的 Web 服务器配置步骤,涵盖从准备服务器到部署网站的流程,包括选择技术栈、安装软件、配置安全性和优化性能。1. 准备工作 1.1 选…

题解:P10005 [集训队互测 2023] 基础寄术练习题

好牛的计数题。 题意:很简单了,不再赘述。 做法: 首先看到这个前缀和的乘积的倒数太难算了,一般来说肯定是考虑拆成 \(a\) 怎么样算一下,经过一定的手玩以后会发现 \(\sum\prod\limits_{i}\frac{1}{s_i}=\prod\fr…

详细介绍:Linux----gcc、g++的使用以及一些问题

详细介绍:Linux----gcc、g++的使用以及一些问题pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", …

网页和网站有什么关系网络建设与维护是什么

工厂模式用于干掉大量的if-else &#xff0c;策略模式用于挪去臃肿的业务代码&#xff0c;还可以进一步升级加上模板模式&#xff0c;以及抽取成Starter public interface HandlerStrategy extends InitializingBean {void findSyncOrders(); }public class SalesPlatformFact…

网站logo怎么设计哪个网站可以做立体字的模板

文章目录1. 题目2. 解题1. 题目 设计一个支持下述操作的食物评分系统&#xff1a; 修改 系统中列出的某种食物的评分。返回系统中某一类烹饪方式下评分最高的食物。 实现 FoodRatings 类&#xff1a; FoodRatings(String[] foods, String[] cuisines, int[] ratings) 初始化…

电子商务网站开发常用工具建筑资料管理规程

最近很多朋友(Andrew、BENEN1)都在问如何让Lookup显示InActive记录,研究后发现可以通过Plugin来实现这样的功能&#xff0c;MSCRM真是无所不能&#xff0c;没有做不到&#xff0c;只有想不到!实现步骤&#xff1a;一、自定义实体->工程项目->表单和视图->查找视图->…