forked from phoenix/litellm-mirror
(docs) ollama/json mode
This commit is contained in:
parent
9f79f75635
commit
485f05ea02
1 changed files with 18 additions and 0 deletions
|
@ -58,6 +58,24 @@ async def async_ollama():
|
||||||
import asyncio
|
import asyncio
|
||||||
asyncio.run(async_ollama())
|
asyncio.run(async_ollama())
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Usage - JSON Mode
|
||||||
|
To use ollama JSON Mode pass `format="json"` to `litellm.completion()`
|
||||||
|
|
||||||
|
```python
|
||||||
|
from litellm import completion
|
||||||
|
response = completion(
|
||||||
|
model="ollama/llama2",
|
||||||
|
messages=[
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": "respond in json, what's the weather"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
max_tokens=10,
|
||||||
|
format = "json"
|
||||||
|
)
|
||||||
```
|
```
|
||||||
## Ollama Models
|
## Ollama Models
|
||||||
Ollama supported models: https://github.com/jmorganca/ollama
|
Ollama supported models: https://github.com/jmorganca/ollama
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue