Skip to main content

Generic Prediction

Send a prediction payload directly to a standalone custom or fine-tuned Open Model using the Knowledgator TypeScript SDK.

Open Models represent standalone full models hosted dynamically at dedicated endpoints: POST /inference/{model_id}/.


Example Usage​

import { createClient } from '@knowledgator/typescript-sdk';

const kg = createClient();

// Connect to a fine-tuned Open Model (e.g. gliclass-x-base)
const model = kg.model('m-d9be7ede307943439a30c6f814026566');

const response = await model.predict({
text: 'Ultra-soft organic cotton graphic hoodie with kangaroo pocket.',
labels: ['Clothing', 'Electronics', 'Home Goods', 'Books'],
});

console.log('Prediction:', response.outputs);

Expected Output​

[
{
"label": "Clothing",
"score": 0.987
}
]
Open Models vs. LoRA Adapters

Stand-alone fine-tuned models (type "model") are queried via kg.model(model_id).predict(...). For LoRA adapters (type "adapter"), use the base service directly and specify adapter_id.