mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-14 06:07:17 +08:00
| .. | ||
| async-chat.py | ||
| async-generate.py | ||
| async-list.py | ||
| async-ps.py | ||
| async-tools.py | ||
| chat-stream.py | ||
| chat.py | ||
| create.py | ||
| fill-in-middle.py | ||
| generate-stream.py | ||
| generate.py | ||
| list.py | ||
| multimodal_chat.py | ||
| multimodal_generate.py | ||
| ps.py | ||
| pull.py | ||
| README.md | ||
| tools.py | ||
Running Examples
Run the examples in this directory with:
# Navigate to examples directory
cd examples/
# Run example
python3 <example>.py
Chat - Chat with a model
- chat.py
- async-chat.py
- chat-stream.py - Streamed outputs
Generate - Generate text with a model
- generate.py
- async-generate.py
- generate-stream.py - Streamed outputs
Tools/Function Calling - Call a function with a model
- tools.py - Simple example of Tools/Function Calling
- async-tools.py
Multimodal - Chat with a multimodal model
Ollama List - List all downloaded models and their properties
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.
Fill in the middle
- fill-in-middle.py - Given a prefix and suffix, fill in the middle