What's Changed
- 🦙 Ollama can now return structured outputs / function calls (it takes a little prompting to make it reliable).
python
from magentic import prompt
from magentic.chat_model.litellm_chat_model import LitellmChatModel
prompt(
"Count to {n}. Use the tool to return in the format [1, 2, 3, ...]",
model=LitellmChatModel("ollama_chat/llama2", api_base="http://localhost:11434")
)
def count_to(n: int) -> list[int]: ...
count_to(5)
> [1, 2, 3, 4, 5]
PRs
* poetry update by jackmpcollins in https://github.com/jackmpcollins/magentic/pull/202
* Support ollama structured outputs / function calling by jackmpcollins in https://github.com/jackmpcollins/magentic/pull/204
**Full Changelog**: https://github.com/jackmpcollins/magentic/compare/v0.22.0...v0.23.0