Replies: 9 comments 5 replies
-
感觉是不是有些部分是langchain的范畴 |
Beta Was this translation helpful? Give feedback.
-
感觉会略重,我非常认同 @ONLY-yours 的这个观点 #34 (comment) :
我觉得最适合的切入点是提供 session level 的状态管理 hooks,其他的东西让业务自己来实现(主要是 API 大家都不一样,做 proxy 模式又多绕一层) |
Beta Was this translation helpful? Give feedback.
-
按我目前设想的,更新了 Basic Use。 |
Beta Was this translation helpful? Give feedback.
-
建议能直接对接 openai sdk,让开发者开箱即用。 |
Beta Was this translation helpful? Give feedback.
-
提议👻 |
Beta Was this translation helpful? Give feedback.
-
看起来约定的东西比较多,如果是这个支小宝的例子,流程应该是什么样子的? https://usexagent.x-73x.pages.dev/components/use-x-agent-cn#components-use-x-agent-demo-suggestions |
Beta Was this translation helpful? Give feedback.
-
应该能基于这套东西直接做一个 https://github.com/langchain-ai/weblangchain 出来。 |
Beta Was this translation helpful? Give feedback.
-
useXChat:
const { chat } = useXChat(agent, {
defaultMessages: `WelcomedInfo(Bubble[role: 'welcome'])`,
requestPlaceholder,
requestFailed,
});
chat(message); useXAgent:
// Open AI,提供一些预设的协议来支持
const openAIAgent = useXAgent({
baseURL,
key,
model: 'gpt-3.5-turbo', // Trigger
});
const sockInstance = setupSocket();
// Customize without streaming
const customAIAgent = useXAgent({
request: (msg, info) => async {
const res = await fetch('/xxxxx', { msg, otherMsgs: info.messages }); // Or sock.send
return await res.json(); // 可以前端转化成 Message Gernic
},
});
// Customize with streaming
const customStreamingAIAgent = useXAgent({
request: (msg, info, onSuccess, onError, onUpdate) => {
// 自行处理三态逻辑,以 suc or err 为终结
}, // 背后是会转成一个 Updater 交给 useXChat 来处理的。
});
// Updater: 一种实现可以支持三态
* suc => insertSucBubble
* fail => inserErrBubble
* info => updateBubbleOrInsertIfNotExist MessageGeneric<Message = string>
// 如果是富态交互卡片类型
type MessageCustom = {
type: 'string' | 'map',
content: 'string' | MapJSON
};
BubbleList => role['ai' | 'map']
map => renderMap |
Beta Was this translation helpful? Give feedback.
-
我是前端菜鸟,但是很注重新知识的学习。有个困惑useXAgent搭配Sender实现流式对话的时候,如果我有一个AI agent的后端,可以调用我自己的后端么? |
Beta Was this translation helpful? Give feedback.
-
🎯 要做什么?
🧑💻 目标用户是谁?
不仅仅是前端开发者:
🚀 要做成什么样子?
👀 如何去做?
🔎 展开讲讲
关于各个 Tools
关于各个 Runtime Hook
API
XFetch
XStream
XAdapter
useXAgent
useXMemory
useXAction
useXPlan
🏎️ 如何使用
开箱即用
配合原子组件使用
多项建议
📚 相关文献
https://lilianweng.github.io/posts/2023-06-23-agent/
Beta Was this translation helpful? Give feedback.
All reactions