2023-05

2023-05-18 llm, ttok and strip-tags—CLI tools for working with ChatGPT and other LLMs

I’ve been building out a small suite of command-line tools for working with ChatGPT, GPT-4 and potentially other language models in the future.

The three tools I’ve built so far are:

  • llm—a command-line tool for sending prompts to the OpenAI APIs, outputting the response and logging the results to a SQLite database. I introduced that a few weeks ago.

  • ttok—a tool for counting and truncating text based on tokens

  • strip-tags—a tool for stripping HTML tags from text, and optionally outputting a subset of the page based on CSS selectors

The idea with these tools is to support working with language model prompts using Unix pipes.

You can install the three like this:

pipx install llm
pipx install ttok
pipx install strip-tags

Or use pip if you haven’t adopted pipx yet.

Stripping tags from HTML

HTML tags take up a lot of tokens, and usually aren’t relevant to the prompt you are sending to the model.

My new strip-tags command strips those tags out.

Here’s an example showing quite how much of a difference that can make:

$ curl -s https://simonwillison.net/ | ttok
21543
$ curl -s https://simonwillison.net/ | strip-tags | ttok
9688

2023-05-03 Geoffrey Hinton, l’un des pères de l’intelligence artificielle, a quitté Google pour « pouvoir parler » des « profonds risques pour la société et l’humanité »

Intelligence artificielle : l’un des pionniers met en garde contre ses dangers.

Geoffrey Hinton, l’un des pères de l’intelligence artificielle, a quitté Google pour « pouvoir parler » des « profonds risques pour la société et l’humanité » que présente l’IA.

« Je suis parti pour pouvoir parler des dangers de l’IA sans me soucier d’un éventuel impact sur Google », a déclaré dans un tweet le docteur en intelligence artificielle, après l’annonce de son départ