ianarawjo / ianarawjo/ChainForge
Feature Request: Adding If-Else Conditional Logic to ChainForge
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 256
- Avg merge
- 4h 40m
- Merged PRs (30d)
- 22
Description
## Feature Request: Conditional Logic Support
I'd like to request a critical workflow enhancement for ChainForge: the addition of conditional logic, specifically if-else functionality. After thoroughly reviewing your documentation, I haven't found a way to implement conditional branching in workflows, which significantly limits the creation of more sophisticated prompt engineering pipelines.
## Use Case Example
To illustrate why this feature is essential, let me describe a specific text expansion workflow I'm trying to implement:
1. **Step 1:** A user provides a topic (e.g., "What is the future of AI?")
2. **Step 2:** An AI analyzes the topic to determine what text structure would be most appropriate (poetry, news article, research report, or academic paper)
3. **Step 3:** Based on the structure determined in Step 2, the workflow should automatically select and execute the appropriate specialized prompt for that specific text format
With the current version of ChainForge, I can create different prompts for each potential text structure, but I have no way to dynamically route the workflow based on the AI's determination in Step 2. This forces me to either:
- Run all possible prompts regardless of relevance
- Manually intervene in the workflow, breaking automation
## Proposed Solution
I would greatly appreciate if you could consider implementing conditional logic nodes that would allow:
```
IF (output from previous node contains/matches X)
THEN (route to node A)
ELSE (route to node B)
```
Or perhaps a more sophisticated switch-case structure:
```
SWITCH (output from previous node)
CASE "poetry": (route to poetry prompt)
CASE "news": (route to news prompt)
CASE "research": (route to research prompt)
CASE "academic": (route to academic prompt)
DEFAULT: (route to general prompt)
```
## Benefits
Adding conditional logic would:
- Enable truly dynamic, responsive workflows
- Allow for more sophisticated prompt engineering patterns
- Reduce manual intervention in complex workflows
- Make the tool more competitive with other workflow automation tools
- Open up entirely new use cases for ChainForge
## Conclusion
This feature would be transformative for implementing complex, multi-stage prompt engineering workflows. Conditional logic is a standard feature in most workflow tools, and adding it to ChainForge would significantly enhance its capabilities for users working on sophisticated prompt chains.
Thank you for considering this request, and for all your excellent work on ChainForge so far. I look forward to seeing how the tool continues to evolve.
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files, tests, or entry points; begin by locating ChainForge's workflow and node execution architecture and reviewing the existing documentation. Define how conditional and switch-style routing should handle matches, branches, and defaults, then validate the described workflow can select one specialized prompt from the prior output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100