ollama/docs/python.md
2023-07-01 17:54:29 -04:00

768 B

Python SDK

Install

pip install ollama

Example

import ollama
ollama.generate("orca-mini-3b", "hi")

Reference

ollama.generate(model, message)

Generate a completion

ollama.generate("./llama-7b-ggml.bin", "hi")

ollama.models()

List available local models

models = ollama.models()

ollama.load(model)

Manually a model for generation

ollama.load("model")

ollama.unload(model)

Unload a model

ollama.unload("model")

ollama.pull(model)

Download a model

ollama.pull("huggingface.co/thebloke/llama-7b-ggml")

ollama.search(query)

Search for compatible models that Ollama can run

ollama.search("llama-7b")