Private
Readonly
clientThe non-streaming Completions request.
Optional
endpoint: stringAn optional custom endpoint to call. If not provided, the
endpoint defaults to https://text.octoai.run/v1/completions
.
import { Client } from "@octoai/client";
const client = new Client(process.env.OCTOAI_TOKEN);
const response = await client.create({
model: "llama-2-13b-chat",
prompt: "Write a blog about Seattle",
});
console.log(response.choices[0].text);
// Seattle is a vibrant and eclectic city...
Create a streaming Completions request.
The streaming Completions request.
Optional
endpoint: stringAn optional custom endpoint to call. If not provided, the
endpoint defaults to https://text.octoai.run/v1/completions
or the
secureLink API if secureLink is set to true on client instantiation.
import { Client } from "@octoai/client";
const client = new Client(process.env.OCTOAI_TOKEN);
const stream = await client.create({
model: "llama-2-13b-chat",
prompt: "Write a blog about Seattle",
stream: true,
});
let result = "";
for await (const chunk of stream) {
result += chunk.choices[0].text;
}
stream.controller.abort();
console.log(result);
// Seattle is a vibrant and eclectic city...
Generated using TypeDoc
Create a non-streaming Completions request.