Composing and Decomposing AI Functions (Tutorial with Python Examples)
lightcapai.medium.com·4h·
Discuss: Hacker News
Flag this post

5 min readJust now

Modern AI chats can do more than just reply with text — they can call small “tool” functions to fetch data or perform tasks. Think of a function as a mini-program the AI can execute (for example, looking up weather or doing math). By composing and decomposing such functions, we can break complex queries into pieces or chain multiple steps, leading to more accurate and even empathetic conversations. In practice, we might define one function to generate a response and another to tweak its tone, then compose them (call one after the other). We can also decompose a user’s request into sub-requests handl…

Similar Posts

Loading similar posts...