Spaces:
Runtime error
Runtime error
Update app.py
Browse files86 unmodified lines8788899091929394959697989992 unmodified lines19219319419519619719819986 unmodified lineslogging.info(f"System Prompt: {system_prompt}")try: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 responseexcept 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."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),additional_inputs=[gr.Textbox(label="System Prompt", lines=5, value=DEFAULT_SYSTEM_PROMPT),gr.Dropdown(choices=MODELS, label="Select Model", value=MODELS[3]),86 unmodified lines8788899091929394959697989910010110210310492 unmodified lines19719819920020120220386 unmodified lineslogging.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):full_response += main_contentyield 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)}")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=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