Update app.py
Browse files86 unmodified lines878889909191929392939495969798999610010110210310492 unmodified lines19719819919519620020120220386 unmodified lines logging.info(f"System Prompt: {system_prompt}")
try: full_response = "" for main_content, sources in get_response_with_search(message, model, num_calls=num_calls, temperature=temperature, use_embeddings=use_embeddings, system_prompt=system_prompt): response = f"{main_content}\n\n{sources}" first_line = response.split('\n')[0] if response else '' yield response full_response += main_content yield history + [(message, full_response)] if sources: full_response += f"\n\nSources:\n{sources}" yield history + [(message, full_response)] except Exception as e: logging.error(f"Error with {model}: {str(e)}") yield f"An error occurred with the {model} model: {str(e)}. Please try again or select a different model." error_message = f"An error occurred with the {model} model: {str(e)}. Please try again or select a different model." yield history + [(message, error_message)]
def create_web_search_vectors(search_results): embed = get_embeddings()92 unmodified lines"""
demo = gr.ChatInterface( fn=lambda message, system_prompt, history, model, temperature, num_calls, use_embeddings: respond(message, system_prompt, history, model, temperature, num_calls, use_embeddings), additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=True, render=False), fn=respond, additional_inputs=[ gr.Textbox(label="System Prompt", lines=5, value=DEFAULT_SYSTEM_PROMPT), gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[3]),app.py+10-6