added chat streaming
This commit is contained in:
@@ -13,6 +13,17 @@ async function complete(prompt, options ={}) {
|
||||
return res.json();
|
||||
}
|
||||
|
||||
async function completeStream(prompt, options={}) {
|
||||
const res = await fetch(`${BASE_URL}/complete/stream`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({prompt, ...options}),
|
||||
})
|
||||
if (!res.ok) throw new Error(`Inference service error: ${res.status}`);
|
||||
return res;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
complete
|
||||
complete,
|
||||
completeStream
|
||||
}
|
||||
Reference in New Issue
Block a user