19 Comments
User's avatar
⭠ Return to thread
Konstantin Yovkov's avatar

Exactly. A function for each type of output and an abstraction that is being “called” in the main logic. This way you close the code for modification, but it is open for extension, because you can easily add a new output function, without modifying the existing logic.

Expand full comment
Nick Hodges's avatar

Yes!

Expand full comment
Manuel Stausberg's avatar

Do you mean having e.g. formatter_text(), formatter_json() and passing those as arguments to the call_llm() function instead of the enum?

Or do you mean having completely separate functions like call_llm_as_text(), call_llm_as_json() ?

Expand full comment