News for hackers. Stuff that matters.
Re:Agency: Pure Go LangChain Alternative by emil14 on Tuesday November 28, 2023 @03:45AM (#38443693)
Actually error handling is much easier with agency's Processes (pipelines)

Instead of writing:

result, err := operationFoo(userInput) if err != nil { panic(err }

result, err = operationBar(result) if err != nil { panic(err }

You can create a Process and handle errors only once:

result, err := agency.NewProcess(operationFoo, operationBar).Execute(userInput) // ...

Imagine having 3+ operations, like 5 or 10. That's gonna be some real difference.

All the chained methods like `SetPrompt(...)` returns `agency.Operation` and no error needs to be handled there

Re:Agency: Pure Go LangChain Alternative by huac on Tuesday November 28, 2023 @12:44PM (#38448488)
I would, at the very least, wrap the errors being returned inside the process function https://github.com/neurocult/agency/blob/14b14e50a7570189388...

Or, I suppose the user must handle exception behavior in their custom `OperationHandler`

Re:Agency: Pure Go LangChain Alternative by emil14 on Wednesday November 29, 2023 @08:58AM (#38459372)
1) You said about process but pointed to operation

2) What wrapping would you add out there? (Wrapping must be added in provider's implementations though)

3) No, user shouldn't and can't handle errors by implementing operation handler. To handle error it simply uses go's native mechanism "v, err := ... ; if err != nil", it just needs to be done once instead of doing so for every operation in the process