Spaces:
Running
Running
NeonBohdan
commited on
Commit
•
5b981d0
1
Parent(s):
a3e95e6
client -> openai
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ def respond(
|
|
59 |
|
60 |
messages.append({"role": "user", "content": message})
|
61 |
|
62 |
-
completion = client.
|
63 |
model=client.vllm_model_name,
|
64 |
messages=messages,
|
65 |
max_tokens=max_tokens,
|
|
|
59 |
|
60 |
messages.append({"role": "user", "content": message})
|
61 |
|
62 |
+
completion = client.openai.chat.completions.create(
|
63 |
model=client.vllm_model_name,
|
64 |
messages=messages,
|
65 |
max_tokens=max_tokens,
|
shared.py
CHANGED
@@ -51,13 +51,13 @@ class Client:
|
|
51 |
self.get_personas()
|
52 |
|
53 |
def init_client(self):
|
54 |
-
self.
|
55 |
base_url=f"{self.api_url}/v1",
|
56 |
api_key=self.api_key,
|
57 |
)
|
58 |
|
59 |
def get_metadata(self):
|
60 |
-
models = self.
|
61 |
vllm_model_name = models.data[0].id
|
62 |
|
63 |
model_name, *suffix = vllm_model_name.split("@")
|
|
|
51 |
self.get_personas()
|
52 |
|
53 |
def init_client(self):
|
54 |
+
self.openai = OpenAI(
|
55 |
base_url=f"{self.api_url}/v1",
|
56 |
api_key=self.api_key,
|
57 |
)
|
58 |
|
59 |
def get_metadata(self):
|
60 |
+
models = self.openai.models.list()
|
61 |
vllm_model_name = models.data[0].id
|
62 |
|
63 |
model_name, *suffix = vllm_model_name.split("@")
|