Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: make prompt generator max tokens configurable (#6693)
Sangmin Ahnecb9c311b559
diff --git a/api/.env.example b/api/.env.exampleindex 80ef185e516..cf3a0f302d6 100644--- a/api/.env.example+++ b/api/.env.example@@ -183,6 +183,7 @@ UPLOAD_IMAGE_FILE_SIZE_LIMIT=10# Model ConfigurationMULTIMODAL_SEND_IMAGE_FORMAT=base64+PROMPT_GENERATION_MAX_TOKENS=512# Mail configuration, support: resend, smtpMAIL_TYPE=diff --git a/api/controllers/console/app/generator.py b/api/controllers/console/app/generator.pyindex 4e228a70ff1..6803775e20d 100644--- a/api/controllers/console/app/generator.py+++ b/api/controllers/console/app/generator.py@@ -1,3 +1,5 @@+import os+from flask_login import current_userfrom flask_restful import Resource, reqparse@@ -28,13 +30,15 @@ class RuleGenerateApi(Resource):args = parser.parse_args()account = current_user+ PROMPT_GENERATION_MAX_TOKENS = int(os.getenv('PROMPT_GENERATION_MAX_TOKENS', '512'))try:rules = LLMGenerator.generate_rule_config(tenant_id=account.current_tenant_id,instruction=args['instruction'],model_config=args['model_config'],- no_variable=args['no_variable']+ no_variable=args['no_variable'],+ rule_config_max_tokens=PROMPT_GENERATION_MAX_TOKENS)except ProviderTokenNotInitError as ex:raise ProviderNotInitializeError(ex.description)diff --git a/api/core/llm_generator/llm_generator.py b/api/core/llm_generator/llm_generator.pyindex d6a4399fc7b..0b5029460a0 100644--- a/api/core/llm_generator/llm_generator.py+++ b/api/core/llm_generator/llm_generator.py@@ -118,7 +118,7 @@ class LLMGenerator:return questions@classmethod- def generate_rule_config(cls, tenant_id: str, instruction: str, model_config: dict, no_variable: bool) -> dict:+ def generate_rule_config(cls, tenant_id: str, instruction: str, model_config: dict, no_variable: bool, rule_config_max_tokens: int = 512) -> dict:output_parser = RuleConfigGeneratorOutputParser()error = ""@@ -130,7 +130,7 @@ class LLMGenerator:"error": ""}model_parameters = {- "max_tokens": 512,+ "max_tokens": rule_config_max_tokens,"temperature": 0.01}