Code: Talking to LLMs from Jennifer
Talking to LLMs from Jennifer: the code
The programs behind the slides. They use the @deckyard/anthropic, @deckyard/openai and @deckyard/gemini decks, listed in deck.toml, so run jvc install once in this folder to fill vendor/. Run everything from this folder with Jennifer 0.27.0.
Nothing here was run against a vendor, and no real key was used. fake.j stands in for all three APIs on one loopback port, and every program reads a base URL variable (ANTHROPIC_BASE_URL, OPENAI_BASE_URL, GEMINI_BASE_URL) that points it there. env.sh sets those and placeholder keys (sk-ant-FAKE-KEY, sk-FAKE-KEY, FAKE-KEY), which the fake accepts without looking at them.
To run a program against the real API instead, leave the base URL unset and export a real key from your secret store, for example ANTHROPIC_API_KEY=sk-ant-REPLACE-ME jennifer run claude.j. That costs money and was not done for this talk.
deck.toml: the jvc manifest with the three decks ("Setup: the key comes from the environment").fake.j: the fake APIs:/v1/messages,.../chat/completionsand/v1beta/models/<id>:generateContent. It answers from the request: a text reply, a tool-call reply (threestock_levelcalls) when tools are declared, the final answer once tool results come back, and a 429 withretry-after: 30for the modelfake-429. It logs which key header arrived, never its value ("A fake of your own", "Tools: what happened"). Run:jennifer run fake.j 28800 &env.sh: placeholder keys and the base URLs of the fake. Use:. ./env.shclaude.j: "A first message: Claude", plus theANTHROPIC_BASE_URLlines from "Testing without a key". Run:jennifer run claude.jgpt.j,gemini.j: "The same in GPT and Gemini". Run:jennifer run gpt.j,jennifer run gemini.jwire.j: prints the three requests as JSON ("What actually goes on the wire"). Needs no key and no server. Run:jennifer run wire.jreply.j: stop reasons andUsagefrom all three ("Reading a reply"). Run:jennifer run reply.jconversation.j: Gemini, a question and a follow-up withaddReply("A conversation: addReply"). Run:jennifer run conversation.jtools.j: declaresstock_leveland runs the tool loop with a stock table as the context ("Tools: declare them", "Tools: the loop", "Tools: what happened"). The argument picks the deck. Run:jennifer run tools.j anthropic(oropenai,gemini)errors.j: a 429 from each vendor with the retries switched off, read from the error struct ("Errors: match the kind, then read fields"). Run:jennifer run errors.jlocal.j: an OpenAI-compatible server on127.0.0.1:11434with no key, the plain-http refusal for another host, and Azure whenAZURE_OPENAI_ENDPOINTandAZURE_OPENAI_KEYare set ("OpenAI-compatible servers"). It was run with a second copy of the fake on port 11434 in place of Ollama:jennifer run fake.j 11434 &. With a real Ollama,ollama pull qwen3:4bfirst. Azure (placeholders):AZURE_OPENAI_ENDPOINT=https://NAME.openai.azure.com AZURE_OPENAI_KEY=REPLACE-ME jennifer run local.jrun.sh: starts the fake on 28800 and 11434, runs every program above withenv.sh, stops the fakes and prints their log. Run:./run.sh
| File | Size | |
|---|---|---|
| LICENSE | 899 B | raw |
| README.md | 3.2 KiB | raw |
| claude.j | 716 B | raw |
| conversation.j | 891 B | raw |
| deck.toml | 322 B | raw |
| env.sh | 294 B | raw |
| errors.j | 1.9 KiB | raw |
| fake.j | 6.6 KiB | raw |
| gemini.j | 620 B | raw |
| gpt.j | 610 B | raw |
| local.j | 1.1 KiB | raw |
| reply.j | 1.9 KiB | raw |
| run.sh | 663 B | raw |
| tools.j | 4.5 KiB | raw |
| wire.j | 923 B | raw |