├── .github └── workflows │ ├── llm.yaml │ ├── strip-tags.yaml │ ├── symbex.yaml │ └── ttok.yaml ├── Formula ├── llm.rb ├── strip-tags.rb ├── symbex.rb └── ttok.rb └── README.md /.github/workflows/llm.yaml: -------------------------------------------------------------------------------- 1 | name: Publish llm 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | regenerate: 11 | runs-on: macos-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Create a fresh virtual environment and generate formula 15 | run: | 16 | python3 -m venv venv 17 | source venv/bin/activate 18 | venv/bin/pip install llm homebrew-pypi-poet 19 | poet -f llm > Formula/llm.rb 20 | deactivate 21 | rm -rf venv 22 | - name: Replace description and test 23 | run: | 24 | python3 -c " 25 | import re 26 | content = open('Formula/llm.rb').read() 27 | content = re.sub(r'desc \"Shiny new formula\"', 'desc \"Access large language models from the command-line\"', content) 28 | content = content.replace('depends_on \"python3\"', ( 29 | 'depends_on \"python3\"\n' 30 | ' # Needed by pydantic:\\n' 31 | ' depends_on \"rust\" => :build\\n' 32 | )) 33 | content = re.sub( 34 | r'test do.*?end', 35 | 'test do\\n assert_match \"llm, version\", shell_output(\"#{bin}/llm --version\")\\n end', 36 | content, 37 | flags=re.DOTALL 38 | ) 39 | open('Formula/llm.rb', 'w').write(content) 40 | " 41 | cat Formula/llm.rb 42 | - name: Commit and push 43 | run: |- 44 | git config user.name "Automated" 45 | git config user.email "actions@users.noreply.github.com" 46 | git add -A 47 | timestamp=$(date -u) 48 | git commit -m "Update formula: ${timestamp}" || exit 0 49 | git pull --rebase 50 | git push 51 | -------------------------------------------------------------------------------- /.github/workflows/strip-tags.yaml: -------------------------------------------------------------------------------- 1 | name: Publish strip-tags 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | regenerate: 11 | runs-on: macos-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Create a fresh virtual environment and generate formula 15 | run: | 16 | python3 -m venv venv 17 | source venv/bin/activate 18 | venv/bin/pip install strip-tags homebrew-pypi-poet 19 | poet -f strip-tags > Formula/strip-tags.rb 20 | deactivate 21 | rm -rf venv 22 | - name: Replace description and test 23 | run: | 24 | python3 -c " 25 | import re 26 | content = open('Formula/strip-tags.rb').read() 27 | content = re.sub(r'desc \"Shiny new formula\"', 'desc \"CLI tool for stripping tags from HTML\"', content) 28 | content = re.sub( 29 | r'test do.*?end', 30 | 'test do\\n assert_match \"strip-tags, version\", shell_output(\"#{bin}/strip-tags --version\")\\n end', 31 | content, 32 | flags=re.DOTALL 33 | ) 34 | open('Formula/strip-tags.rb', 'w').write(content) 35 | " 36 | cat Formula/strip-tags.rb 37 | - name: Commit and push 38 | run: |- 39 | git config user.name "Automated" 40 | git config user.email "actions@users.noreply.github.com" 41 | git add -A 42 | timestamp=$(date -u) 43 | git commit -m "Update strip-tags: ${timestamp}" || exit 0 44 | git pull --rebase 45 | git push 46 | -------------------------------------------------------------------------------- /.github/workflows/symbex.yaml: -------------------------------------------------------------------------------- 1 | name: Publish symbex 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | regenerate: 11 | runs-on: macos-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Create a fresh virtual environment and generate formula 15 | run: | 16 | python3 -m venv venv 17 | source venv/bin/activate 18 | venv/bin/pip install symbex homebrew-pypi-poet 19 | poet -f symbex > Formula/symbex.rb 20 | deactivate 21 | rm -rf venv 22 | - name: Replace description and test 23 | run: | 24 | python3 -c " 25 | import re 26 | content = open('Formula/symbex.rb').read() 27 | content = re.sub(r'desc \"Shiny new formula\"', 'desc \"Find the Python code for specified symbols\"', content) 28 | content = re.sub( 29 | r'test do.*?end', 30 | 'test do\\n assert_match \"symbex, version\", shell_output(\"#{bin}/symbex --version\")\\n end', 31 | content, 32 | flags=re.DOTALL 33 | ) 34 | open('Formula/symbex.rb', 'w').write(content) 35 | " 36 | cat Formula/symbex.rb 37 | - name: Commit and push 38 | run: |- 39 | git config user.name "Automated" 40 | git config user.email "actions@users.noreply.github.com" 41 | git add -A 42 | timestamp=$(date -u) 43 | git commit -m "Update symbex: ${timestamp}" || exit 0 44 | git pull --rebase 45 | git push 46 | -------------------------------------------------------------------------------- /.github/workflows/ttok.yaml: -------------------------------------------------------------------------------- 1 | name: Publish ttok 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | permissions: 7 | contents: write 8 | 9 | jobs: 10 | regenerate: 11 | runs-on: macos-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - name: Create a fresh virtual environment and generate formula 15 | run: | 16 | python3 -m venv venv 17 | source venv/bin/activate 18 | venv/bin/pip install ttok homebrew-pypi-poet 19 | poet -f ttok > Formula/ttok.rb 20 | deactivate 21 | rm -rf venv 22 | - name: Replace description and test and depends 23 | run: | 24 | python3 -c " 25 | import re 26 | content = open('Formula/ttok.rb').read() 27 | content = re.sub(r'desc \"Shiny new formula\"', 'desc \"Count and truncate text based on tokens\"', content) 28 | content = content.replace('depends_on \"python3\"', ( 29 | 'depends_on \"python3\"\n' 30 | ' # To build tiktoken:\\n' 31 | ' depends_on \"pkg-config\" => :build\\n' 32 | ' depends_on \"rust\" => :build\\n' 33 | )) 34 | content = re.sub( 35 | r'test do.*?end', 36 | 'test do\\n assert_match \"ttok, version\", shell_output(\"#{bin}/ttok --version\")\\n end', 37 | content, 38 | flags=re.DOTALL 39 | ) 40 | open('Formula/ttok.rb', 'w').write(content) 41 | " 42 | cat Formula/ttok.rb 43 | - name: Commit and push 44 | run: |- 45 | git config user.name "Automated" 46 | git config user.email "actions@users.noreply.github.com" 47 | git add -A 48 | timestamp=$(date -u) 49 | git commit -m "Update ttok: ${timestamp}" || exit 0 50 | git pull --rebase 51 | git push 52 | -------------------------------------------------------------------------------- /Formula/llm.rb: -------------------------------------------------------------------------------- 1 | class Llm < Formula 2 | include Language::Python::Virtualenv 3 | 4 | desc "Access large language models from the command-line" 5 | homepage "https://github.com/simonw/llm" 6 | url "https://files.pythonhosted.org/packages/64/a3/24218c5cdada7e9eac5425bb702d734605d2f16bf8450c3a81571dd34558/llm-0.6.tar.gz" 7 | sha256 "6226bcbb4c79affd85870a69a09a5b47aec6bc549c65b620f086253424e3410a" 8 | 9 | depends_on "python3" 10 | # Needed by pydantic: 11 | depends_on "rust" => :build 12 | 13 | 14 | resource "aiohttp" do 15 | url "https://files.pythonhosted.org/packages/d6/12/6fc7c7dcc84e263940e87cbafca17c1ef28f39dae6c0b10f51e4ccc764ee/aiohttp-3.8.5.tar.gz" 16 | sha256 "b9552ec52cc147dbf1944ac7ac98af7602e51ea2dcd076ed194ca3c0d1c7d0bc" 17 | end 18 | 19 | resource "aiosignal" do 20 | url "https://files.pythonhosted.org/packages/ae/67/0952ed97a9793b4958e5736f6d2b346b414a2cd63e82d05940032f45b32f/aiosignal-1.3.1.tar.gz" 21 | sha256 "54cd96e15e1649b75d6c87526a6ff0b6c1b0dd3459f43d9ca11d48c339b68cfc" 22 | end 23 | 24 | resource "annotated-types" do 25 | url "https://files.pythonhosted.org/packages/42/97/41ccb6acac36fdd13592a686a21b311418f786f519e5794b957afbcea938/annotated_types-0.5.0.tar.gz" 26 | sha256 "47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802" 27 | end 28 | 29 | resource "async-timeout" do 30 | url "https://files.pythonhosted.org/packages/54/6e/9678f7b2993537452710ffb1750c62d2c26df438aa621ad5fa9d1507a43a/async-timeout-4.0.2.tar.gz" 31 | sha256 "2163e1640ddb52b7a8c80d0a67a08587e5d245cc9c553a74a847056bc2976b15" 32 | end 33 | 34 | resource "attrs" do 35 | url "https://files.pythonhosted.org/packages/97/90/81f95d5f705be17872843536b1868f351805acf6971251ff07c1b8334dbb/attrs-23.1.0.tar.gz" 36 | sha256 "6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015" 37 | end 38 | 39 | resource "certifi" do 40 | url "https://files.pythonhosted.org/packages/98/98/c2ff18671db109c9f10ed27f5ef610ae05b73bd876664139cf95bd1429aa/certifi-2023.7.22.tar.gz" 41 | sha256 "539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082" 42 | end 43 | 44 | resource "charset-normalizer" do 45 | url "https://files.pythonhosted.org/packages/2a/53/cf0a48de1bdcf6ff6e1c9a023f5f523dfe303e4024f216feac64b6eb7f67/charset-normalizer-3.2.0.tar.gz" 46 | sha256 "3bb3d25a8e6c0aedd251753a79ae98a093c7e7b471faa3aa9a93a81431987ace" 47 | end 48 | 49 | resource "click" do 50 | url "https://files.pythonhosted.org/packages/72/bd/fedc277e7351917b6c4e0ac751853a97af261278a4c7808babafa8ef2120/click-8.1.6.tar.gz" 51 | sha256 "48ee849951919527a045bfe3bf7baa8a959c423134e1a5b98c05c20ba75a1cbd" 52 | end 53 | 54 | resource "click-default-group-wheel" do 55 | url "https://files.pythonhosted.org/packages/3d/da/f3bbf30f7e71d881585d598f67f4424b2cc4c68f39849542e81183218017/click-default-group-wheel-1.2.2.tar.gz" 56 | sha256 "e90da42d92c03e88a12ed0c0b69c8a29afb5d36e3dc8d29c423ba4219e6d7747" 57 | end 58 | 59 | resource "frozenlist" do 60 | url "https://files.pythonhosted.org/packages/8c/1f/49c96ccc87127682ba900b092863ef7c20302a2144b3185412a08480ca22/frozenlist-1.4.0.tar.gz" 61 | sha256 "09163bdf0b2907454042edb19f887c6d33806adc71fbd54afc14908bfdc22251" 62 | end 63 | 64 | resource "idna" do 65 | url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz" 66 | sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4" 67 | end 68 | 69 | resource "multidict" do 70 | url "https://files.pythonhosted.org/packages/4a/15/bd620f7a6eb9aa5112c4ef93e7031bcd071e0611763d8e17706ef8ba65e0/multidict-6.0.4.tar.gz" 71 | sha256 "3666906492efb76453c0e7b97f2cf459b0682e7402c0489a95484965dbc1da49" 72 | end 73 | 74 | resource "openai" do 75 | url "https://files.pythonhosted.org/packages/89/ee/84bbd0161090f0f24e8a2ac175e6b6a936289ee02e9d5da414ce14d3d332/openai-0.27.8.tar.gz" 76 | sha256 "2483095c7db1eee274cebac79e315a986c4e55207bb4fa7b82d185b3a2ed9536" 77 | end 78 | 79 | resource "pluggy" do 80 | url "https://files.pythonhosted.org/packages/8a/42/8f2833655a29c4e9cb52ee8a2be04ceac61bcff4a680fb338cbd3d1e322d/pluggy-1.2.0.tar.gz" 81 | sha256 "d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3" 82 | end 83 | 84 | resource "pydantic" do 85 | url "https://files.pythonhosted.org/packages/11/07/106b00ae62297bb3c89b6fbeb571feaf7cbbf6b2ada0e513d756daafd4ce/pydantic-2.0.3.tar.gz" 86 | sha256 "94f13e0dcf139a5125e88283fc999788d894e14ed90cf478bcc2ee50bd4fc630" 87 | end 88 | 89 | resource "pydantic-core" do 90 | url "https://files.pythonhosted.org/packages/57/ea/edff47ad42857534f3abcc87472802b3181041f4e4fbeac988a5ecfcffae/pydantic_core-2.3.0.tar.gz" 91 | sha256 "5cfb5ac4e82c47d5dc25b209dd4c3989e284b80109f9e08b33c895080c424b4f" 92 | end 93 | 94 | resource "python-dateutil" do 95 | url "https://files.pythonhosted.org/packages/4c/c4/13b4776ea2d76c115c1d1b84579f3764ee6d57204f6be27119f13a61d0a9/python-dateutil-2.8.2.tar.gz" 96 | sha256 "0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86" 97 | end 98 | 99 | resource "python-ulid" do 100 | url "https://files.pythonhosted.org/packages/e8/8b/0580d8ee0a73a3f3869488856737c429cbaa08b63c3506275f383c4771a8/python-ulid-1.1.0.tar.gz" 101 | sha256 "5fb5e4a91db8ca93e8938a613360b3def299b60d41f847279a8c39c9b2e9c65e" 102 | end 103 | 104 | resource "PyYAML" do 105 | url "https://files.pythonhosted.org/packages/cd/e5/af35f7ea75cf72f2cd079c95ee16797de7cd71f29ea7c68ae5ce7be1eda0/PyYAML-6.0.1.tar.gz" 106 | sha256 "bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43" 107 | end 108 | 109 | resource "requests" do 110 | url "https://files.pythonhosted.org/packages/9d/be/10918a2eac4ae9f02f6cfe6414b7a155ccd8f7f9d4380d62fd5b955065c3/requests-2.31.0.tar.gz" 111 | sha256 "942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1" 112 | end 113 | 114 | resource "six" do 115 | url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz" 116 | sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926" 117 | end 118 | 119 | resource "sqlite-fts4" do 120 | url "https://files.pythonhosted.org/packages/c2/6d/9dad6c3b433ab8912ace969c66abd595f8e0a2ccccdb73602b1291dbda29/sqlite-fts4-1.0.3.tar.gz" 121 | sha256 "78b05eeaf6680e9dbed8986bde011e9c086a06cb0c931b3cf7da94c214e8930c" 122 | end 123 | 124 | resource "sqlite-utils" do 125 | url "https://files.pythonhosted.org/packages/29/4d/eae906595a22c1ffa96105f6a5477cd502cc3ec1dfcabad2f5057dced4ea/sqlite-utils-3.34.tar.gz" 126 | sha256 "4607683cbb32cfd4f3c63929045eaa020ab0221c5036f9bb41b7b25bc755cd23" 127 | end 128 | 129 | resource "tabulate" do 130 | url "https://files.pythonhosted.org/packages/ec/fe/802052aecb21e3797b8f7902564ab6ea0d60ff8ca23952079064155d1ae1/tabulate-0.9.0.tar.gz" 131 | sha256 "0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c" 132 | end 133 | 134 | resource "tqdm" do 135 | url "https://files.pythonhosted.org/packages/3d/78/81191f56abb7d3d56963337dbdff6aa4f55805c8afd8bad64b0a34199e9b/tqdm-4.65.0.tar.gz" 136 | sha256 "1871fb68a86b8fb3b59ca4cdd3dcccbc7e6d613eeed31f4c332531977b89beb5" 137 | end 138 | 139 | resource "typing-extensions" do 140 | url "https://files.pythonhosted.org/packages/3c/8b/0111dd7d6c1478bf83baa1cab85c686426c7a6274119aceb2bd9d35395ad/typing_extensions-4.7.1.tar.gz" 141 | sha256 "b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2" 142 | end 143 | 144 | resource "urllib3" do 145 | url "https://files.pythonhosted.org/packages/31/ab/46bec149bbd71a4467a3063ac22f4486ecd2ceb70ae8c70d5d8e4c2a7946/urllib3-2.0.4.tar.gz" 146 | sha256 "8d22f86aae8ef5e410d4f539fde9ce6b2113a001bb4d189e0aed70642d602b11" 147 | end 148 | 149 | resource "yarl" do 150 | url "https://files.pythonhosted.org/packages/5f/3f/04b3c5e57844fb9c034b09c5cb6d2b43de5d64a093c30529fd233e16cf09/yarl-1.9.2.tar.gz" 151 | sha256 "04ab9d4b9f587c06d801c2abfe9317b77cdf996c65a90d5e84ecc45010823571" 152 | end 153 | 154 | def install 155 | virtualenv_create(libexec, "python3") 156 | virtualenv_install_with_resources 157 | end 158 | 159 | test do 160 | assert_match "llm, version", shell_output("#{bin}/llm --version") 161 | end 162 | end 163 | -------------------------------------------------------------------------------- /Formula/strip-tags.rb: -------------------------------------------------------------------------------- 1 | class StripTags < Formula 2 | include Language::Python::Virtualenv 3 | 4 | desc "CLI tool for stripping tags from HTML" 5 | homepage "https://github.com/simonw/strip-tags" 6 | url "https://files.pythonhosted.org/packages/59/22/1b50f0c98d35c7e958b080aa7947a90bd74b3dc7e72b759034727edc10e3/strip-tags-0.5.1.tar.gz" 7 | sha256 "841a158bc8f57e3a891d45132e78c1eb8fdd9b978b8a40e68028446118dedad3" 8 | 9 | depends_on "python3" 10 | 11 | resource "beautifulsoup4" do 12 | url "https://files.pythonhosted.org/packages/af/0b/44c39cf3b18a9280950ad63a579ce395dda4c32193ee9da7ff0aed547094/beautifulsoup4-4.12.2.tar.gz" 13 | sha256 "492bbc69dca35d12daac71c4db1bfff0c876c00ef4a2ffacce226d4638eb72da" 14 | end 15 | 16 | resource "click" do 17 | url "https://files.pythonhosted.org/packages/77/88/b0cc5fe95c31c301e9823ea9b028f669c0dcfa205ff71111037a5ed4892c/click-8.1.4.tar.gz" 18 | sha256 "b97d0c74955da062a7d4ef92fadb583806a585b2ea81958a81bd72726cbb8e37" 19 | end 20 | 21 | resource "html5lib" do 22 | url "https://files.pythonhosted.org/packages/ac/b6/b55c3f49042f1df3dcd422b7f224f939892ee94f22abcf503a9b7339eaf2/html5lib-1.1.tar.gz" 23 | sha256 "b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f" 24 | end 25 | 26 | resource "six" do 27 | url "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz" 28 | sha256 "1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926" 29 | end 30 | 31 | resource "soupsieve" do 32 | url "https://files.pythonhosted.org/packages/47/9e/780779233a615777fbdf75a4dee2af7a345f4bf74b42d4a5f836800b9d91/soupsieve-2.4.1.tar.gz" 33 | sha256 "89d12b2d5dfcd2c9e8c22326da9d9aa9cb3dfab0a83a024f05704076ee8d35ea" 34 | end 35 | 36 | resource "webencodings" do 37 | url "https://files.pythonhosted.org/packages/0b/02/ae6ceac1baeda530866a85075641cec12989bd8d31af6d5ab4a3e8c92f47/webencodings-0.5.1.tar.gz" 38 | sha256 "b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923" 39 | end 40 | 41 | def install 42 | virtualenv_create(libexec, "python3") 43 | virtualenv_install_with_resources 44 | end 45 | 46 | test do 47 | assert_match "strip-tags, version", shell_output("#{bin}/strip-tags --version") 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /Formula/symbex.rb: -------------------------------------------------------------------------------- 1 | class Symbex < Formula 2 | include Language::Python::Virtualenv 3 | 4 | desc "Find the Python code for specified symbols" 5 | homepage "https://github.com/simonw/symbex" 6 | url "https://files.pythonhosted.org/packages/f3/40/390ce5881d488d104d7ee10ec2414d93d70c9477f70f7e7b31819bf804db/symbex-1.4.tar.gz" 7 | sha256 "f786d5d1d9ef0e5b0856ebf54cc12f7c42a63ea073e274f88b6024cf50490164" 8 | 9 | depends_on "python3" 10 | 11 | resource "click" do 12 | url "https://files.pythonhosted.org/packages/96/d3/f04c7bfcf5c1862a2a5b845c6b2b360488cf47af55dfa79c98f6a6bf98b5/click-8.1.7.tar.gz" 13 | sha256 "ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" 14 | end 15 | 16 | def install 17 | virtualenv_create(libexec, "python3") 18 | virtualenv_install_with_resources 19 | end 20 | 21 | test do 22 | assert_match "symbex, version", shell_output("#{bin}/symbex --version") 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /Formula/ttok.rb: -------------------------------------------------------------------------------- 1 | class Ttok < Formula 2 | include Language::Python::Virtualenv 3 | 4 | desc "Count and truncate text based on tokens" 5 | homepage "https://github.com/simonw/ttok" 6 | url "https://files.pythonhosted.org/packages/a1/9e/1f5960f74227414b1c421a22e86ec3e35ae1c4f2a4d0f8ae4770384c7271/ttok-0.2.tar.gz" 7 | sha256 "b5ec7b39358194bbd2cae50fc589e5f80ac3bb173ae39a7ea4d523e2c0a2d745" 8 | 9 | depends_on "python3" 10 | # To build tiktoken: 11 | depends_on "pkg-config" => :build 12 | depends_on "rust" => :build 13 | 14 | 15 | resource "certifi" do 16 | url "https://files.pythonhosted.org/packages/93/71/752f7a4dd4c20d6b12341ed1732368546bc0ca9866139fe812f6009d9ac7/certifi-2023.5.7.tar.gz" 17 | sha256 "0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7" 18 | end 19 | 20 | resource "charset-normalizer" do 21 | url "https://files.pythonhosted.org/packages/2a/53/cf0a48de1bdcf6ff6e1c9a023f5f523dfe303e4024f216feac64b6eb7f67/charset-normalizer-3.2.0.tar.gz" 22 | sha256 "3bb3d25a8e6c0aedd251753a79ae98a093c7e7b471faa3aa9a93a81431987ace" 23 | end 24 | 25 | resource "click" do 26 | url "https://files.pythonhosted.org/packages/77/88/b0cc5fe95c31c301e9823ea9b028f669c0dcfa205ff71111037a5ed4892c/click-8.1.4.tar.gz" 27 | sha256 "b97d0c74955da062a7d4ef92fadb583806a585b2ea81958a81bd72726cbb8e37" 28 | end 29 | 30 | resource "idna" do 31 | url "https://files.pythonhosted.org/packages/8b/e1/43beb3d38dba6cb420cefa297822eac205a277ab43e5ba5d5c46faf96438/idna-3.4.tar.gz" 32 | sha256 "814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4" 33 | end 34 | 35 | resource "regex" do 36 | url "https://files.pythonhosted.org/packages/18/df/401fd39ffd50062ff1e0344f95f8e2c141de4fd1eca1677d2f29609e5389/regex-2023.6.3.tar.gz" 37 | sha256 "72d1a25bf36d2050ceb35b517afe13864865268dfb45910e2e17a84be6cbfeb0" 38 | end 39 | 40 | resource "requests" do 41 | url "https://files.pythonhosted.org/packages/9d/be/10918a2eac4ae9f02f6cfe6414b7a155ccd8f7f9d4380d62fd5b955065c3/requests-2.31.0.tar.gz" 42 | sha256 "942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1" 43 | end 44 | 45 | resource "tiktoken" do 46 | url "https://files.pythonhosted.org/packages/9f/88/77a86f915a81449156375b7538c94105a34bebf00838462c9d3fced490e9/tiktoken-0.4.0.tar.gz" 47 | sha256 "59b20a819969735b48161ced9b92f05dc4519c17be4015cfb73b65270a243620" 48 | end 49 | 50 | resource "urllib3" do 51 | url "https://files.pythonhosted.org/packages/d6/af/3b4cfedd46b3addab52e84a71ab26518272c23c77116de3c61ead54af903/urllib3-2.0.3.tar.gz" 52 | sha256 "bee28b5e56addb8226c96f7f13ac28cb4c301dd5ea8a6ca179c0b9835e032825" 53 | end 54 | 55 | def install 56 | virtualenv_create(libexec, "python3") 57 | virtualenv_install_with_resources 58 | end 59 | 60 | test do 61 | assert_match "ttok, version", shell_output("#{bin}/ttok --version") 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # homebrew-llm 2 | 3 | Homebrew formulas for installing the [LLM](https://llm.datasette.io/) family of tools. 4 | 5 | If you have previously installed packages from this repository you may need to run `brew update` to ensure you have the latest versions of the formulas: 6 | 7 | ```bash 8 | brew update 9 | ``` 10 | 11 | ## Installing llm 12 | 13 | [LLM](https://llm.datasette.io/) lets you run prompts against large language models from the command-line. 14 | ```bash 15 | brew install simonw/llm/llm 16 | ``` 17 | Example: 18 | ```bash 19 | llm 'Ten great names for a pet pelican' 20 | ``` 21 | ## Installing strip-tags 22 | 23 | [strip-tags](https://github.com/simonw/strip-tags) strip tags from HTML, useful for feeding content to a large language model while keeping the token count down. 24 | ```bash 25 | brew install simonw/llm/strip-tags 26 | ``` 27 | Example: 28 | ```bash 29 | curl -s 'https://www.nytimes.com/' | strip-tags | llm --system 'Summarize headlines' 30 | ``` 31 | ## Installing symbex 32 | 33 | [symbex](https://github.com/simonw/symbex) is a tool for finding Python functions and classes within a codebase. It can also output just the signatures or docstrings of code that it finds. 34 | ```bash 35 | brew install simonw/llm/symbex 36 | ``` 37 | Example - this finds the `def inspect_hash()` function and explains what it does: 38 | ```bash 39 | symbex inspect_hash | llm --system 'explain this code' 40 | ``` 41 | ## Installing ttok 42 | 43 | [ttok](https://github.com/simonw/ttok) is a tool for counting tokens. This is useful if you want to check that your content is not going to exceed the size limits for different LLM models. 44 | ```bash 45 | brew install simonw/llm/ttok 46 | ``` 47 | This installation will also bring in a copy of Rust, if one is not yet available in your Homebrew setup. 48 | 49 | Example, counting the total number of tokens in all of your test functions. 50 | ```bash 51 | symbex 'test_*' | ttok 52 | ``` 53 | --------------------------------------------------------------------------------