{"id":15433020,"url":"https://github.com/simonw/language-models-on-the-command-line","last_synced_at":"2025-04-14T17:43:23.715Z","repository":{"id":243965575,"uuid":"813910864","full_name":"simonw/language-models-on-the-command-line","owner":"simonw","description":"Handout for a talk I gave about LLM and CLI tools","archived":false,"fork":false,"pushed_at":"2024-06-12T04:50:24.000Z","size":7,"stargazers_count":62,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T17:43:14.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/simonw.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":"2024-06-12T01:29:41.000Z","updated_at":"2025-01-26T12:24:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"c01138a7-65e4-4570-94d8-d6a7559303b8","html_url":"https://github.com/simonw/language-models-on-the-command-line","commit_stats":null,"previous_names":["simonw/language-models-on-the-command-line"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Flanguage-models-on-the-command-line","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Flanguage-models-on-the-command-line/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Flanguage-models-on-the-command-line/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Flanguage-models-on-the-command-line/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/language-models-on-the-command-line/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248930023,"owners_count":21184938,"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":[],"created_at":"2024-10-01T18:30:34.611Z","updated_at":"2025-04-14T17:43:23.689Z","avatar_url":"https://github.com/simonw.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Language models on the command-line\n\nNotes for a talk I gave at [Mastering LLMs: A Conference For Developers \u0026 Data Scientists](https://maven.com/parlance-labs/fine-tuning).\n\nHere is the [full 67 minute talk video](https://twitter.com/hamelhusain/status/1800741994899394612).\n\n- [Datasette](https://datasette.io/)\n- [My blog](https://simonwillison.net/)\n- [LLM](https://llm.datasette.io/en/stable/)\n\n## Getting started \n\n```bash\nbrew install llm # or pipx or pip\nllm keys set openai\n# paste key here\nllm \"Say hello in Spanish\"\n```\n## Installing Claude 3\n```bash\nllm install llm-claude-3\nllm keys set claude\n# Paste key here\nllm -m haiku 'Say hello from Claude Haiku'\n```\n\n## Local model with llm-gpt4all\n\n```bash\nllm install llm-gpt4all\nllm models\nllm chat -m mistral-7b-instruct-v0\n```\n## Browsing logs with Datasette\n\nhttps://datasette.io/\n\n```bash\npipx install datasette # or brew or pip\ndatasette \"$(llm logs path)\"\n# Browse at http://127.0.0.1:8001/\n```\n### Templates\n```bash\nllm --system 'You are a sentient cheesecake' -m gpt-4o --save cheesecake\n```\nNow you can chat with a cheesecake:\n```bash\nllm chat -t cheesecake\n```\n\nMore plugins: https://llm.datasette.io/en/stable/plugins/directory.html\n\n### llm-cmd\n\nHelp with shell commands. Blog entry is here: https://simonwillison.net/2024/Mar/26/llm-cmd/\n\n### files-to-prompt and shot-scraper\n\n`files-to-prompt` is described here: \nhttps://simonwillison.net/2024/Apr/8/files-to-prompt/\n\n`shot-scraper javascript` documentation: https://shot-scraper.datasette.io/en/stable/javascript.html\n\nJSON output for Google search results:\n\n```bash\nshot-scraper javascript 'https://www.google.com/search?q=nytimes+slop' '\nArray.from(\n  document.querySelectorAll(\"h3\"),\n  el =\u003e ({href: el.parentNode.href, title: el.innerText})\n)'\n```\nThis version gets the HTML that includes the snippet summaries, then pipes it to LLM to answer a question:\n```bash\nshot-scraper javascript 'https://www.google.com/search?q=nytimes+slop' '\n() =\u003e {\n    function findParentWithHveid(element) {\n        while (element \u0026\u0026 !element.hasAttribute(\"data-hveid\")) {\n            element = element.parentElement;\n        }\n        return element;\n    }\n    return Array.from(\n        document.querySelectorAll(\"h3\"),\n        el =\u003e findParentWithHveid(el).innerText\n    );\n}' | llm -s 'describe slop'\n```\n### Hacker news summary\n\nhttps://til.simonwillison.net/llms/claude-hacker-news-themes describes my Hacker News summary script in detail.\n\n### Embeddings\n\nFull documentation: https://llm.datasette.io/en/stable/embeddings/index.html\n\nI ran this:\n\n```bash\ncurl -O https://datasette.simonwillison.net/simonwillisonblog.db\nllm embed-multi links \\\n  -d simonwillisonblog.db \\\n  --sql 'select id, link_url, link_title, commentary from blog_blogmark' \\\n  -m 3-small --store\n```\nThen looked for items most similar to a string like this:\n```bash\nllm similar links \\\n  -d simonwillisonblog.db \\\n  -c 'things that make me angry'\n```\n\n### More links\n\n- [Coping strategies for the serial project hoarder](https://simonwillison.net/2022/Nov/26/productivity/) talk about personal productivity on different projects\n- [Figure out how to serve an AWS Lambda function with a Function URL from a custom subdomain](https://github.com/simonw/public-notes/issues/1) as an example of how I use GitHub Issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Flanguage-models-on-the-command-line","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Flanguage-models-on-the-command-line","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Flanguage-models-on-the-command-line/lists"}