灰褐色
您的 React 或 Angular 应用程序的 AI 聊天和代理 .
Hashbrown是一个无头的TypeScript框架. 模型让你
组件和调用工具,在浏览器中,与任何提供者.
@hashbrownai/google 是谷歌双子座的节点适配器. 它将一个AG-UI从Hashbrown的回放或Angular软件包运行到谷歌双子座SDK和溪流AG-UI事件回放. 您的服务器保留了 API 密钥 .
开始
npm install @hashbrownai/google @google/genai @ag-ui/core @ag-ui/encoder --save
部署带有快递服务器 /run 与 Google 双子座一起使用 Hashbrown 的结束点 .
import type { RunAgentInput } from '@ag-ui/core';
import { EventEncoder } from '@ag-ui/encoder';
import { HashbrownGoogle } from '@hashbrownai/google';
app.post('/run', async (req, res) => {
const abortController = new AbortController();
req.once('aborted', () => abortController.abort());
res.once('close', () => abortController.abort());
const stream = HashbrownGoogle.stream.text({
apiKey: process.env.GOOGLE_API_KEY!,
model: process.env.GOOGLE_MODEL ?? 'gemini-2.5-flash',
input: req.body as RunAgentInput,
signal: abortController.signal,
});
const encoder = new EventEncoder();
res.header('Cache-Control', 'no-cache, no-store, must-revalidate');
res.header('Content-Type', encoder.getContentType());
res.header('Connection', 'keep-alive');
res.flushHeaders();
for await (const event of stream) {
res.write(encoder.encodeSSE(event));
}
if (!res.writableEnded) {
res.end();
}
});
文档
为 Hashbrown Google 双子适配器读取文件。 。 。 .
粘着? 问布莱恩在 https://hashbrown.dev/unstuck (中文(简体) )。 。 。 .