Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: conditional_node #723

Merged
merged 2 commits into from
Oct 5, 2024
Merged

Conversation

ekinsenler
Copy link
Contributor

conditional_node implementation with a custom condition that can be set in the node_config. Also integrated into the the existing graph for the demonstration.

@ekinsenler
Copy link
Contributor Author

I was unable to create a more modular solution due to the requirement of state key knowledge for condition evaluation. The node must access and evaluate specific keys within the state to function correctly, particularly when parsing and evaluating complex conditions that may include built-in functions or expressions involving state variables.

Abstracting this functionality further would limit the node's ability to perform its intended purpose, as it would not have the necessary context to evaluate conditions accurately. Therefore, this implementation strikes a balance between modularity and the practical necessity of accessing state-specific information.

I welcome any suggestions on how to improve this within the constraints

@VinciGit00
Copy link
Collaborator

ok please can you provide me an example of condition?

@VinciGit00
Copy link
Collaborator

@ekinsenler btw I think we have implemented the depth search

@ekinsenler
Copy link
Contributor Author

Condition can be set on node_config

{
    'key_name': 'results',
    'condition': 'len(results) > 2'
}

Or we can just set the key_name that will be checked on the state if it exists

@ekinsenler
Copy link
Contributor Author

@ekinsenler btw I think we have implemented the depth search

Cool, is that already in beta?

@VinciGit00
Copy link
Collaborator

Condition can be set on node_config

{
    'key_name': 'results',
    'condition': 'len(results) > 2'
}

Or we can just set the key_name that will be checked on the state if it exists

thx, can u add it in the examples?

@ekinsenler ekinsenler changed the base branch from main to pre/beta October 5, 2024 11:14
@VinciGit00
Copy link
Collaborator

@ekinsenler btw I think we have implemented the depth search

Cool, is that already in beta?

yes, the name is something like depth search graph

@VinciGit00
Copy link
Collaborator

btw @ekinsenler can u remove smart scraper cond graph and add the conditional node if a condition is present? can you do for all the graphs?

@ekinsenler
Copy link
Contributor Author

@VinciGit00 that graph was mainly to demonstrate the usage of the conditional_node. And yes, it works on the other nodes aswell.

@VinciGit00 VinciGit00 merged commit ae5d2ef into ScrapeGraphAI:pre/beta Oct 5, 2024
Copy link

github-actions bot commented Oct 5, 2024

🎉 This PR is included in version 1.26.0-beta.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants