https://github.com/flowiseai/flowisesdk
https://github.com/flowiseai/flowisesdk
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/flowiseai/flowisesdk
- Owner: FlowiseAI
- License: mit
- Created: 2024-09-05T01:23:02.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-23T12:44:24.000Z (9 months ago)
- Last Synced: 2025-01-07T20:16:34.612Z (5 months ago)
- Language: TypeScript
- Size: 10.7 KB
- Stars: 8
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Flowise SDK
A TypeScript SDK for interacting with the Flowise API.
## Installation
```bash
npm install flowise-sdk
```## Usage
```typescript
import { FlowiseClient } from 'flowise-sdk';const flowise = new FlowiseClient({ baseUrl: 'http://localhost:3000' });
async function main() {
const completion = await flowise.createPrediction({
chatflowId: '',
question: "hello",
streaming: true
});for await (const chunk of completion) {
console.log(chunk);
}
}main();
```## API Reference
### `FlowiseClient`
The main class for interacting with the Flowise API.
#### Constructor
```typescript
new FlowiseClient(baseUrl?: , apiKey: )
```- `baseUrl`: Optional. The base URL for the Flowise API. Defaults to 'http://localhost:3000'
- `apiKey`: Optional. The API Key used to access the chatflow#### Methods
##### `createPrediction(params: PredictionParams)`
Creates a new prediction.
- `params`: An object containing the following properties:
- `chatflowId`: string - Chatflow ID to execute prediction
- `question`: string - The question to ask.
- `streaming`: boolean (optional) - Whether to stream the response.
- `chatId`: string (optional) - Chat ID of the session
- `overrideConfig`: object (optional) - Override configuration
- `history`: array (optional) - Array of prepended messages## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.