inputs (sensors, environment, external chemicals) + current state ---> outputs (behavior) + new state
kinda like computers or robots, in a deterministic manner (except it is practically impossible to recreate the exact same inputs, or the exact same state). You don't have to take it too literally, people who read it generally understand what it means.
Machines are in some sense constituted by an enormous, intentional, simplification of the possible dynamics of a clump of matter and its relations to the outside world. Their design is profoundly impacted by both our own cognitive limitations and the contexts in which they are manufactured and used. Biological systems simply don't have these constraints and they operate in what are often totally different ways from machines.
My point is that there is considerable scientific and philosophical scholarship on this issue which casts this metaphor into doubt at least with regard to base utility.
It's just not a very helpful metaphor, because we are nowhere close to having a way to simulate or compute that function.
So treating people as agents with goals, desires, personalities, experiences and histories and traumas, and drawing on our hard wired abilities for empathy, can be a far more useful model for actually helping and healing people than just giving them a pill.
But that's not a dichotomy. Nobody is saying to either disregard biochemistry and believe that God gave us free will by some magical act or just throw random pills at people.
You can see people as all that and still not reject the idea that chemical imbalances can negatively influence their goals, desires and personalities, and that chemicals can also positively influence them,