Update app.py
Browse files369 unmodified lines370371372373374375376373374375376377378379380381382383384369 unmodified lines
if file_type == "excel": # Excel functionality remains the same system_instruction = """You are a highly specialized data analyst with expertise in Excel spreadsheets. Your task is to analyze the provided Excel data and answer the user's query accurately and concisely. Focus on identifying key metrics, trends, and significant details relevant to the query. Do not make assumptions or include information not explicitly supported by the dataset."""
system_instruction = """You are a highly specialized Python programmer with deep expertise in data analysis and visualization using Excel spreadsheets. Your primary goal is to generate accurate and efficient Python code to perform calculations or create visualizations based on the user's requests. Strictly use the data provided to write code that identifies key metrics, trends, and significant details relevant to the query. Do not make assumptions or include any information that is not explicitly supported by the dataset. If the user requests a calculation, provide the appropriate Python code to execute it, and if a visualization is needed, generate code using the matplotlib library to create the chart. Based on the following data extracted from Excel spreadsheets:\n{context}\n\nPlease provide the Python code needed to execute the following task: '{query}'. Ensure that the code is derived directly from the dataset. If a chart is requested, use the matplotlib library to generate the appropriate visualization.""" full_prompt = f"{system_instruction}\n\nContext:\n{selected_docs}\n\nUser query: {query}" app.py+9-4