python client can not be used.
OpenJarvisAI opened this issue · comments
OpenJarvisAI commented
Since
client = OpenAI(
api_key="sk-fwref", base_url=base_url
)
a = client.models.list()
the Client will call base_url model list inside to connect, but it cannot return a response, how to make it work with python client?
Vincent Young commented
import openai
openai.api_key = 'anything'
openai.base_url = "http://localhost:3040/v1/"
completion = openai.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": "Hello"},
],
)
print(completion.choices[0].message.content)