Live data from Hacker News

Show HN: Magentic – Use LLMs as simple Python functions

github.com

1–10 of 70 posts

Show HN: Magentic – Use LLMs as simple Python functions

#1
This is a Python package that allows you to write function signatures to define LLM queries. This makes it easy to mix regular code with calls to LLMs, which enables you to use the LLM for its creativity and reasoning while also enforcing structure/logic as necessary. LLM output is parsed for you according to the return type annotation of the function, including complex return types such as streaming an array of structured objects.

I built this to show that we can think about using LLMs more fluidly than just chains and chats, i.e. more interchangeably with regular code, and to make it easy to do that.

Please let me know what you think! Contributions welcome.

https://github.com/jackmpcollins/magentic

Show HN: Magentic – Use LLMs as simple Python functions
github.com

Re: Show HN: Magentic – Use LLMs as simple Python functions

#5
post #3

Are you familiar with https://github.com/PrefectHQ/marvin ? This looks very similar

Yes, similar ideas. Marvin [asks the LLM to mimic the python function](https://github.com/PrefectHQ/marvin/blob/f37ad5b15e2e77dd998...), whereas in magentic the function signature just represents the inputs/outputs to the prompt-template/LLM, so the LLM “doesn’t know” that it is pretending to be a python function - you specify all the prompts.
Post reply on HN