{"id":18689711,"url":"https://github.com/mrseanryan/gpt-workflow","last_synced_at":"2025-04-12T05:53:47.161Z","repository":{"id":190802617,"uuid":"683356578","full_name":"mrseanryan/gpt-workflow","owner":"mrseanryan","description":"Generate workflows (for flowcharts or low code) via LLM. Also describe workflow given in DOT.","archived":false,"fork":false,"pushed_at":"2023-11-02T16:34:37.000Z","size":1477,"stargazers_count":16,"open_issues_count":16,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T05:53:41.503Z","etag":null,"topics":["flow-generator","flowchart-generator","flowchart-nlp","gpt","nlp","worflow-nlp","workflow-generation","workflow-generator","workflows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrseanryan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-26T09:58:43.000Z","updated_at":"2024-12-27T02:11:50.000Z","dependencies_parsed_at":"2023-08-26T13:28:25.716Z","dependency_job_id":"4746e002-d63b-4419-a720-3c81298d3d86","html_url":"https://github.com/mrseanryan/gpt-workflow","commit_stats":null,"previous_names":["mrseanryan/gpt-workflow"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fgpt-workflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fgpt-workflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fgpt-workflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrseanryan%2Fgpt-workflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrseanryan","download_url":"https://codeload.github.com/mrseanryan/gpt-workflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525156,"owners_count":21118616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flow-generator","flowchart-generator","flowchart-nlp","gpt","nlp","worflow-nlp","workflow-generation","workflow-generator","workflows"],"created_at":"2024-11-07T10:44:50.242Z","updated_at":"2025-04-12T05:53:47.133Z","avatar_url":"https://github.com/mrseanryan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpt-workflow\nGenerate workflows (for flowcharts or low code) in DOT format, from natural language, via an LLM.\n\nAlso perform the inverse: describe a given workflow (given in DOT format) in natural language.\n\n## Approach: generate DOT notation as a simple format to represent a workflow\n\nThe DOT graph format (as used by tools like graphviz) is a simple way to represent a flow chart. A flow chart is a good approximation of a workflow.\n\nBecause DOT graphs are a common public format, large LLMs such as Open AI gpt-3.5-turbo have included them in their training corpus. So, such LLMs are already capable of both generating DOT files and summarizing them back to natural language. We can use such LLMs both to generate workflows from natural language, and the inverse (generating a summary), by using DOT as an intermediate format.\n\nThe DOT script generated by the LLM can be further processed, for example by generating a flow chart image OR by populating some kind of workflow system inside an application.\n\n### Approach: Generating a workflow\n\n![images/how_it_works-DOT-generation-from-natural-language.simplified.png](images/how_it_works-DOT-generation-from-natural-language.simplified.png)\n\n#### Generating a workflow: Detailed View\n\n![images/how_it_works-DOT-generation-from-natural-language.png](images/how_it_works-DOT-generation-from-natural-language.png)\n\n### Approach: Describing (explaining) a workflow\n\n![images/how_it_works-DOT-describer.simplified.png](images/how_it_works-DOT-describer.simplified.png)\n\n#### Describing (explaining) a workflow: Detailed View\n\n![images/how_it_works-DOT-describer.png](images/how_it_works-DOT-describer.png)\n\n## Example generated flow charts\n\n| ![images/dot_graph_1.png](images/dot_graph_1.png)| ![images/dot_graph_2.png](images/dot_graph_2.png)|\n|---|---|\n| Workflow to decide on a mortgage application | Workflow to decide on a job interview candidate|\n\n| ![images/dot_graph_3.png](images/dot_graph_3.png)| ![images/dot_graph_4.png](images/dot_graph_4.png)|\n|---|---|\n| Workflow to decide what is this animal | Workflow to add an item to a list|\n\n| ![images/dot_graph_5.png](images/dot_graph_5.png)| ![images/dot_graph_6.png](images/dot_graph_6.png)|\n|---|---|\n| Workflow to combine two lists | Workflow to conditionally add an item to a list|\n\n| ![images/dot_graph_7.png](images/dot_graph_7.png)| ![images/dot_graph_8.png](images/dot_graph_8.png)|\n|---|---|\n| Iiterate over Job Applications in a list. For each Job Application, call another flow that checks if the application should proceed to interview stage. | The step-by-step process of reading the Orders, iterating over them, calculating the total amount, and writing it back to storage. |\n\n## Example Execution - generating flows in DOT format from natural language input\n\n```\n\u003e\u003e Create a flow that makes a series of decisions about whether to approve a mortgage application\nWriting png to '.\\temp\\dot_graph_1.png'\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n  \n  // decision_credit_score\n  start -\u003e decision_credit_score;\n  decision_credit_score [shape=Mdiamond, label=\"Credit Score \u003e 700?\"];\n  \n  // decision_income\n  decision_credit_score -\u003e decision_income;\n  decision_income [shape=Mdiamond, label=\"Income \u003e $50,000?\"];\n  \n  // decision_employment\n  decision_income -\u003e decision_employment;\n  decision_employment [shape=Mdiamond, label=\"Employment \u003e 2 years?\"];\n  \n  // decision_down_payment\n  decision_employment -\u003e decision_down_payment;\n  decision_down_payment [shape=Mdiamond, label=\"Down Payment \u003e 20%?\"];\n  \n  // approve\n  decision_down_payment -\u003e approve;\n  approve [shape=box, label=\"Approve\"];\n  \n  // reject\n  decision_credit_score -\u003e reject;\n  reject [shape=box, label=\"Reject\"];\n  \n  decision_income -\u003e reject;\n  decision_employment -\u003e reject;\n  decision_down_payment -\u003e reject;\n}\n```\n\n```\n\u003e\u003e Create a flow that makes a series of decisions about whether to recommend a job interview candidate.\nWriting png to '.\\temp\\dot_graph_2.png'\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n\n  // decision_experience\n  start -\u003e decision_experience;\n  decision_experience [shape=Mdiamond, label=\"Has relevant experience?\"];\n\n  // decision_education\n  decision_experience -\u003e decision_education;\n  decision_education [shape=Mdiamond, label=\"Has required education?\"];\n\n  // decision_skills\n  decision_education -\u003e decision_skills;\n  decision_skills [shape=Mdiamond, label=\"Has necessary skills?\"];\n\n  // decision_references\n  decision_skills -\u003e decision_references;\n  decision_references [shape=Mdiamond, label=\"Has positive references?\"];\n\n  // recommend\n  decision_references -\u003e recommend;\n  recommend [shape=box, label=\"Recommend for interview\"];\n\n  // reject\n  decision_experience -\u003e reject;\n  reject [shape=box, label=\"Reject\"];\n\n  decision_education -\u003e reject;\n  decision_skills -\u003e reject;\n  decision_references -\u003e reject;\n}\n```\n\n```\n\u003e\u003e Create a flow that makes a series of decisions about an animal, to decide what kind of animal is it\nWriting png to '.\\temp\\dot_graph_3.png'\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n\n  // decision_has_feathers\n  start -\u003e decision_has_feathers;\n  decision_has_feathers [shape=Mdiamond, label=\"Has feathers?\"];\n\n  // decision_can_fly\n  decision_has_feathers -\u003e decision_can_fly;\n  decision_can_fly [shape=Mdiamond, label=\"Can fly?\"];\n\n  // decision_has_fins\n  decision_has_feathers -\u003e decision_has_fins;\n  decision_has_fins [shape=Mdiamond, label=\"Has fins?\"];\n\n  // Hawk\n  decision_can_fly -\u003e Hawk;\n  Hawk [shape=box, label=\"Hawk\"];\n\n  // Penguin\n  decision_can_fly -\u003e Penguin;\n  Penguin [shape=box, label=\"Penguin\"];\n\n  // Dolphin\n  decision_has_fins -\u003e Dolphin;\n  Dolphin [shape=box, label=\"Dolphin\"];\n\n  // Bear\n  decision_has_fins -\u003e Bear;\n  Bear [shape=box, label=\"Bear\"];\n}\n```\n\n```\n\u003e\u003e Create a flow that takes a list and an object. Call another flow to get a boolean result. If the boolean is true, then add the item to the list.\nWriting png to '.\\temp\\dot_graph_6.png'\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n\n  // call_flow\n  call_flow [shape=box, label=\"Call Flow\"];\n\n  // decision_boolean\n  decision_boolean [shape=diamond, label=\"Boolean Result?\"];\n\n  // add_item\n  add_item [shape=box, label=\"Add Item\"];\n\n  // end\n  end [shape=ellipse, label=\"End\"];\n\n  // start -\u003e call_flow\n  start -\u003e call_flow;\n\n  // call_flow -\u003e decision_boolean\n  call_flow -\u003e decision_boolean;\n\n  // decision_boolean -\u003e add_item [label=\"true\"];\n  decision_boolean -\u003e add_item [label=\"true\"];\n\n  // decision_boolean -\u003e end [label=\"false\"];\n  decision_boolean -\u003e end [label=\"false\"];\n\n  // add_item -\u003e end\n  add_item -\u003e end;\n\n  call_flow [shape=box, label=\"Call Flow\"];\n}\n```\n\n```\n\u003e\u003e Create a flow that iterates over Job Applications in a list. For each Job Application, call another flow that checks if the application should proceed to interview stage\n\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n\n  // initialize\n  start -\u003e initialize;\n  initialize [shape=box, label=\"Initialize list and counter\"];\n\n  // decision_has_next\n  initialize -\u003e decision_has_next;\n  decision_has_next [shape=Mdiamond, label=\"Has next job application?\"];\n\n  // action_call_flow\n  decision_has_next -\u003e action_call_flow;\n  action_call_flow [shape=box, label=\"Call flow to check application\"];\n\n  // increment_counter\n  action_call_flow -\u003e increment_counter;\n  increment_counter [shape=box, label=\"Increment counter\"];\n\n  // decision_has_next\n  increment_counter -\u003e decision_has_next;\n\n  // end\n  decision_has_next -\u003e end;\n  end [shape=ellipse, label=\"End\"];\n\n  initialize -\u003e decision_has_next;\n}\n```\n\n## Example Execution - Describing a given workflow\n\n```\n\u003e\u003e Descibe this workflow:\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n\n  // decision_credit_score\n  start -\u003e decision_credit_score;\n  decision_credit_score [shape=Mdiamond, label=\"Credit Score \u003e 700?\"];\n\n  // decision_income\n  decision_credit_score -\u003e decision_income;\n  decision_income [shape=Mdiamond, label=\"Income \u003e $50,000?\"];\n\n  // decision_employment\n  decision_income -\u003e decision_employment;\n  decision_employment [shape=Mdiamond, label=\"Employment \u003e 2 years?\"];\n\n  // decision_down_payment\n  decision_employment -\u003e decision_down_payment;\n  decision_down_payment [shape=Mdiamond, label=\"Down Payment \u003e 20%?\"];\n\n  // approve\n  decision_down_payment -\u003e approve;\n  approve [shape=box, label=\"Approve\"];\n\n  // reject\n  decision_credit_score -\u003e reject;\n  reject [shape=box, label=\"Reject\"];\n\n  decision_income -\u003e reject;\n  decision_employment -\u003e reject;\n  decision_down_payment -\u003e reject;\n}\n\nThis flow chart represents a decision-making process for approving or rejecting a loan application. \n\nThe process starts at the \"Start\" node and then moves to the \"Credit Score \u003e 700?\" decision node. If the credit score is greater than 700, the flow moves to the \"Income \u003e $50,000?\" decision node. If the income is greater than $50,000, the flow moves to the \"Employment \u003e 2 years?\" decision node. If the employment is greater than 2 years, the flow moves to the \"Down Payment \u003e 20%?\" decision node. If the down payment is greater than 20%, the flow reaches the \"Approve\" node, indicating that the loan application should be approved.\n\nHowever, if at any point in the process a condition is not met, the flow moves to the \"Reject\" node, indicating that the loan application should be rejected.\n\nOverall, this flow chart helps guide the decision-making process for loan approval based on various criteria such as credit score, income, employment, and down payment.\n```\n\n```\n\u003e\u003e Descibe this workflow:\ndigraph G {\n\n  // start\n  start [shape=ellipse, label=\"Start\"];\n\n  // decision_has_feathers\n  start -\u003e decision_has_feathers;\n  decision_has_feathers [shape=Mdiamond, label=\"Has feathers?\"];\n\n  // decision_can_fly\n  decision_has_feathers -\u003e decision_can_fly;\n  decision_can_fly [shape=Mdiamond, label=\"Can fly?\"];\n\n  // decision_has_fins\n  decision_has_feathers -\u003e decision_has_fins;\n  decision_has_fins [shape=Mdiamond, label=\"Has fins?\"];\n\n  // Hawk\n  decision_can_fly -\u003e Hawk;\n  Hawk [shape=box, label=\"Hawk\"];\n\n  // Penguin\n  decision_can_fly -\u003e Penguin;\n  Penguin [shape=box, label=\"Penguin\"];\n\n  // Dolphin\n  decision_has_fins -\u003e Dolphin;\n  Dolphin [shape=box, label=\"Dolphin\"];\n\n  // Bear\n  decision_has_fins -\u003e Bear;\n  Bear [shape=box, label=\"Bear\"];\n}\n\nThis flow chart represents a decision-making process to determine the characteristics of different animals based on whether they have feathers, can fly, or have fins.\n\nThe process starts at the \"Start\" node and then moves to the \"Has feathers?\" decision node. If the animal has feathers, the flow moves to the \"Can fly?\" decision node. If the animal can fly, the flow reaches the \"Hawk\" node, indicating that the animal is a hawk. However, if the animal cannot fly, the flow reaches the \"Penguin\" node, indicating that the animal is a penguin.\n\nIf the animal does not have feathers, the flow moves to the \"Has fins?\" decision node. If the animal has fins, the flow reaches the \"Dolphin\" node, indicating that the animal is a dolphin. However, if the animal does not have fins, the flow reaches the \"Bear\" node, indicating that the animal is a bear.\n\nOverall, this flow chart helps classify animals based on their characteristics, specifically whether they have feathers, can fly, or have fins\n```\n\n## Example Execution - Handling irrelevant prompts\n\n```\n---\n\u003e\u003e what is 2 + 5 divided by 10 ?\nI'm sorry, but I can only assist with questions related to creating a flow chart.\n---\n\u003e\u003e Who won the battle of Agincourt, and why was it fought?\nI'm sorry, but I can only assist with questions related to creating a flow chart.\n---\n\u003e\u003e What is my favourite color?\nI'm sorry, but I don't have access to personal information.\n```\n\n## Dependencies\n\n- Requires an LLM - by default, uses OpenAI's ChatGPT.\n- Python 3\n- [graphviz](https://www.graphviz.org/#download)\n\n## Usage\n\nTo use as a CLI (Command Line Interface) REPL (Read-Eval-Print Loop) prompt:\n```go.sh```\n\nor to use as a web server:\n\n```go_web.sh```\n\nFor the web server, you need to pass the user prompt as GET query parameter 'p'.\n\nExample:\n\n- http://localhost:8083/?p=I%20need%20a%20make%20a%20Car%20Parts%20application\n\nSo, another application can use the web server to send in natural language prompts from the user, and receive response in the graphviz DOT format.\n\nThe other application can then generate an image or some kind of workflow, from the DOT script.\n\n## Set up\n\n```\npip3 install --upgrade openai pydot\n```\n\nSet environment variable with your OpenAI key:\n\n```\nexport OPENAI_API_KEY=\"xxx\"\n```\n\nAdd that to your shell initializing script (`~/.zprofile` or similar)\n\nLoad in current terminal:\n\n```\nsource ~/.zprofile\n```\n\n## Test\n\n`test.sh`\n\nor\n\n`python test.py`\n\n## Training (still WIP)\n\nSee [Training README](training/training-data-generator/README.md) about training a custom LLM for gpt-workflow.\n\n## Related Tools\n\n[graphviz online editor](https://dreampuf.github.io/GraphvizOnline)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrseanryan%2Fgpt-workflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrseanryan%2Fgpt-workflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrseanryan%2Fgpt-workflow/lists"}