langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
46.75k stars 6.61k forks source link

Ability to Use Dynamic Variables in the json_schema Field of the Generator Module #8802

Open braiscg opened 2 days ago

braiscg commented 2 days ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Hello Dify.ai team,

I am encountering an issue while trying to automate the assignment of a variable from the Start module to the json_schema field in the Generator module within my workflow.

Problem Context:

In the Start module, I define two required variables: product_info and category_schema. In the Generator module, I need the json_schema field to be automatically populated with the value of the category_schema variable from the Start module. Currently, I have to manually input the json_schema, which is not efficient as I am working with many different JSON schemas. Attempts Made:

I tried referencing the variable using {{category_schema}} in the json_schema field, but it did not work. As a temporary workaround, I created separate applications for each json_schema, but this approach is not scalable.

2. Additional context or comments

Is there a way to dynamically pass the category_schema variable from the Start module to the json_schema field in the Generator module without having to manually input it each time? Any guidance or solutions to automate this process would be greatly appreciated.

I can provide the full workflow configuration file if needed for further review.

3. Can you help us with this feature?

hymanme commented 1 day ago

+1

murtaza-motorwala commented 1 day ago

Agreed. If response_format can be defined as a dynamic variable, then it would allow users to define multiple JSON schemas and choose them on run-time. I am also facing a similar challenge.