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

Conditional Loops for LLMs #3852

Open
baris-kuru opened this issue Nov 13, 2024 · 2 comments
Open

Conditional Loops for LLMs #3852

baris-kuru opened this issue Nov 13, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@baris-kuru
Copy link

Is your feature request related to a problem? Please describe.
I am trying to rerun the LLM model if the generation is hallucinated, but I am getting a circular dependency error. Is there a way to implement this logic in Prompt Flow?

Describe the solution you'd like
I would like to have a loop mechanism with max_retries if the output is not sufficient.

Describe alternatives you've considered
I was thinking of a secondary LLM to be used in case of hallucination, but then I need as many LLMs as the max retries I want to have.

Additional context

Here is my current flow:
Image

here is the error I am getting:
"variant_0 Run failed:
Invalid node definitions found in the flow graph. Node circular dependency has been detected among the nodes in your flow. Kindly review the reference relationships for the nodes ['answer_the_question_with_context', 'hallucination_grader', 'hallucination_pass', 'output_show'] and resolve the circular reference issue in the flow.
"

@baris-kuru baris-kuru added the enhancement New feature or request label Nov 13, 2024
@khangpham-arsen
Copy link

khangpham-arsen commented Nov 14, 2024

Hi, I also had similar struggle as yours. After researching, I realize that since it's a DAG flow, you are not supposed to implement any loop. To achieve that logic, you should change to use Flex flow instead.

@baris-kuru
Copy link
Author

Hi, I also had similar struggle as yours. After researching, I realize that since it's a DAG flow, you are not supposed to implement any loop. To achieve that logic, you should change to use Flex flow instead.

Thanks a lot! I will take a look into Flex flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants