1.0.1 • Published 6 months ago
askia-sdk v1.0.1
Askia SDK
A TypeScript SDK for interacting with the Askia API.
Installation
npm install askia-sdk
Usage
import { AskiaClient } from 'askia-sdk';
const askia = new AskiaClient({ baseUrl: 'http://localhost:3000' });
async function main() {
const completion = await askia.createPrediction({
chatflowId: '<id>',
question: "hello",
streaming: true
});
for await (const chunk of completion) {
console.log(chunk);
}
}
main();
API Reference
AskiaClient
The main class for interacting with the Askia API.
Constructor
new AskiaClient(baseUrl?: <your-base-url>, apiKey: <chatflow-apikey>)
baseUrl
: Optional. The base URL for the Askia 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 predictionquestion
: string - The question to ask.streaming
: boolean (optional) - Whether to stream the response.chatId
: string (optional) - Chat ID of the sessionoverrideConfig
: object (optional) - Override configurationhistory
: array (optional) - Array of prepended messages
License
This project is licensed under the MIT License - see the LICENSE file for details.
1.0.1
6 months ago