Documentation

Code/Language

Creating a completion

Use client.completions.create to create a completion for a code or language models:

Python Copy
import os
from bytecompute import bytecompute

client = bytecompute()

response = client.completions.create(
    model="meta-llama/Llama-2-70b-hf",
    prompt="def fibonacci(n): ",
    stream=True,
)

for chunk in response:
    print(chunk.choices[0].text or "", end="", flush=True)
TypeScript Copy
import bytecompute from 'bytecompute-ai';

const bytecompute = new bytecompute();

const response = await bytecompute.completions.create({
  model: "meta-llama/Llama-2-70b-hf",
  prompt: 'def bubbleSort(): ',
  stream: true
});

for chunk in response:
    console.log(chunk.choices[0].text)