Ollama released initial versions of official Python and JavaScript/TypeScript client libraries, allowing developers to integrate Ollama into apps with a few lines of code. Both libraries mirror the Ollama REST API and support streaming, multi-modal input, text completion, custom model creation, and custom clients. Ollama also moved its repositories to a new GitHub organization and acknowledged community-maintained libraries for Dart, Swift, C#, Java, PHP, Rust, and other languages.
Questions this post answers
How do I use the official Ollama Python library to chat with a model?
Install it with pip install ollama, then import ollama and call ollama.chat(model='llama2', messages=[{'role': 'user', 'content': 'your prompt'}]), and read the response from response['message']['content']. The library mirrors the Ollama REST API and supports streaming, multi-modal image input, text completion, and creating custom models via a Modelfile string. Developers wiring LLMs into Python apps follow Ollama SDK updates like this on daily.dev.
Is there an official JavaScript or TypeScript library for Ollama?
Yes, an official JavaScript library is available via npm install ollama, compatible with both JavaScript and TypeScript. It shares the same feature set as the REST API and Python library, letting you call ollama.chat({model, messages}) and read response.message.content, with support for streaming and custom model creation. Teams choosing between Ollama SDKs for their stack track releases like this on daily.dev.