Update app.py
Browse files
app.py
CHANGED
@@ -253,7 +253,7 @@ def get_mp3(text: str, voice: str, audio_model: str, api_key: str = None) -> byt
|
|
253 |
|
254 |
from functools import wraps
|
255 |
|
256 |
-
def conditional_llm(model, api_base=None):
|
257 |
"""
|
258 |
Conditionally apply the @llm decorator based on the api_base parameter.
|
259 |
If api_base is provided, it applies the @llm decorator with api_base.
|
@@ -263,7 +263,7 @@ def conditional_llm(model, api_base=None):
|
|
263 |
if api_base:
|
264 |
return llm(model=model, api_base=api_base)(func)
|
265 |
else:
|
266 |
-
return llm(model=model)(func)
|
267 |
return decorator
|
268 |
|
269 |
def generate_audio(
|
@@ -295,8 +295,10 @@ def generate_audio(
|
|
295 |
|
296 |
# Configure the LLM based on selected model and api_base
|
297 |
@retry(retry=retry_if_exception_type(ValidationError))
|
298 |
-
@conditional_llm(model=text_model, api_base=api_base)
|
299 |
-
def generate_dialogue(text: str, intro_instructions: str, text_instructions: str, scratch_pad_instructions: str,
|
|
|
|
|
300 |
"""
|
301 |
{intro_instructions}
|
302 |
|
|
|
253 |
|
254 |
from functools import wraps
|
255 |
|
256 |
+
def conditional_llm(model, api_base=None, api_key=None):
|
257 |
"""
|
258 |
Conditionally apply the @llm decorator based on the api_base parameter.
|
259 |
If api_base is provided, it applies the @llm decorator with api_base.
|
|
|
263 |
if api_base:
|
264 |
return llm(model=model, api_base=api_base)(func)
|
265 |
else:
|
266 |
+
return llm(model=model, api_key=api_key)(func)
|
267 |
return decorator
|
268 |
|
269 |
def generate_audio(
|
|
|
295 |
|
296 |
# Configure the LLM based on selected model and api_base
|
297 |
@retry(retry=retry_if_exception_type(ValidationError))
|
298 |
+
@conditional_llm(model=text_model, api_base=api_base, api_key=openai_api_key)
|
299 |
+
def generate_dialogue(text: str, intro_instructions: str, text_instructions: str, scratch_pad_instructions: str,
|
300 |
+
prelude_dialog: str, podcast_dialog_instructions: str,
|
301 |
+
) -> Dialogue:
|
302 |
"""
|
303 |
{intro_instructions}
|
304 |
|