Update engines/orpheus_engine.py
Browse files
engines/orpheus_engine.py
CHANGED
@@ -10,7 +10,7 @@ from typing import Optional, Union
|
|
10 |
from RealtimeTTS.engines import BaseEngine, TimingInfo
|
11 |
|
12 |
# Default configuration values
|
13 |
-
DEFAULT_API_URL = "http://127.0.0.1:1234
|
14 |
DEFAULT_HEADERS = {"Content-Type": "application/json"}
|
15 |
DEFAULT_MODEL = "orpheus-3b-0.1-ft"
|
16 |
DEFAULT_VOICE = "JaKob"
|
@@ -177,6 +177,7 @@ class OrpheusEngine(BaseEngine):
|
|
177 |
payload = {
|
178 |
"model": self.model,
|
179 |
"prompt": formatted_prompt,
|
|
|
180 |
"max_tokens": self.max_tokens,
|
181 |
"temperature": self.temperature,
|
182 |
"top_p": self.top_p,
|
@@ -211,7 +212,8 @@ class OrpheusEngine(BaseEngine):
|
|
211 |
try:
|
212 |
data = json.loads(data_str)
|
213 |
if 'choices' in data and data['choices']:
|
214 |
-
|
|
|
215 |
if token_text:
|
216 |
token_counter += 1
|
217 |
# Print the time it took to get the first token
|
|
|
10 |
from RealtimeTTS.engines import BaseEngine, TimingInfo
|
11 |
|
12 |
# Default configuration values
|
13 |
+
DEFAULT_API_URL = "http://127.0.0.1:1234"
|
14 |
DEFAULT_HEADERS = {"Content-Type": "application/json"}
|
15 |
DEFAULT_MODEL = "orpheus-3b-0.1-ft"
|
16 |
DEFAULT_VOICE = "JaKob"
|
|
|
177 |
payload = {
|
178 |
"model": self.model,
|
179 |
"prompt": formatted_prompt,
|
180 |
+
"messages": [{"role": "user", "content": formatted_prompt}],
|
181 |
"max_tokens": self.max_tokens,
|
182 |
"temperature": self.temperature,
|
183 |
"top_p": self.top_p,
|
|
|
212 |
try:
|
213 |
data = json.loads(data_str)
|
214 |
if 'choices' in data and data['choices']:
|
215 |
+
delta = data["choices"][0]
|
216 |
+
token_text = delta.get("delta", {}).get("content", "")
|
217 |
if token_text:
|
218 |
token_counter += 1
|
219 |
# Print the time it took to get the first token
|