News for hackers. Stuff that matters.
Re:Show HN: Agentflow – Run Complex LLM Workflows from Simpl... by rexreed on Tuesday August 08, 2023 @02:01PM (#37053043)
I'm trying to understand what this does and how it works. Can you provide more examples with different use cases? How does this work with / compare to LangChain?
Re:Show HN: Agentflow – Run Complex LLM Workflows from Simpl... by simonmesmith on Tuesday August 08, 2023 @02:10PM (#37053176)
For sure.

Let's use an example, like this: https://github.com/simonmesmith/agentflow/blob/main/agentflo...

This is a workflow for coming up with a product idea and illustrating it with an image.

This workflow has 9 steps, starting with brainstorming ideas, and ending with saving an HTML file containing the product name, description, and image.

It also has two variables, {market} for the target market, and {price_point} for the price point.

To run this workflow, you simply enter this in the command line: python -m run --flow=example_with_variables --variables 'market=college students' 'price_point=$50'

You don't need to write any code with LangChain.

You simply specify your workflow in a JSON file, and execute it.

Does that help to clarify?

Re:Show HN: Agentflow – Run Complex LLM Workflows from Simpl... by rexreed on Tuesday August 08, 2023 @02:26PM (#37053422)
Thanks - this does help. Curious about the function calls, especially around image generation.

Also, can you clarify what you mean by "You don't need to write any code with LangChain."?

Re:Show HN: Agentflow – Run Complex LLM Workflows from Simpl... by simonmesmith on Tuesday August 08, 2023 @02:32PM (#37053492)
Sure!

In Agentflow, you write functions by inheriting from the BaseFunction class. You need to provide the definition in JSON that GPT-3.5/4 uses to understand how to call a function, and also the function logic itself. This just means creating a get_definition() function that returns a JSON Schema object, and an execute() function that performs your logic and returns a string. Once you have those, you can then just use the function in your workflow by adding "function_call": "your_function". The application does the rest. Here's the create_image function, for example, which uses the Dall-e API: https://github.com/simonmesmith/agentflow/blob/main/agentflo...

What I mean by "you don't need to write any code with LangChain" is that you don't need to write any Python at all to use Agentflow, unless you want to create a new function. Creating workflows just involves creating JSON files. It's not like LangChain, for which you'd have to chain together multiple prompts in Python.

Does that help clarify?

PS: You'll notice heavy documentation in the link above. I want to experiment with automatically generating documentation using Sphinx, so I documented everything with Sphinx formatting. It might be overkill.

Re:Show HN: Agentflow – Run Complex LLM Workflows from Simpl... by rexreed on Tuesday August 08, 2023 @03:40PM (#37054429)
Thanks! I'll check this out!