-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Ollama Python Library | ||
|
||
The Ollama Python library provides the easiest way to integrate your Python project with [Ollama](https://github.com/jmorganca/ollama). | ||
|
||
## Getting Started | ||
|
||
```shell | ||
pip install ollama | ||
``` | ||
|
||
```python | ||
from ollama import chat | ||
response = chat(model='llama2', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}]) | ||
``` | ||
|
||
### Using the Synchronous Client | ||
|
||
```python | ||
from ollama import Client | ||
Client(base_url='http://localhost:11434').chat(model='llama2', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}]) | ||
``` | ||
|
||
### Using the Asynchronous Client | ||
|
||
``` | ||
from ollama import AsyncClient | ||
await Client(base_url='http://localhost:11434').chat(model='llama2', messages=[{'role': 'user', 'content': 'Why is the sky blue?'}]) | ||
``` |