本页还没有译文
本页 15 段还没译成한국어,下面显示的是英文原文。Flowise
还没翻译译自英文(ai-sdk.dev)本页 15 段都还没译
The Flowise provider allows you to easily integrate Flowise chatflows with your applications using the AI SDK.
Setup
The Flowise provider is available in the @ahmedrowaihi/flowise-vercel-ai-sdk-provider module. You can install it with:
pnpm add @ahmedrowaihi/flowise-vercel-ai-sdk-providernpm install @ahmedrowaihi/flowise-vercel-ai-sdk-provideryarn add @ahmedrowaihi/flowise-vercel-ai-sdk-providerbun add @ahmedrowaihi/flowise-vercel-ai-sdk-providerProvider Instance
You can import the provider factory from @ahmedrowaihi/flowise-vercel-ai-sdk-provider:
import { createFlowiseProvider } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';Quick Start
Using a Reusable Provider
Create a file called .env.local and add your Flowise configuration:
FLOWISE_BASE_URL=https://your-flowise-instance.com
FLOWISE_API_KEY=your_api_key_optionalimport { createFlowiseProvider } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
import { generateText } from 'ai';
const flowise = createFlowiseProvider({
baseUrl: process.env.FLOWISE_BASE_URL!,
apiKey: process.env.FLOWISE_API_KEY,
});
const { text } = await generateText({
model: flowise('your-chatflow-id'),
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});Using a One-shot Model
import { createFlowiseModel } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
import { generateText } from 'ai';
const { text } = await generateText({
model: createFlowiseModel({
baseUrl: process.env.FLOWISE_BASE_URL!,
apiKey: process.env.FLOWISE_API_KEY,
chatflowId: 'your-chatflow-id',
}),
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});Streaming Example
import { streamText } from 'ai';
import { createFlowiseProvider } from '@ahmedrowaihi/flowise-vercel-ai-sdk-provider';
const flowise = createFlowiseProvider({
baseUrl: process.env.FLOWISE_BASE_URL!,
apiKey: process.env.FLOWISE_API_KEY,
});
const result = streamText({
model: flowise('your-chatflow-id'),
prompt: 'Write a story about a robot learning to cook.',
});
return result.toDataStreamResponse();More Information
For more information and advanced usage, see the Flowise provider documentation.
AI 翻译查看英文原文