{"id":14964837,"url":"https://github.com/itspreto/baby-code","last_synced_at":"2025-10-25T10:30:42.732Z","repository":{"id":183955672,"uuid":"669937774","full_name":"itsPreto/baby-code","owner":"itsPreto","description":"100% Private \u0026 Simple. OSS       🐍 Code Interpreter for LLMs 🦙 ","archived":false,"fork":false,"pushed_at":"2023-08-29T20:07:39.000Z","size":5757,"stargazers_count":34,"open_issues_count":3,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-30T00:52:25.499Z","etag":null,"topics":["flask","html","langchain-python","llama2","llamacpp","python3"],"latest_commit_sha":null,"homepage":"https://github.com/itsPreto/baby-code","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itsPreto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-23T23:10:24.000Z","updated_at":"2024-04-03T07:07:04.000Z","dependencies_parsed_at":"2024-08-09T22:10:40.029Z","dependency_job_id":null,"html_url":"https://github.com/itsPreto/baby-code","commit_stats":{"total_commits":974,"total_committers":274,"mean_commits":"3.5547445255474455","dds":0.7197125256673511,"last_synced_commit":"1783c7ff40adb909bb7b82ab6ad2ea4edb400ca0"},"previous_names":["itspreto/baby-code"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsPreto%2Fbaby-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsPreto%2Fbaby-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsPreto%2Fbaby-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsPreto%2Fbaby-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsPreto","download_url":"https://codeload.github.com/itsPreto/baby-code/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238120376,"owners_count":19419761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","html","langchain-python","llama2","llamacpp","python3"],"created_at":"2024-09-24T13:33:50.972Z","updated_at":"2025-10-25T10:30:42.287Z","avatar_url":"https://github.com/itsPreto.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# baby-code\nA simple and 100% Local, Open-Source Code 🐍 Interpreter for 🦙 LLMs\n\n## Baby Llama is:\n- [x] powered by [Llama.cpp](https://github.com/ggerganov/llama.cpp)\n- [x] extremly SIMPLE \u0026 100% LOCAL\n- [x] CROSS-PLATFORM.\n\nhttps://github.com/itsPreto/baby-code/assets/45348368/a5319303-aa97-4c01-9e91-7d3f03514139\n\nLeveraging [open source gguf models](https://huggingface.co/models?search=gguf) and powered by llama.cpp this project is a humble foundation for enabling LLMs to act as Code Interpreters.\n\n## 🏗️ Architecture (in a nutshell)\n\n- 🖥️ **_Backend_**: Python Flask (CORS for serving both the API and the HTML).\n- 🌐 **_Frontend_**: HTML/JS/CSS (I'm not a frontend dev but gave it my best shot-- prolly tons of issues).\n- ⚙️ **_Engine_**: Llama.cpp: An inference library for `ggml/gguf` models).\n- 🧠 **_Model_**: [GGUF](https://github.com/ggerganov/llama.cpp#description) format (replacing the retired `ggml` format).\n\n## 🦙 Features\n- 🎊 Confetti:3\n- 💬 Contextual Conversations: Models are augmented with the ongoing context of the conversation-- allowing them to remember and refer back to previous parts of it.\n- 🔄 Dynamic Code Interaction: Copy, Diff, Edit, Save and Run the generated Python scripts right from the chat.\n- 🐞 Auto-Debugging \u0026 🏃 Auto-Run: Allow the model to automatically debug and execute any attempts at fixing issue on the fly (_it will die trying_).\n- 📊 Inference \u0026 Performance Metrics: Stay informed about how fast the model is processing your requests and tally the successful vs failed script executions.\n- ❓ Random Prompts: Not sure what to ask? Click the \"Rand\" button to randomly pick from a pre-defined prompt list!\n\n## 🚀 Getting Started ⚠️ IMPORTANT ⚠️ \n\n- This project is dependent on its submodule `llama.cpp` and relies on its successful build.\n- First, clone the repo:\n\n```bash\ngit clone --recurse-submodules https://github.com/itsPreto/baby-code\n```\n\n-  Navigate to the llama.cpp submodule:\n\n```bash\ncd baby-code/llama.cpp\n```\n\n- Install the required libraries:\n\n```bash\npip install -r requirements.txt\n```\n\n- Then repeat the same for the root project:\n```bash\ncd baby-code \u0026\u0026 pip install -r requirements.txt\n```\n\n## 🏗️ Build llama.cpp\n\nIn order to build llama.cpp you have three different options.\n\n- Using `make`:\n  - On Linux or MacOS:\n\n      ```bash\n      make\n      ```\n\n  - On Windows:\n\n    1. Download the latest fortran version of [w64devkit](https://github.com/skeeto/w64devkit/releases).\n    2. Extract `w64devkit` on your pc.\n    3. Run `w64devkit.exe`.\n    4. Use the `cd` command to reach the `llama.cpp` folder.\n    5. From here you can run:\n        ```bash\n        make\n        ```\n\n- Using `CMake`:\n\n    ```bash\n    mkdir build\n    cd build\n    cmake ..\n    cmake --build . --config Release\n    ```\n\n### Build Alternatives [Metal](https://github.com/ggerganov/llama.cpp#metal-build), [Intel Mlk](https://github.com/ggerganov/llama.cpp#intel-mkl), [MPI](https://github.com/ggerganov/llama.cpp#mpi-build), [BLIS](https://github.com/ggerganov/llama.cpp/blob/master/docs/BLIS.md) [cuBLAS](https://github.com/ggerganov/llama.cpp#cublas), [clBLAST](https://github.com/ggerganov/llama.cpp#clblast), [OpenBLAS](https://github.com/ggerganov/llama.cpp#openblas), and [hipBLAS](https://github.com/ggerganov/llama.cpp#openblas).\n\n## 💾 Model Download\n\n- [TheBloke/WizardCoder-Python-13B-V1.0-GGUF](https://huggingface.co/TheBloke/WizardCoder-Python-13B-V1.0-GGUF) is a friendly, [gpu] budget model.\n- You may also download any other models supported by llama.cpp, of any parameter size of your choosing.\n- Keep in mind that the paramters might need to be tuned for your specific case:\n\n## 🧠 Model Config\nLoad up your chosen model `gguf` for local inference using CPU or GPU by simply placing it in the `llama.cpp/models` folder and edit the `baby_code.py` init config below:\n\n```python\nif __name__ == '__main__':\n    # Run the external command\n    server_process = subprocess.Popen(\n        [\"./llama.cpp/server\", \"-m\", \"./llama.cpp/models/wizardcoder-python-13b-v1.0.Q5_K_M.gguf\", \"-c\", \"1024\",\n         \"-ngl\", \"1\", \"--path\", \".\"])\n    # Pause for 5 seconds\n    time.sleep(5)\n    app.run(args.host, port=args.port)\n```\n\nYou may also want to customize \u0026 configure the flask server at the top of the file, like so:\n\n```python\nparser = argparse.ArgumentParser(description=\"An example of using server.cpp with a similar API to OAI. It must be used together with server.cpp.\")\nparser.add_argument(\"--stop\", type=str, help=\"the end of response in chat completions(default: '\u003c/s\u003e')\", default=\"\u003c/s\u003e\")\nparser.add_argument(\"--llama-api\", type=str, help=\"Set the address of server.cpp in llama.cpp(default: http://127.0.0.1:8080)\", default='http://127.0.0.1:8080')\nparser.add_argument(\"--api-key\", type=str, help=\"Set the api key to allow only few user(default: NULL)\", default=\"\")\nparser.add_argument(\"--host\", type=str, help=\"Set the ip address to listen.(default: 127.0.0.1)\", default='127.0.0.1')\nparser.add_argument(\"--port\", type=int, help=\"Set the port to listen.(default: 8081)\", default=8081)\n```\n\n## 🏃‍♀️ Run it\n- From the project `root` simply run:\n```bash\npython3 baby_code.py\n```\n\nThe `server.cpp` will be served to `http://127.0.0.1:8080/` by default, while the the Flask (`baby_code.py`) currently listens on port 8081.\n\n## 🤝 Contributing\n\u003e Contributions to this project are welcome. Please create a fork of the repository, make your changes, and submit a pull\nrequest.\n\u003e I'll be creating a few issues for feature tracking soon!!\n\u003e\n\u003e ALSO~ If anyone would like to start a Discord channel and help me manage it that would be awesome\n\u003e\n\u003e _(I'm not on it that much)_.\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitspreto%2Fbaby-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitspreto%2Fbaby-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitspreto%2Fbaby-code/lists"}