SYSTEM Cited by 1 source
Datasette llm Python library¶
Definition¶
llm is Simon Willison's open-source Python library (and CLI) for talking to LLMs, with a conversation API that holds multi-turn state client-side, plugin-based multi-provider support (OpenAI, Anthropic, local models via Ollama, etc.), and CLI-first ergonomics. The wiki's canonical anchor is its use as the OpenAI API wrapper inside Zalando's component-migration toolkit, specifically the conversation API's role in truncation recovery.
Wiki anchor¶
From sources/2025-02-19-zalando-llm-powered-migration-of-ui-component-libraries:
"We developed a Python based migration tool using the llm library's conversation API."
Two load-bearing uses at Zalando:
-
Multi-turn conversation state. The conversation API persists the model's in-flight response so that on the next turn the model continues from its previous state instead of starting over.
-
continue-prompt truncation recovery. When an output exceeds the 4K-token-per-response limit, Zalando sends a literal "continue" as the next turn on the same conversation and concatenates the completion. "This allowed the LLM to pick up where it left off and complete the transformation. As per our tests, a simple 'continue' prompt proved more reliable than more complex prompts to continue the transformation." See concepts/continue-prompt-for-truncated-output for the generalised concept.
Role vs alternatives¶
- vs
openaiPython SDK: theopenaiSDK is the lower-level, provider-specific client.llmsits above it, wrapping Chat Completions behind a uniform interface and adding the conversation abstraction + CLI + plugin system. Zalando chosellmfor "its extensive support for working with LLMs and its rich ecosystem of libraries". - vs LangChain / LlamaIndex: those frameworks build
agents, retrieval pipelines, and chains;
llmis a focused "talk to models" layer. For Zalando's single-call-per-file migration pipeline, the simpler abstraction was the right fit.
Seen in¶
- sources/2025-02-19-zalando-llm-powered-migration-of-ui-component-libraries — canonical and only wiki source. The production migration toolkit's OpenAI wrapper.
Related¶
- systems/zalando-component-migration-toolkit — the production tool built on this library
- systems/gpt-4o — the OpenAI model the library fronts
- concepts/continue-prompt-for-truncated-output — the
continue-prompt recovery pattern the conversation API enables - companies/zalando