使用文本完成格式 - 带有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)