Code/Language
Learn how to create completions from language and code models.
Creating a completion
Use client.completions.create
to create a completion for a code or language models:
import os
from together import Together
client = Together()
response = client.completions.create(
model="codellama/CodeLlama-34b-Instruct-hf",
prompt="def fibonacci(n): ",
stream=True,
)
for chunk in response:
print(chunk.choices[0].text or "", end="", flush=True)
import Together from 'together-ai';
const together = new Together();
const response = await together.completions.create({
model: "codellama/CodeLlama-13b-Python-hf",
prompt: 'def bubbleSort(): ',
stream: true
});
for chunk in response:
console.log(chunk.choices[0].text)
Updated 17 days ago