跳到主要内容

使用文本补全格式 - 使用 Completion()

如果你偏好使用 OpenAI 文本补全格式进行交互,本教程将介绍如何在此格式下使用 LiteLLM

response = openai.Completion.create(
model="text-davinci-003",
prompt='Write a tagline for a traditional bavarian tavern',
temperature=0,
max_tokens=100)

在文本补全格式中使用 LiteLLM

使用 gpt-3.5-turbo

from litellm import text_completion
response = text_completion(
model="gpt-3.5-turbo",
prompt='Write a tagline for a traditional bavarian tavern',
temperature=0,
max_tokens=100)

使用 text-davinci-003

response = text_completion(
model="text-davinci-003",
prompt='Write a tagline for a traditional bavarian tavern',
temperature=0,
max_tokens=100)

使用 llama2

response = text_completion(
model="togethercomputer/llama-2-70b-chat",
prompt='Write a tagline for a traditional bavarian tavern',
temperature=0,
max_tokens=100)