Are we tiny?#
gptme is intended to be small and simple, and focus on doing the right thing in the right way, rather than all the things in all the ways.
The benefits of this approach are many:
It is easier to understand and maintain.
It is easier to contribute to.
It is easier to learn.
It is easier to extend.
It is more fun to work on.
Being aggressive about keeping things small and simple is a way to keep the project maintainable and fun to work on. The fastest way to kill a project is to make it too big and complex, and suffer burnout as a result.
Another major benefit of keeping things small and simple is that it makes it easier for AI to understand and work with the codebase. This is a major goal of the project, and it is important to keep in mind that the simpler the codebase is, the easier it will be for AI to work with it:
“The simpler your API is, the more effectively the AI can harness it when generating code.”
—Kenneth Reitz (and many others)
To that end, in this document we will present some statistics about the current state of the project, trying to be mindful to keep an eye on this page and make sure we are not growing too much.
Startup time#
$ make bench-importtime
...
210323 | openai.types
256732 | gptme.chat
384260 | openai
397223 | gptme.cli
450766 | gptme
real 0m1.384s
user 0m1.197s
sys 0m0.201s
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
Lines of code#
LoC Core#
$ make cloc-core
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/*.py gptme/llm/*.py gptme/util/*.py gptme/tools/__init__.py gptme/tools/base.py --by-file
github.com/AlDanial/cloc v 1.98 T=0.05 s (667.2 files/s, 143108.1 lines/s)
---------------------------------------------------------------------------------
File blank comment code
---------------------------------------------------------------------------------
gptme/llm/llm_anthropic.py 86 65 359
gptme/tools/base.py 89 77 349
gptme/llm/llm_openai.py 84 44 340
gptme/chat.py 66 99 328
gptme/logmanager.py 74 66 326
gptme/cli.py 56 50 293
gptme/util/prompt.py 74 94 284
gptme/ncurses.py 39 5 238
gptme/message.py 55 65 225
gptme/llm/__init__.py 48 40 218
gptme/commands.py 18 18 205
gptme/util/context.py 49 59 201
gptme/util/ask_execute.py 47 44 189
gptme/llm/models.py 26 15 183
gptme/util/__init__.py 39 22 171
gptme/util/cli.py 48 28 161
gptme/prompts.py 56 81 149
gptme/tools/__init__.py 44 17 136
gptme/llm/llm_openai_models.py 3 9 132
gptme/config.py 32 13 108
gptme/util/export.py 17 25 86
gptme/init.py 25 19 76
gptme/util/reduce.py 24 32 74
gptme/util/generate_name.py 5 6 69
gptme/codeblock.py 13 10 64
gptme/__version__.py 9 7 45
gptme/util/cost.py 12 20 42
gptme/util/clipboard.py 8 2 35
gptme/wut.py 13 12 31
gptme/dirs.py 17 6 27
gptme/util/useredit.py 12 13 21
gptme/util/interrupt.py 13 14 20
gptme/constants.py 7 11 13
gptme/__init__.py 1 0 8
gptme/__main__.py 1 0 3
---------------------------------------------------------------------------------
SUM: 1210 1088 5209
---------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC LLM#
$ make cloc-llm
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/llm/*.py --by-file
github.com/AlDanial/cloc v 1.98 T=0.02 s (325.7 files/s, 107608.1 lines/s)
---------------------------------------------------------------------------------
File blank comment code
---------------------------------------------------------------------------------
gptme/llm/llm_anthropic.py 86 65 359
gptme/llm/llm_openai.py 84 44 340
gptme/llm/__init__.py 48 40 218
gptme/llm/models.py 26 15 183
gptme/llm/llm_openai_models.py 3 9 132
---------------------------------------------------------------------------------
SUM: 247 173 1232
---------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Tools#
$ make cloc-tools
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/tools/*.py --by-file
github.com/AlDanial/cloc v 1.98 T=0.03 s (651.6 files/s, 132732.9 lines/s)
-------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------
gptme/tools/base.py 89 77 349
gptme/tools/shell.py 74 68 317
gptme/tools/tts.py 81 75 231
gptme/tools/tmux.py 52 72 211
gptme/tools/patch.py 43 55 186
gptme/tools/_browser_playwright.py 60 20 180
gptme/tools/python.py 56 49 172
gptme/tools/save.py 32 38 167
gptme/tools/computer.py 55 84 157
gptme/tools/__init__.py 44 17 136
gptme/tools/subagent.py 37 29 102
gptme/tools/_browser_thread.py 20 3 97
gptme/tools/chats.py 32 34 93
gptme/tools/rag.py 44 47 92
gptme/tools/browser.py 31 63 64
gptme/tools/_browser_lynx.py 9 13 30
gptme/tools/screenshot.py 11 8 27
gptme/tools/youtube.py 10 1 26
gptme/tools/gh.py 14 21 16
gptme/tools/vision.py 8 7 15
gptme/tools/read.py 6 8 13
-------------------------------------------------------------------------------------
SUM: 808 789 2681
-------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Server#
$ make cloc-server
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/server --by-file
github.com/AlDanial/cloc v 1.98 T=0.01 s (733.2 files/s, 108606.1 lines/s)
------------------------------------------------------------------------------------
File blank comment code
------------------------------------------------------------------------------------
gptme/server/static/main.js 35 45 316
gptme/server/api.py 53 35 181
gptme/server/static/index.html 11 15 148
gptme/server/static/style.css 27 4 143
gptme/server/static/computer.html 1 1 90
gptme/server/cli.py 8 5 55
gptme/server/__init__.py 2 3 3
gptme/server/__main__.py 1 0 3
------------------------------------------------------------------------------------
SUM: 138 108 939
------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Tests#
$ make cloc-tests
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc tests --by-file
github.com/AlDanial/cloc v 1.98 T=0.03 s (1146.3 files/s, 115662.5 lines/s)
------------------------------------------------------------------------------------------
File blank comment code
------------------------------------------------------------------------------------------
tests/test_cli.py 77 41 285
tests/test_llm_openai.py 27 1 175
tests/test_llm_anthropic.py 19 0 148
tests/test_tool_use.py 8 18 127
tests/test_prompt.py 35 36 120
tests/test_util_cli.py 32 23 94
tests/test_server.py 28 10 83
tests/test_shell.py 27 47 82
tests/test_tools.py 48 6 82
tests/test_prompt_tools.py 5 4 78
tests/test_context.py 18 13 58
tests/test_tools_patch.py 36 91 54
tests/test_eval.py 8 9 47
tests/test-integration.sh 22 36 43
tests/test_message.py 7 17 39
tests/test_reduce.py 10 2 39
tests/test_codeblock.py 14 40 37
tests/test_util.py 28 51 37
tests/conftest.py 13 6 36
tests/test_chat.py 17 28 34
tests/test_tools_rag.py 14 7 34
tests/test_tools_tts.py 21 30 34
tests/test_tools_python.py 19 1 26
tests/test_browser.py 13 14 19
tests/test_logmanager.py 8 5 18
tests/test_prompts.py 8 1 16
tests/test_tools_chats.py 2 0 13
tests/test_tools_shell.py 9 11 13
tests/test_tools_subagent.py 7 10 11
tests/test_config.py 2 0 5
------------------------------------------------------------------------------------------
SUM: 582 558 1887
------------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Eval#
$ make cloc-eval
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/eval/**.py --by-file
github.com/AlDanial/cloc v 1.98 T=0.01 s (617.6 files/s, 78894.6 lines/s)
-------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------
gptme/eval/main.py 54 21 331
gptme/eval/run.py 48 32 279
gptme/eval/agents.py 12 5 56
gptme/eval/execenv.py 10 14 55
gptme/eval/filestore.py 5 2 32
gptme/eval/types.py 13 12 32
gptme/eval/__init__.py 1 0 4
gptme/eval/__main__.py 1 0 3
-------------------------------------------------------------------------------------
SUM: 144 86 792
-------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Total#
$ make cloc-total
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/eval/run.py gptme/eval/types.py gptme/eval/agents.py gptme/eval/execenv.py gptme/eval/__init__.py gptme/eval/__main__.py gptme/eval/filestore.py gptme/eval/main.py gptme/eval/suites/init_projects.py gptme/eval/suites/__init__.py gptme/eval/suites/basic.py gptme/eval/suites/browser.py gptme/init.py gptme/logmanager.py gptme/tools/youtube.py gptme/tools/screenshot.py gptme/tools/subagent.py gptme/tools/python.py gptme/tools/save.py gptme/tools/shell.py gptme/tools/tmux.py gptme/tools/patch.py gptme/tools/_browser_thread.py gptme/tools/__init__.py gptme/tools/base.py gptme/tools/rag.py gptme/tools/computer.py gptme/tools/vision.py gptme/tools/gh.py gptme/tools/read.py gptme/tools/chats.py gptme/tools/browser.py gptme/tools/tts.py gptme/tools/_browser_lynx.py gptme/tools/_browser_playwright.py gptme/util/prompt.py gptme/util/context.py gptme/util/ask_execute.py gptme/util/__init__.py gptme/util/interrupt.py gptme/util/clipboard.py gptme/util/cost.py gptme/util/cli.py gptme/util/generate_name.py gptme/util/export.py gptme/util/reduce.py gptme/util/useredit.py gptme/__init__.py gptme/server/api.py gptme/server/__init__.py gptme/server/__main__.py gptme/server/cli.py gptme/__main__.py gptme/llm/__init__.py gptme/llm/llm_openai.py gptme/llm/models.py gptme/llm/llm_anthropic.py gptme/llm/llm_openai_models.py gptme/wut.py gptme/prompts.py gptme/message.py gptme/codeblock.py gptme/constants.py gptme/dirs.py gptme/config.py gptme/ncurses.py gptme/cli.py gptme/chat.py gptme/commands.py gptme/__version__.py tests/test_context.py tests/test_reduce.py tests/test_util.py tests/test_tools_chats.py tests/test_tools_python.py tests/test_tools_rag.py tests/test_tools_tts.py tests/test_tools_patch.py tests/test_tools_shell.py tests/test_eval.py tests/test_prompts.py tests/test_server.py tests/test_codeblock.py tests/test_prompt_tools.py tests/test_prompt.py tests/test_config.py tests/test_tools_subagent.py tests/test_llm_anthropic.py tests/test_browser.py tests/test_tools.py tests/test_llm_openai.py tests/test_message.py tests/test_chat.py tests/test_shell.py tests/test_tool_use.py tests/conftest.py tests/test_cli.py tests/test_logmanager.py tests/test_util_cli.py scripts/list_user_messages.py scripts/train/collect.py scripts/shorten_details.py scripts/treeofthoughts.py scripts/summarize_project.py scripts/describe_api.py scripts/gpt_todoer.py --by-file
github.com/AlDanial/cloc v 1.98 T=0.11 s (954.8 files/s, 147171.7 lines/s)
-------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------
gptme/llm/llm_anthropic.py 86 65 359
gptme/tools/base.py 89 77 349
gptme/llm/llm_openai.py 84 44 340
gptme/eval/main.py 54 21 331
gptme/chat.py 66 99 328
gptme/logmanager.py 74 66 326
gptme/tools/shell.py 74 68 317
gptme/cli.py 56 50 293
tests/test_cli.py 77 41 285
gptme/util/prompt.py 74 94 284
gptme/eval/run.py 48 32 279
gptme/ncurses.py 39 5 238
gptme/tools/tts.py 81 75 231
gptme/message.py 55 65 225
gptme/llm/__init__.py 48 40 218
gptme/tools/tmux.py 52 72 211
gptme/commands.py 18 18 205
gptme/util/context.py 49 59 201
gptme/util/ask_execute.py 47 44 189
gptme/tools/patch.py 43 55 186
gptme/llm/models.py 26 15 183
gptme/server/api.py 53 35 181
gptme/tools/_browser_playwright.py 60 20 180
tests/test_llm_openai.py 27 1 175
gptme/tools/python.py 56 49 172
gptme/util/__init__.py 39 22 171
gptme/tools/save.py 32 38 167
gptme/util/cli.py 48 28 161
gptme/tools/computer.py 55 84 157
gptme/prompts.py 56 81 149
tests/test_llm_anthropic.py 19 0 148
gptme/tools/__init__.py 44 17 136
gptme/llm/llm_openai_models.py 3 9 132
tests/test_tool_use.py 8 18 127
tests/test_prompt.py 35 36 120
gptme/config.py 32 13 108
scripts/gpt_todoer.py 47 25 107
scripts/train/collect.py 34 52 103
gptme/tools/subagent.py 37 29 102
gptme/tools/_browser_thread.py 20 3 97
scripts/treeofthoughts.py 33 35 95
tests/test_util_cli.py 32 23 94
gptme/tools/chats.py 32 34 93
gptme/tools/rag.py 44 47 92
gptme/util/export.py 17 25 86
tests/test_server.py 28 10 83
tests/test_shell.py 27 47 82
tests/test_tools.py 48 6 82
tests/test_prompt_tools.py 5 4 78
gptme/init.py 25 19 76
gptme/util/reduce.py 24 32 74
gptme/util/generate_name.py 5 6 69
gptme/codeblock.py 13 10 64
gptme/tools/browser.py 31 63 64
tests/test_context.py 18 13 58
gptme/eval/agents.py 12 5 56
gptme/eval/execenv.py 10 14 55
gptme/eval/suites/basic.py 15 1 55
gptme/eval/suites/init_projects.py 21 1 55
gptme/server/cli.py 8 5 55
scripts/describe_api.py 28 25 54
tests/test_tools_patch.py 36 91 54
tests/test_eval.py 8 9 47
gptme/__version__.py 9 7 45
gptme/util/cost.py 12 20 42
tests/test_message.py 7 17 39
tests/test_reduce.py 10 2 39
tests/test_codeblock.py 14 40 37
tests/test_util.py 28 51 37
tests/conftest.py 13 6 36
gptme/util/clipboard.py 8 2 35
tests/test_chat.py 17 28 34
tests/test_tools_rag.py 14 7 34
tests/test_tools_tts.py 21 30 34
scripts/shorten_details.py 11 6 33
gptme/eval/filestore.py 5 2 32
gptme/eval/types.py 13 12 32
scripts/list_user_messages.py 10 9 32
gptme/wut.py 13 12 31
gptme/tools/_browser_lynx.py 9 13 30
gptme/dirs.py 17 6 27
gptme/tools/screenshot.py 11 8 27
gptme/tools/youtube.py 10 1 26
scripts/summarize_project.py 11 1 26
tests/test_tools_python.py 19 1 26
gptme/util/useredit.py 12 13 21
gptme/util/interrupt.py 13 14 20
gptme/eval/suites/__init__.py 3 0 19
tests/test_browser.py 13 14 19
tests/test_logmanager.py 8 5 18
gptme/eval/suites/browser.py 5 0 16
gptme/tools/gh.py 14 21 16
tests/test_prompts.py 8 1 16
gptme/tools/vision.py 8 7 15
gptme/constants.py 7 11 13
gptme/tools/read.py 6 8 13
tests/test_tools_chats.py 2 0 13
tests/test_tools_shell.py 9 11 13
tests/test_tools_subagent.py 7 10 11
gptme/__init__.py 1 0 8
tests/test_config.py 2 0 5
gptme/eval/__init__.py 1 0 4
gptme/__main__.py 1 0 3
gptme/eval/__main__.py 1 0 3
gptme/server/__init__.py 2 3 3
gptme/server/__main__.py 1 0 3
-------------------------------------------------------------------------------------
SUM: 2871 2589 10878
-------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'