OpenCodeInterpreter

Stale
GitHub Python Apache-2.0

Description

Open-source code generation system that integrates code synthesis, dynamic execution, and iterative refinement, comparable to GPT-4 Code Interpreter.

Key Features

  • Closed-loop code generation and execution — LLM writes code, sandbox runs it, errors feed back to the model
  • Iterative refinement — model self-fixes based on execution errors until tests pass
  • Multi-language support — code generation and execution for Python, JavaScript, Shell, and more
  • Open datasets — ships the Code-Feedback dataset for training code-debugging models
  • Full model family — OpenCodeInterpreter-DS models ranging from 6.7B to 33B parameters
  • Tooling integration — works with HuggingFace Transformers and PEFT for easy fine-tuning

Use Cases

💡 Reproduce and improve a ChatGPT Code Interpreter-style interactive coding experience.
💡 Train custom code generation or debugging models via the Code-Feedback dataset.
💡 Data science: let the model directly execute pandas/numpy code and explain the results.
💡 DevOps: have the model write scripts and run them in a sandbox for instant feedback.

Quick Start

# Install
pip install opencodeinterpreter
# Interactive chat
from opencodeinterpreter import interpreter
interpreter.auto_run = True
interpreter.chat('Read /data/sales.csv and plot the 2024 monthly sales trend')

Related Projects