灰褐色
您的 React 或 Angular 应用程序的 AI 聊天和代理 .
Hashbrown是一个无头的TypeScript框架. 模型让你
组件和调用工具,在浏览器中,与任何提供者.
@hashbrownai/react 给您 Hashbrown 的钩子和组件用于 react:聊天和UI聊天钩,工具,UI工具包,以及Magic Text渲染.
开始
npm install @hashbrownai/{core,react,openai}
在您的服务器上点为 Hashbrown :
export function Providers({ children }: { children: React.ReactNode }) {
return <HashbrownProvider url="/run">{children}</HashbrownProvider>;
}
HashbrownProvider 接受:
url(需要):您的 Hashbrown API 端点的基址 .middleware(可选的):在请求发送前转换其功能.transport(可选):自定义AG-UI运输为后人钩.
展示您的组件并给出模型工具. 该模型只使您注册的组件,而斯基列验证它们的道具. 工具在浏览器中运行,与您的应用程序的状态和服务.
export function FlightChat({ api }: { api: AircraftApi }) {
const getAircraft = useTool({
name: 'getAircraft',
description: 'List the aircraft on the map',
handler: () => api.list(),
deps: [api],
});
const chat = useUiChat({
system: 'Help users understand the air traffic on the map.',
components: [
exposeComponent(FlightCard, {
description: 'Show one aircraft',
props: { hex: s.string('Aircraft hex code') },
}),
],
tools: [getAircraft],
});
// Components render while the response streams in.
return chat.messages.map((message) =>
message.role === 'assistant' ? message.ui : message.content,
);
}
文档
连接一个模型
您的服务器保存了 Hashbrown 适配器的 API 密钥和流 :
- 开放AI数字 :
@hashbrownai/openai - 安东尼数字 :
@hashbrownai/anthropic - 谷歌双子座数字 :
@hashbrownai/google - 亚马逊贝德洛克数字 :
@hashbrownai/bedrock - Azure OpenAI 系统数字 :
@hashbrownai/azure - 奥拉玛数字 :
@hashbrownai/ollama - 自己的后端
需要一个完整的聊天UI?
哈斯布朗无头. 线程平面 是React和Angular的全代理 UI,基于Hashbrown:线程,批准和工具进度. 自由与麻省理工,由Hashbrown背后的团队提供企业支持.
粘着? 问布莱恩在 https://hashbrown.dev/unstuck (中文(简体) )。 。 。 .