ollama-python/examples
2024-11-20 14:34:24 -08:00
..
async-chat.py Examples and readme updates 2024-11-20 13:45:38 -08:00
async-generate.py Examples and readme updates 2024-11-20 13:45:38 -08:00
async-tools.py Examples and readme updates 2024-11-20 13:45:38 -08:00
chat-stream.py Examples and readme updates 2024-11-20 13:45:38 -08:00
chat.py Examples and readme updates 2024-11-20 13:45:38 -08:00
create.py Update examples and readmes 2024-11-20 13:45:38 -08:00
embed.py Update examples and readme 2024-11-20 14:15:41 -08:00
fill-in-middle.py Examples and readme updates 2024-11-20 13:45:38 -08:00
generate-stream.py Examples and readme updates 2024-11-20 13:45:38 -08:00
generate.py Examples and readme updates 2024-11-20 13:45:38 -08:00
list.py Examples and readme updates 2024-11-20 13:45:38 -08:00
multimodal_chat.py Update examples and readme 2024-11-20 14:15:41 -08:00
multimodal_generate.py Update examples and readme 2024-11-20 14:15:41 -08:00
ps.py Update examples and readmes 2024-11-20 13:45:38 -08:00
pull.py Update examples and readmes 2024-11-20 13:45:38 -08:00
README.md Delete extra async examples 2024-11-20 14:34:24 -08:00
tools.py Examples and readme updates 2024-11-20 13:45:38 -08:00

Running Examples

Run the examples in this directory with:

# Ensure you are in the examples directory
cd examples/

# Run example
python3 <example>.py

Chat - Chat with a model

Generate - Generate text with a model

Tools/Function Calling - Call a function with a model

Multimodal with Image - Chat with a multimodal (image chat) model

Ollama List - List all downloaded models and their properties

Ollama ps - Show model status with CPU/GPU usage

Ollama Pull - Pull a model from Ollama

Requirement: pip install tqdm

Ollama Create - Create a model from a Modelfile

python create.py <model> <modelfile>

See ollama/docs/modelfile.md for more information on the Modelfile format.

Ollama Embed - Generate embeddings with a model

Fill in the middle