Code Interpreter
Code Interpreter lets you run Python directly inside Le Chat.
Not a developer? No problem. Describe what you want in plain language, and Le Chat generates and executes the code for you.
Code runs in a secure, isolated environment with no internet access. It cannot reach your system or external services. Common data-analysis packages are preinstalled (pandas, numpy, matplotlib). Uploaded files are available for the current conversation only.
Common use cases
Code Interpreter combines the versatility of Le Chat with the precision of Python. It's perfect for:
- Data analysis: explore CSV, XLSX, or JSON files. Summarize, filter, flag outliers, or clean missing values.
- Charts and visuals: generate line charts, bar charts, pie charts, or any Matplotlib visualization from your data.
- Calculations: work through formulas, financial models, or unit conversions with verified accuracy.
- File transformations: convert formats, merge datasets, or export processed results as downloadable files.
Activation
Code Interpreter must be enabled before Le Chat can use it.
- Click the
+icon or type/in the chat window. - Select
Toolsthen enableCode Interpreter.
The tool stays active for the duration of the conversation and subsequent chats.
Code Interpreter usage is subject to rate limits based on your plan. For details, visit our pricing page.
Running code
Describe what you want in plain language and Le Chat writes and executes the Python code for you.
Load this CSV and show the top 5 rows, then plot sales by month.The code runs in the sandbox and returns tables, figures, or files inline. You can follow up to refine results, adjust filters, or ask for explanations of what the code does.
Code Interpreter cannot fetch files directly from URLs. If your data is online, download it locally and upload the file. Alternatively, enable Web search and ask Le Chat to fetch the data before running code.
Working with files
Upload files using the + button in the chat toolbar. Supported formats include:
- Documents: PDF, Word (
.docx,.doc), PowerPoint (.pptx,.ppt), ODT, EPUB, RTF - Spreadsheets: Excel (
.xlsx,.xls), CSV, ODS, Numbers - Images: PNG, JPEG, WebP, GIF
- Text and markup: TXT, Markdown, RST, LaTeX
- Data formats: JSON, JSONL, XML, YAML
- Code files: Python, JavaScript/TypeScript, Java, Go, Rust, C/C++, Ruby, PHP, SQL, and many more
- Email: EML, MSG
Typical prompts:
- "Summarize this spreadsheet and flag outliers."
- "Clean this CSV, fix missing values, and export a new file."
- "Extract all emails from this PDF and give me a CSV."
For details and advanced workflows, see the Files Upload article.
Tips for better results
- Be specific. For charts or tables, specify column names, filters, and the desired output format.
- Ask for explanations. Try "Explain the steps and show the code" to understand what's happening.
- Iterate. Follow up with requests to fine-tune the output (e.g., "Now add a rolling average and label the axes.")
- Prototype with smaller files. If you hit a limit, upload a sample to test your approach, then scale up.
- Avoid sharing secrets. Never share API keys or credentials in the chat or in code.
- Canvas: edit and refine code, data, and text in a side-by-side editor.
- Files upload: import documents, spreadsheets, and images into your conversation.
- Chat: the conversation interface where Code Interpreter runs.