GitHub repo

jackmpcollins/magentic

Python Tracked since 2023-06-18 Updated 2026-07-16 View source ↗

#432 of 783 by Stars among GitHub repos

2.4k Stars

Seamlessly integrate LLMs as Python functions

About

Seamlessly integrate Large Language Models into Python code. Use the @prompt and @chatprompt decorators to create functions that return structured output from an LLM. Combine LLM queries and tool use with traditional Python code to build complex agentic systems.

Configure your OpenAI API key by setting the OPENAIAPIKEY environment variable. To configure a different LLM provider see [Configuration] for more.

The @prompt decorator allows you to define a template for a Large Language Model (LLM) prompt as a Python function. When this function is called, the arguments are inserted into the template, then this prompt is sent to an LLM which generates the function output.

The @prompt decorator…

Excerpted from github.com/jackmpcollins/magentic

Latest metrics

Stars 2.4k 2026-07-16
Forks 127 2026-07-16
Commits 360 2026-07-16
Releases 65 2026-07-16
Watchers 10 2026-07-16
Open issues 40 2026-07-16
Open PRs 9 2026-07-16