Update app.py
Browse files252 unmodified lines2532542552562572582593 unmodified lines26326426526626726826925 unmodified lines295296297298299300301302252 unmodified linesfrom functools import wrapsdef conditional_llm(model, api_base=None):"""Conditionally apply the @llm decorator based on the api_base parameter.If api_base is provided, it applies the @llm decorator with api_base.3 unmodified linesif api_base:return llm(model=model, api_base=api_base)(func)else:return llm(model=model)(func)return decoratordef generate_audio(25 unmodified lines# Configure the LLM based on selected model and api_base@retry(retry=retry_if_exception_type(ValidationError))@conditional_llm(model=text_model, api_base=api_base)def generate_dialogue(text: str, intro_instructions: str, text_instructions: str, scratch_pad_instructions: str, prelude_dialog: str, podcast_dialog_instructions: str) -> Dialogue:"""{intro_instructions}252 unmodified lines2532542552562572582593 unmodified lines26326426526626726826925 unmodified lines295296297298299300301302303304252 unmodified linesfrom functools import wrapsdef conditional_llm(model, api_base=None, api_key=None):"""Conditionally apply the @llm decorator based on the api_base parameter.If api_base is provided, it applies the @llm decorator with api_base.3 unmodified linesif api_base:return llm(model=model, api_base=api_base)(func)else:return llm(model=model, api_key=api_key)(func)return decoratordef generate_audio(25 unmodified lines# Configure the LLM based on selected model and api_base@retry(retry=retry_if_exception_type(ValidationError))@conditional_llm(model=text_model, api_base=api_base, api_key=openai_api_key)def generate_dialogue(text: str, intro_instructions: str, text_instructions: str, scratch_pad_instructions: str,prelude_dialog: str, podcast_dialog_instructions: str,) -> Dialogue:"""{intro_instructions}
app.py+6-4