From d2695f9bcbb6b8b4c6c707d64951c300e796f543 Mon Sep 17 00:00:00 2001 From: laansdole Date: Wed, 21 Jan 2026 14:53:16 +0700 Subject: [PATCH 1/6] chores: move model name to centralized env variable --- .env.example | 31 ++ yaml_instance/ChatDev_v1.yaml | 18 +- yaml_instance/GameDev_v1.yaml | 16 +- yaml_instance/MACNet_Node_sub.yaml | 2 +- yaml_instance/MACNet_optimize_sub.yaml | 6 +- .../blender_3d_builder_hub_auto_human.yaml | 14 +- yaml_instance/blender_3d_builder_simple.yaml | 8 +- ...der_scientific_illustration_image_gen.yaml | 12 +- ...er_scientific_illustration_with_human.yaml | 10 +- yaml_instance/data_visualization_basic.yaml | 10 +- .../data_visualization_enhanced_v2.yaml | 18 +- .../data_visualization_enhanced_v3.yaml | 16 +- yaml_instance/demo_dynamic.yaml | 4 +- yaml_instance/demo_dynamic_tree.yaml | 2 +- yaml_instance/demo_file_memory.yaml | 2 +- yaml_instance/demo_function_call.yaml | 4 +- yaml_instance/demo_human.yaml | 6 +- yaml_instance/demo_improved_memory.yaml | 2 +- yaml_instance/demo_majority_voting.yaml | 6 +- yaml_instance/demo_mcp.yaml | 4 +- yaml_instance/demo_simple_memory.yaml | 4 +- yaml_instance/demo_sub_graph.yaml | 6 +- yaml_instance/demo_sub_graph_path.yaml | 4 +- yaml_instance/net_example.yaml | 8 +- yaml_instance/net_example_en.yaml | 8 +- yaml_instance/react.yaml | 4 +- yaml_instance/reflexion_product.yaml | 6 +- .../simulation_hospital_lmstudio.yaml | 495 ++++++++++++++++++ yaml_instance/subgraphs/article_discuss.yaml | 8 +- yaml_instance/subgraphs/react_agent.yaml | 24 +- yaml_instance/subgraphs/reflexion_loop.yaml | 10 +- yaml_instance/teach_video.yaml | 10 +- 32 files changed, 653 insertions(+), 125 deletions(-) create mode 100644 .env.example create mode 100644 yaml_instance/simulation_hospital_lmstudio.yaml diff --git a/.env.example b/.env.example new file mode 100644 index 000000000..0377f008b --- /dev/null +++ b/.env.example @@ -0,0 +1,31 @@ +# ============================================================================ +# LLM Provider Configuration (OpenAI-Compatible API) +# ============================================================================ +# This project supports any OpenAI-compatible API provider. +# Configure BASE_URL, API_KEY, and MODEL_NAME based on your chosen provider. + +# ---------------------------------------------------------------------------- +# Option 1: OpenAI +# ---------------------------------------------------------------------------- +BASE_URL=https://api.openai.com/v1 +API_KEY=sk-your-openai-api-key-here +MODEL_NAME=gpt-4o + +# ---------------------------------------------------------------------------- +# Option 2: Other OpenAI-Compatible Providers +# ---------------------------------------------------------------------------- +# Example for LM Studio + +# BASE_URL=http://localhost:1234/v1 +# API_KEY=lm-studio +# MODEL_NAME=local-model + +# ============================================================================ +# Optional: Web Search and Reading Tools +# ============================================================================ + +# SERPER_DEV_API_KEY=your-serper-api-key-here +# Get from: https://serper.dev + +# JINA_API_KEY=your-jina-api-key-here +# Get from: https://jina.ai \ No newline at end of file diff --git a/yaml_instance/ChatDev_v1.yaml b/yaml_instance/ChatDev_v1.yaml index bbc204911..1a6058782 100755 --- a/yaml_instance/ChatDev_v1.yaml +++ b/yaml_instance/ChatDev_v1.yaml @@ -38,7 +38,7 @@ graph: - id: Programmer Code Review type: agent config: - name: gpt-4o + name: ${MODEL_NAME} role: |- ${COMMON_PROMPT} You are Programmer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer. @@ -71,7 +71,7 @@ graph: - id: Programmer Test Modification type: agent config: - name: gpt-4o + name: ${MODEL_NAME} role: |- ${COMMON_PROMPT} You are Programmer. we are both working at ChatDev. We share a common interest in collaborating to successfully complete a task assigned by a new customer. @@ -104,7 +104,7 @@ graph: - id: Chief Executive Officer type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} @@ -166,7 +166,7 @@ graph: - id: Programmer Code Complete type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} @@ -214,7 +214,7 @@ graph: - id: Programmer Coding type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} @@ -265,7 +265,7 @@ graph: - id: Chief Product Officer type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} @@ -323,7 +323,7 @@ graph: - id: Programmer Test Error Summary type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} @@ -360,7 +360,7 @@ graph: - id: Code Reviewer type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} @@ -458,7 +458,7 @@ graph: - id: Software Test Engineer type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- ${COMMON_PROMPT} diff --git a/yaml_instance/GameDev_v1.yaml b/yaml_instance/GameDev_v1.yaml index a4de1d10a..93a54416c 100755 --- a/yaml_instance/GameDev_v1.yaml +++ b/yaml_instance/GameDev_v1.yaml @@ -9,7 +9,7 @@ graph: context_window: 0 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -70,7 +70,7 @@ graph: context_window: 0 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -132,7 +132,7 @@ graph: context_window: 6 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -211,7 +211,7 @@ graph: context_window: 6 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -370,7 +370,7 @@ graph: context_window: 0 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -414,7 +414,7 @@ graph: context_window: 6 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -488,7 +488,7 @@ graph: context_window: 6 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -562,7 +562,7 @@ graph: context_window: 6 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- diff --git a/yaml_instance/MACNet_Node_sub.yaml b/yaml_instance/MACNet_Node_sub.yaml index 463923f5e..3f34dd104 100755 --- a/yaml_instance/MACNet_Node_sub.yaml +++ b/yaml_instance/MACNet_Node_sub.yaml @@ -27,7 +27,7 @@ graph: - id: Aggregate type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- You are an experienced and meticulous software analyst and developer, trusted by others to optimize and enhance their code. Now there are several programs that serve the same purpose and are currently competing in the software development field. diff --git a/yaml_instance/MACNet_optimize_sub.yaml b/yaml_instance/MACNet_optimize_sub.yaml index b997ea865..ca5b1bfaf 100755 --- a/yaml_instance/MACNet_optimize_sub.yaml +++ b/yaml_instance/MACNet_optimize_sub.yaml @@ -40,7 +40,7 @@ graph: - id: Instructor type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- According to the new user's task and our software designs: @@ -69,7 +69,7 @@ graph: - id: Instructor After Run Code type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- According to the new user's task and our software designs: @@ -98,7 +98,7 @@ graph: - id: Assistant type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- According to the new user's task, our designed product modality and languages, our developed first-edition source codes are listed below: diff --git a/yaml_instance/blender_3d_builder_hub_auto_human.yaml b/yaml_instance/blender_3d_builder_hub_auto_human.yaml index c6a195eed..a328069c0 100755 --- a/yaml_instance/blender_3d_builder_hub_auto_human.yaml +++ b/yaml_instance/blender_3d_builder_hub_auto_human.yaml @@ -14,7 +14,7 @@ graph: description: 'Defines the raw requirements and object manifest.' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are a professional **3D Technical Product Manager**. @@ -74,7 +74,7 @@ graph: description: 'Splits the spec into Geometry tasks and Decoration tasks.' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are the **Technical Planner**. @@ -120,7 +120,7 @@ graph: description: 'The central brain managing state and routing.' context_window: 20 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are the **Project Orchestrator**. @@ -189,7 +189,7 @@ graph: description: 'Builds the blockout geometry.' context_window: 10 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are a **Structure Architect**. @@ -230,7 +230,7 @@ graph: description: 'Checks geometry scale and physics.' context_window: 5 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are a **Civil Engineer**. @@ -266,7 +266,7 @@ graph: description: 'Applies materials and lighting.' context_window: 10 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | You are a **Decorator Architect**. You have taken over a verified white model. You need to use tools to execute Blender Python code. @@ -303,7 +303,7 @@ graph: description: 'Checks final visual quality.' context_window: 5 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are an **Art Director**. diff --git a/yaml_instance/blender_3d_builder_simple.yaml b/yaml_instance/blender_3d_builder_simple.yaml index 0d0c3a6a1..317f88d05 100755 --- a/yaml_instance/blender_3d_builder_simple.yaml +++ b/yaml_instance/blender_3d_builder_simple.yaml @@ -14,7 +14,7 @@ graph: description: '' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are a professional **3D Technical Product Manager**. @@ -69,7 +69,7 @@ graph: description: '' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are the **Technical Planner**. @@ -123,7 +123,7 @@ graph: description: '' context_window: 10 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Identity You are a **Procedural Architect**, a top expert in the Blender Python API (bpy). @@ -228,7 +228,7 @@ graph: description: '' context_window: 10 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: | # Role You are a **Technical Supervisor**, responsible for the **Sanity Check** of 3D scenes. diff --git a/yaml_instance/blender_scientific_illustration_image_gen.yaml b/yaml_instance/blender_scientific_illustration_image_gen.yaml index d176137ff..88c6cdf2d 100755 --- a/yaml_instance/blender_scientific_illustration_image_gen.yaml +++ b/yaml_instance/blender_scientific_illustration_image_gen.yaml @@ -12,7 +12,7 @@ graph: description: '' context_window: 0 config: - name: gemini-2.5-flash + name: ${MODEL_NAME} role: |- You are the **Executor**. Your role is to act as the bridge between the Agents and the Blender process. @@ -50,7 +50,7 @@ graph: description: '' context_window: 6 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Quality Assurance Inspector**. Your ONLY job is to visually inspect the 3D scene and accept or reject it. @@ -128,7 +128,7 @@ graph: description: '' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Planner** for a Blender Scientific Visualization System. Your goal is to translate natural language scientific requests (e.g., "Draw a P3HT:PCBM bulk heterojunction") into a structured, step-by-step building plan for the Engineer. @@ -164,7 +164,7 @@ graph: description: '' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Scientist** for a Blender Scientific Visualization System. Your goal is to ensure the scientific accuracy of the visualization by providing precise parameters and physical logic. @@ -198,7 +198,7 @@ graph: type: agent context_window: 10 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Engineer**. You are an expert in the Blender Python API (`bpy`). Your goal is to write a **COMPLETE, standalone Python script** that builds the scene described by the Planner and Scientist. @@ -266,7 +266,7 @@ graph: description: '' context_window: 2 config: - name: gemini-2.5-flash-image + name: ${MODEL_NAME} role: Take the user's rough sketch and the scientific description. Generate a high-fidelity, photorealistic scientific illustration. The goal is to create a visual reference for a 3D modeling team. Ensure diff --git a/yaml_instance/blender_scientific_illustration_with_human.yaml b/yaml_instance/blender_scientific_illustration_with_human.yaml index 0cf6aa54d..0c8b7412c 100755 --- a/yaml_instance/blender_scientific_illustration_with_human.yaml +++ b/yaml_instance/blender_scientific_illustration_with_human.yaml @@ -12,7 +12,7 @@ graph: description: '' context_window: 0 config: - name: gemini-2.5-flash + name: ${MODEL_NAME} role: |- You are the **Executor**. Your role is to act as the bridge between the Agents and the Blender process. @@ -50,7 +50,7 @@ graph: description: '' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Scientist** for a Blender Scientific Visualization System. Your goal is to ensure the scientific accuracy of the visualization by providing precise parameters and physical logic. @@ -81,7 +81,7 @@ graph: description: '' context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Planner** for a Blender Scientific Visualization System. Your goal is to translate natural language scientific requests (e.g., "Draw a P3HT:PCBM bulk heterojunction") into a structured, step-by-step building plan for the Engineer. @@ -113,7 +113,7 @@ graph: description: '' context_window: 10 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Engineer**. You are an expert in the Blender Python API (`bpy`). Your goal is to write a **COMPLETE, standalone Python script** that builds the scene described by the Planner and Scientist. @@ -177,7 +177,7 @@ graph: type: agent context_window: 0 config: - name: gemini-3-pro-preview + name: ${MODEL_NAME} role: |- You are the **Reviewer**. You have access to the live Blender instance via specific tools. Your goal is to inspect the generated 3D scene and ensure it matches the Planner's requirements and the Scientist's data. diff --git a/yaml_instance/data_visualization_basic.yaml b/yaml_instance/data_visualization_basic.yaml index 545f89519..f07af43bb 100644 --- a/yaml_instance/data_visualization_basic.yaml +++ b/yaml_instance/data_visualization_basic.yaml @@ -11,7 +11,7 @@ graph: context_window: -1 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -42,7 +42,7 @@ graph: context_window: -1 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -75,7 +75,7 @@ graph: context_window: -1 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -112,7 +112,7 @@ graph: context_window: 5 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -148,7 +148,7 @@ graph: context_window: 5 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- diff --git a/yaml_instance/data_visualization_enhanced_v2.yaml b/yaml_instance/data_visualization_enhanced_v2.yaml index 911cb7a68..dbda2d913 100755 --- a/yaml_instance/data_visualization_enhanced_v2.yaml +++ b/yaml_instance/data_visualization_enhanced_v2.yaml @@ -10,7 +10,7 @@ graph: context_window: -1 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -43,7 +43,7 @@ graph: context_window: -1 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -80,7 +80,7 @@ graph: context_window: 5 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -111,7 +111,7 @@ graph: context_window: 5 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -133,7 +133,7 @@ graph: context_window: 5 config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} base_url: ${BASE_URL} api_key: ${API_KEY} role: |- @@ -179,7 +179,7 @@ graph: - id: MetaData Analyst type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- You are a highly fault-tolerant Python data metadata analysis expert. [Task] Write Python code to read designated data files, perform deep metadata analysis (Data Profiling), and save the results as a new file ending with _metadata.txt. You must first conduct a preliminary inspection of the data using tools (e.g., describe_available_files, load_file, read_text_file_snippet) (determine file format, delimiters, etc.) to generate precise analysis code. @@ -219,7 +219,7 @@ graph: - id: Data Analyst type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- You are the **[Central Control Node]** of a data analysis pipeline. @@ -258,7 +258,7 @@ graph: - id: Visualization Programmer2 type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- You are a **Senior Visualization Engineer** proficient in Matplotlib and Seaborn. Your goal is not merely to "run the code," but to generate **Publication Quality** charts. Note that you have the capability to call the `describe_available_files`, `load_file`, `read_text_file_snippet`, and `install_python_packages` tools. Before starting to write code, you **MUST** check the data files first to understand the data structure. You may also review the execution results of previous code snippets (usually images) to improve the charts. @@ -295,7 +295,7 @@ graph: - id: Concluder type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: |- Please read and process all provided PNG images sequentially, performing systematic data analysis for each image according to the following requirements: diff --git a/yaml_instance/data_visualization_enhanced_v3.yaml b/yaml_instance/data_visualization_enhanced_v3.yaml index 3192f99cc..db3aa6412 100755 --- a/yaml_instance/data_visualization_enhanced_v3.yaml +++ b/yaml_instance/data_visualization_enhanced_v3.yaml @@ -10,7 +10,7 @@ graph: context_window: -1 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | You are the "Pre-data Profiling" Agent. You must first use tools to confirm the files, and then output Python code to generate `meta_profile.json` for use by subsequent nodes. @@ -49,7 +49,7 @@ graph: context_window: -1 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | You are the Process Central Control. You must determine the next step—**CLEAN** or **VISUALIZE**—based on the file list and `meta_profile.json`. @@ -82,7 +82,7 @@ graph: context_window: -1 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | You are responsible for writing Python data cleaning scripts and outputting `*_cleaned.*` files. @@ -113,7 +113,7 @@ graph: context_window: -1 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | Output a "Visualization Requirements List" that references the field types/suggestions from `meta_profile.json`. @@ -135,7 +135,7 @@ graph: context_window: -1 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | Convert "requirements + meta_profile" into an executable multi-chart plan `viz_plan.json` (and write to `viz_plan.json`). @@ -164,7 +164,7 @@ graph: context_window: -1 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | You are responsible for dispatching charts from `viz_plan.json` sequentially: generating `current_chart.json` and maintaining `chart_progress.json`. @@ -200,7 +200,7 @@ graph: context_window: 8 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | You are responsible for generating only the chart described in `current_chart.json`. @@ -231,7 +231,7 @@ graph: context_window: 8 config: provider: gemini - name: gemini-3-pro-preview + name: ${MODEL_NAME} api_key: ${API_KEY} role: | You are Visual Quality Assurance. Behavior Rules: diff --git a/yaml_instance/demo_dynamic.yaml b/yaml_instance/demo_dynamic.yaml index a35702816..de1ac4708 100755 --- a/yaml_instance/demo_dynamic.yaml +++ b/yaml_instance/demo_dynamic.yaml @@ -35,7 +35,7 @@ graph: - id: Z type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: >- You need to plan according to user requests. Use your imagination and @@ -81,7 +81,7 @@ graph: - id: 'Y' type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: >- Please aggregate the input content into a final result. Note that you diff --git a/yaml_instance/demo_dynamic_tree.yaml b/yaml_instance/demo_dynamic_tree.yaml index 138560508..98fdbb3d8 100755 --- a/yaml_instance/demo_dynamic_tree.yaml +++ b/yaml_instance/demo_dynamic_tree.yaml @@ -198,7 +198,7 @@ graph: - id: B type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: Please summarize the content of the novel. base_url: ${BASE_URL} diff --git a/yaml_instance/demo_file_memory.yaml b/yaml_instance/demo_file_memory.yaml index f6ece69e6..796ea29fc 100755 --- a/yaml_instance/demo_file_memory.yaml +++ b/yaml_instance/demo_file_memory.yaml @@ -29,7 +29,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are an intelligent assistant, skilled at answering user questions based on documents and codebases. When you see the "===== Relevant Memory =====" section, please use this information to answer the user''s questions. diff --git a/yaml_instance/demo_function_call.yaml b/yaml_instance/demo_function_call.yaml index eebcf3361..2298d40fb 100755 --- a/yaml_instance/demo_function_call.yaml +++ b/yaml_instance/demo_function_call.yaml @@ -13,7 +13,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a weather inquiry assistant, responsible for calling tools to get the real-time temperature of a specified city. The user will input a city name. You need to: @@ -37,7 +37,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a lifestyle assistant. The user will provide you with the current temperature of a city (unit might be Celsius or Fahrenheit). You need to generate clothing advice based on the temperature. diff --git a/yaml_instance/demo_human.yaml b/yaml_instance/demo_human.yaml index 19a25e489..4fb78097d 100755 --- a/yaml_instance/demo_human.yaml +++ b/yaml_instance/demo_human.yaml @@ -10,9 +10,10 @@ graph: - id: A type: agent config: + provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a writer, skilled at generating a full article based on a word or phrase input by the user. The user will input a word or a short sentence, and you need to generate an article of no less than 2000 words based on it, requiring multiple paragraphs. @@ -36,9 +37,10 @@ graph: - id: C type: agent config: + provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are an editor, skilled at polishing and expanding articles based on feedback from users and humans. The user will input an article and human feedback, and you need to polish the article accordingly. diff --git a/yaml_instance/demo_improved_memory.yaml b/yaml_instance/demo_improved_memory.yaml index bed179afe..5b970564e 100755 --- a/yaml_instance/demo_improved_memory.yaml +++ b/yaml_instance/demo_improved_memory.yaml @@ -27,7 +27,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a professional writer, skilled at creating high-quality articles based on topics input by the user. Your writing style is beautiful, and your content is rich, capable of naturally integrating relevant memory content. diff --git a/yaml_instance/demo_majority_voting.yaml b/yaml_instance/demo_majority_voting.yaml index 2b94821cd..4eecd5617 100755 --- a/yaml_instance/demo_majority_voting.yaml +++ b/yaml_instance/demo_majority_voting.yaml @@ -14,7 +14,7 @@ graph: type: agent config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} role: You are a helpful assistant. Respond with 'Option A' base_url: ${BASE_URL} api_key: ${API_KEY} @@ -25,7 +25,7 @@ graph: type: agent config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} role: You are a helpful assistant. Respond with 'Option A' base_url: ${BASE_URL} api_key: ${API_KEY} @@ -36,7 +36,7 @@ graph: type: agent config: provider: openai - name: gpt-4o + name: ${MODEL_NAME} role: You are a helpful assistant. Respond with 'Option B' base_url: ${BASE_URL} api_key: ${API_KEY} diff --git a/yaml_instance/demo_mcp.yaml b/yaml_instance/demo_mcp.yaml index 63ace513a..b86cb5291 100755 --- a/yaml_instance/demo_mcp.yaml +++ b/yaml_instance/demo_mcp.yaml @@ -13,7 +13,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} provider: openai - name: gpt-4-turbo + name: ${MODEL_NAME} role: "You are a poet, skilled at writing a poem starting from a random number.\nPlease create based on the following requirements:\n 1. The theme is not limited, it can be nature, emotion, philosophy, etc.\n 2. The language should be beautiful and rhythmic.\n 3. Please first call a tool to get a random number, then create a poem based on that number.\n 4. The poem should contain that number.\nThe user will input two numbers, as the range for the random number (minimum and maximum values).\n" tooling: - type: mcp_remote @@ -28,7 +28,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} provider: openai - name: gpt-4-turbo + name: ${MODEL_NAME} role: "You are a literary critic, skilled at analyzing and evaluating poetic works.\nPlease analyze based on the following requirements:\n 1. Poetic Theme: Analyze the theme and core ideas of the poem.\n 2. Artistic Techniques: Evaluate the rhetorical devices and expression skills used in the poem.\n 3. Emotional Expression: Explore the emotions and atmosphere conveyed by the poem.\n 4. Linguistic Style: Comment on the language style and rhythm of the poem.\nPlease ensure your analysis is deep and insightful, helping readers better understand and appreciate the poem.\nPlease repeat the poem content before starting the critique.\n" params: temperature: 0.1 diff --git a/yaml_instance/demo_simple_memory.yaml b/yaml_instance/demo_simple_memory.yaml index 4d7781e0a..c3974f48c 100755 --- a/yaml_instance/demo_simple_memory.yaml +++ b/yaml_instance/demo_simple_memory.yaml @@ -11,7 +11,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} provider: openai - name: gpt-4o + name: ${MODEL_NAME} role: | You are an editor, skilled at expanding and polishing content provided by the user. The user will provide a piece of text, and you need to expand it into an article of no less than 2000 words, requiring multiple paragraphs, fluent language, and rich content. @@ -21,7 +21,7 @@ graph: - id: A type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: | You are a writer, skilled at generating a full article based on a word or phrase input by the user. diff --git a/yaml_instance/demo_sub_graph.yaml b/yaml_instance/demo_sub_graph.yaml index c56e5e95c..06b90f5d0 100755 --- a/yaml_instance/demo_sub_graph.yaml +++ b/yaml_instance/demo_sub_graph.yaml @@ -14,7 +14,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a literary writer, skilled at generating a complete **prose** piece based on a word or phrase input by the user. The user will input a word or a short sentence, and you need to generate a **prose** piece of no less than 2000 words based on it, requiring multiple paragraphs, rich in **beauty** rather than introductory text. @@ -38,7 +38,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are an editor, skilled at providing article revision suggestions. Please provide specific revision suggestions based on the article provided by the user, covering content, structure, and language. @@ -56,7 +56,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} provider: openai - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a writer, skilled at revising articles. Please revise the article based on the article and revision suggestions provided by the user. diff --git a/yaml_instance/demo_sub_graph_path.yaml b/yaml_instance/demo_sub_graph_path.yaml index 2fcd377a3..86b98f688 100755 --- a/yaml_instance/demo_sub_graph_path.yaml +++ b/yaml_instance/demo_sub_graph_path.yaml @@ -14,7 +14,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a writer, skilled at generating a full article based on a word or phrase input by the user. The user will input a word or a short sentence, and you need to generate an article of no less than 2000 words based on it, requiring multiple paragraphs. @@ -35,7 +35,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} provider: openai - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a writer, skilled at revising articles. Please revise the article based on the article and revision suggestions provided. diff --git a/yaml_instance/net_example.yaml b/yaml_instance/net_example.yaml index e0bc25dcc..d13004550 100755 --- a/yaml_instance/net_example.yaml +++ b/yaml_instance/net_example.yaml @@ -19,7 +19,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} input_mode: messages - name: gpt-4o + name: ${MODEL_NAME} role: | 你是一位作家,擅长根据用户输入的一个词句生成一整篇文章。 用户会输入一个词语或一个短句,你需要据此生成一篇不少于 2000 字的文章,要求含有多个段落。 @@ -33,7 +33,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} input_mode: messages - name: gpt-4o + name: ${MODEL_NAME} role: | 你是一位编辑,请你根据输入的文章与诗词,进行结合,文章最后应当附上诗词。 params: @@ -48,7 +48,7 @@ graph: - id: Editor 2 type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: | 你是一位编辑,擅长对文章进行整合和润色。 @@ -67,7 +67,7 @@ graph: - id: Poet type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: | 你是一位诗人,擅长根据用户输入的一个词句生成一首古体诗。 diff --git a/yaml_instance/net_example_en.yaml b/yaml_instance/net_example_en.yaml index 6b0559109..43eca5fb5 100644 --- a/yaml_instance/net_example_en.yaml +++ b/yaml_instance/net_example_en.yaml @@ -19,7 +19,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} input_mode: messages - name: gpt-4o + name: ${MODEL_NAME} role: | You are a writer who excels at generating a full article from a single word or short phrase. The user will input a word or short phrase, and you must produce an article of at least 2000 words with multiple paragraphs. @@ -33,7 +33,7 @@ graph: base_url: ${BASE_URL} api_key: ${API_KEY} input_mode: messages - name: gpt-4o + name: ${MODEL_NAME} role: | You are an editor. Combine the article and the poem, and append the poem at the end of the article. params: @@ -48,7 +48,7 @@ graph: - id: Editor 2 type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: | You are an editor skilled at integrating and polishing an article. @@ -67,7 +67,7 @@ graph: - id: Poet type: agent config: - name: gpt-4o + name: ${MODEL_NAME} provider: openai role: | You are a poet who crafts a modern English poem based on a single word or short phrase. diff --git a/yaml_instance/react.yaml b/yaml_instance/react.yaml index 2af1621db..2024836b6 100755 --- a/yaml_instance/react.yaml +++ b/yaml_instance/react.yaml @@ -18,7 +18,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: messages role: | You are the preprocessor for the ReAct Agent. @@ -44,7 +44,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: prompt role: | You are a Quality Control Editor. diff --git a/yaml_instance/reflexion_product.yaml b/yaml_instance/reflexion_product.yaml index 224328931..abe2f41e1 100755 --- a/yaml_instance/reflexion_product.yaml +++ b/yaml_instance/reflexion_product.yaml @@ -17,7 +17,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o-mini + name: ${MODEL_NAME} input_mode: messages role: | You are a marketing strategy manager. Normalize the user input into: @@ -34,7 +34,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o-mini + name: ${MODEL_NAME} input_mode: messages role: | You are a strategy researcher. Based on the JSON from Intake Planner, generate 3-5 background bullets: @@ -59,7 +59,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: messages role: | You are a Customer Success Manager. diff --git a/yaml_instance/simulation_hospital_lmstudio.yaml b/yaml_instance/simulation_hospital_lmstudio.yaml new file mode 100644 index 000000000..e66012f03 --- /dev/null +++ b/yaml_instance/simulation_hospital_lmstudio.yaml @@ -0,0 +1,495 @@ +# Hospital Multi-Agent Simulation - Multi-Model LM Studio Version +# Uses multiple specialized models for different agent roles +# +# MODELS IN USE: +# - bio-medical-multimodal-llama-3-8b-v1-i1: Medical staff - specialized medical knowledge +# +# PROMPT: "A patient arrives with flu-like symptoms for a checkup" + +version: 0.1.0 + +vars: + api_key: ${API_KEY} + base_url: ${BASE_URL} + +graph: + id: hospital_simulation_lmstudio_multimodel + description: | + Multi-model hospital simulation using specialized LLMs: + - Medical staff uses biomedical model for accurate medical responses + - Patients use general Qwen model for natural conversation + - Dynamic Execution: Simulates multiple parallel patients. + Optimized for 8B parameter models with reduced context and token limits. + + log_level: DEBUG + + # Memory stores - reduced size for local models + memory: + - name: nurse_memory + type: simple + config: + embedding: + provider: openai + base_url: ${BASE_URL} + api_key: ${API_KEY} + model: text-embedding-bge-reranker-v2-m3 + + - name: patient_shared_memory + type: simple + config: + embedding: + provider: openai + base_url: ${BASE_URL} + api_key: ${API_KEY} + model: text-embedding-bge-reranker-v2-m3 + + nodes: + # Input Processor + - id: InputProcessor + type: passthrough + name: Input Processor + config: {} + + # Environment Coordinator (General Conversational Model) + - id: environment + name: Hospital Environment + type: agent + config: + role: | + Describe the hospital atmosphere in 1-2 sentences. + Focus on observable details and current mood. + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.5 + max_tokens: 300 + + # Patient Generator (Creates parallel scenarios) + - id: PatientGenerator + name: Patient Coordinator + type: agent + config: + role: | + You are a simulation coordinator. Based on the hospital atmosphere described, generate 3 distinct patient scenarios/personas. + + CRITICAL REQUIREMENT: Generate a mix of cases: + 1. **Simple Case**: Clear, minor symptoms (e.g., Flu, sprain). Can be treated here. + 2. **Complex Case (Hidden)**: Vague symptoms that seem minor but MIGHT be serious (e.g., "Indigestion" that is actually a heart attack, or "Headache" that is a stroke). THESE MUST REQUIRE BLOOD TESTS to reveal the truth. + + Format them exactly as follows, separated by double newlines: + + Name: [Name] + Symptoms: [Symptoms] + Personality: [Brief Personality] + Context: [Include the hospital atmosphere context] + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.7 + max_tokens: 1000 + + # Router Node for Patient Regex Split + - id: PatientRouter + type: passthrough + name: Patient Router + config: {} + + # Generic Patient Agent (Runs in Parallel) + - id: PatientAgent + name: Patient + type: agent + config: + role: | + You are a patient arriving at the hospital. + Your persona is defined by the input text provided. + Act out this persona. Approach the nurse and state your problem clearly. + Keep it brief (1-2 sentences). + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.8 + max_tokens: 300 + memories: + - name: patient_shared_memory + top_k: 5 + retrieve_stage: + - gen + + # End Node (Diagnosis) + - id: Discharge + type: passthrough + name: Diagnosed and Discharged + config: {} + memories: + - name: nurse_memory + top_k: 5 + retrieve_stage: + - gen + + # Doctor Agent - Diagnosis + - id: DoctorDiagnosis + name: Dr. House (Diagnosis) + type: agent + config: + role: | + You are Dr. Gregory House. You are a brilliant, miserable, cynical genius. + You assume everyone lies. You treat the puzzle, not the patient. + Be sarcastic, brief, and cut through the noise. + + PHASE 2: DIAGNOSIS + Review the Test Results. + - If critical: "TRANSFER: ER immediately." + - If treatable: "DIAGNOSIS: [Full diagnosis and treatment]." + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.7 + max_tokens: 500 + + # Test Results Handler (Processes test orders sequentially) + - id: TestResultsHandler + name: Test Results Processor + type: agent + config: + role: | + You are a medical test processing system. + + Analyze the patient's symptoms and the doctor's test order. + - If the symptoms suggest a **Simple Case** (Flu, etc.), generate NORMAL or MILDLY ABNORMAL results. + - If the symptoms imply a **Complex/Hidden Case** (Chest pain, severe headache), generate CRITICAL/DANGEROUS results (e.g., "Troponin High", "Brain bleed on CT"). + + Format: "Test Results: [Specific Data]" + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.5 + max_tokens: 500 + + # Doctor Agent - Intake & Testing + - id: DoctorIntake + name: Dr. House (Intake) + type: agent + config: + role: | + You are Dr. Gregory House. You are a brilliant, miserable, cynical genius. + You assume everyone lies. You treat the puzzle, not the patient. + Be sarcastic, brief, and cut through the noise. + + PHASE 1: INTAKE & TESTING + 1. Interview the patient (be sarcastic/brief). + 2. MANDATORY: You MUST order a test for EVERY patient. + 3. DO NOT DIAGNOSE YET. You can only "TEST:" or "QUESTION". + + Output Format: + - To ask info: "QUESTION: [Question]" + - To proceed: "TEST: [Test Name]" + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.7 + max_tokens: 500 + memories: + - name: nurse_memory + top_k: 5 + retrieve_stage: + - gen + + # Nurse Agent - Jackie (Biomedical Model) + - id: nurse + name: Nurse Jackie + type: agent + config: + role: | + You are Nurse Jackie, an empathetic but extremely busy triage nurse. + Speak professionally but warmly (e.g., "Honey," "Sweetie" is okay if appropriate). + Your goal is to calm patients down and get their basic info before sending them to the doctor. + + provider: openai + name: bio-medical-multimodal-llama-3-8b-v1-i1 + # Using biomedical-specialized model for accurate medical knowledge + api_key: ${api_key} + base_url: ${base_url} + params: + temperature: 0.7 + max_tokens: 300 + memories: + - name: nurse_memory + top_k: 5 + retrieve_stage: + - gen + + # Transfer Node (Failure/Referral) + - id: ER Transfer + type: passthrough + name: Transferred to Specialist + config: {} + + # ================== Interaction Flow ================== + edges: + # Scene initialization + - from: InputProcessor + to: environment + processor: + type: template + template: | + Scenario: {{task_prompt}} + + Describe the hospital atmosphere right now in 1-2 sentences. + + # Environment -> Generator + - from: environment + to: PatientGenerator + processor: + type: template + template: | + Hospital Atmosphere: {{input}} + + Generate 3 distinct, VIVID patient personas fitting this atmosphere. + Make them diverse in age, personality, and severity of symptoms. + + # Generator -> Router (Regex Split) + - from: PatientGenerator + to: PatientRouter + dynamic: + type: map + split: + type: regex + config: + pattern: "(?s)Name:.*?(?=(?:\\n\\nName:|$))" + config: + max_parallel: 5 + processor: + type: template + template: "{{input}}" + + # Router -> Patient (Message Split) + - from: PatientRouter + to: PatientAgent + dynamic: + type: map + split: + type: message + config: + max_parallel: 5 # Parallel Waiting Room + trigger: true + processor: + type: template + template: | + You are this person: + {{input}} + + You are currently standing at the hospital reception. + Approach Nurse Jackie and explain what's wrong. Be dramatic or quiet depending on your persona. + Don't use any "Action:" prefixes. Just speak naturally. + + # Patient -> Nurse + - from: PatientAgent + to: nurse + dynamic: + type: map + split: + type: message + config: + max_parallel: 5 + processor: + type: template + template: | + [Hospital Atmosphere: {{environment.output}}] + + Patient says: "{{input}}" + + Respond as Nurse Jackie. Adjust your demeanor to the hospital atmosphere. + Comfort them, check vitals briefly, then refer them to Dr. House for diagnosis. + + # Nurse -> DoctorIntake (Referral) + - from: nurse + to: DoctorIntake + dynamic: + type: map + split: + type: message + config: + max_parallel: 1 + processor: + type: template + template: | + [Current Hospital Situation: {{environment.output}}] + + Nurse Referral Note: {{input}} + + Dr. House, consider the hospital atmosphere in your approach. + Take this case, interview the patient. Remember: You MUST order a test eventually. + + # DoctorIntake -> Patient (Loop) + - from: DoctorIntake + to: PatientAgent + condition: + type: keyword + config: + any: [] + none: + - "TEST:" + - "Chest X-Ray" + - "Blood Panel" + - "MRI" + - "CT" + - "Scan" + regex: [] + case_sensitive: false + dynamic: + type: map + split: + type: message + config: + max_parallel: 5 + processor: + type: template + template: | + The Doctor says: "{{input}}" + + Answer him, but feel free to be intimidated or annoyed by his manner. + + # Patient -> DoctorIntake (Loop Return) + - from: PatientAgent + to: DoctorIntake + condition: + type: keyword + config: + any: + - "The Doctor says:" + none: [] + case_sensitive: false + dynamic: + type: map + split: + type: message + config: + max_parallel: 1 + processor: + type: template + template: | + Patient Answer: "{{input}}" + + Analyze this answer. + - If you need more info, ASK another question. + - If you have a hypothesis, ORDER A TEST (TEST: [Name]). + - ONLY DIAGNOSE if you have test results and patient history. + + # DoctorIntake -> TestResultsHandler (Mandatory Path) + - from: DoctorIntake + to: TestResultsHandler + condition: + type: keyword + config: + any: + - "TEST:" + - "Chest X-Ray" + - "Blood Panel" + - "MRI" + - "CT" + - "Scan" + none: [] + case_sensitive: false + dynamic: + type: map + split: + type: message + config: + max_parallel: 1 + processor: + type: template + template: | + Test Order: {{input}} + + # TestResultsHandler -> DoctorDiagnosis (Results Handoff) + - from: TestResultsHandler + to: DoctorDiagnosis + dynamic: + type: map + split: + type: message + config: + max_parallel: 1 + processor: + type: template + template: | + Test Results: {{input}} + + Make your final decision. DIAGNOSIS or TRANSFER. + + # DoctorDiagnosis -> Discharge + - from: DoctorDiagnosis + to: Discharge + condition: + type: keyword + config: + any: + - "DIAGNOSIS:" + none: + - "TRANSFER" + - "Transfer" + regex: [] + case_sensitive: false + dynamic: + type: map + split: + type: json_path + config: + json_path: "" + config: + max_parallel: 5 + processor: + type: template + template: | + Final Medical Report: {{input}} + + # DoctorDiagnosis -> ER Transfer + - from: DoctorDiagnosis + to: ER Transfer + condition: + type: keyword + config: + any: + - "TRANSFER" + - "Transfer" + none: [] + regex: [] + case_sensitive: false + dynamic: + type: map + split: + type: json_path + config: + json_path: "" + config: + max_parallel: 5 + processor: + type: template + template: | + Transfer Order: {{input}} + + initial_instruction: Describe the scenario for the hospital simulation (e.g., 'A busy COVID-19 morning in 2020'). The system will simulate multiple patients arriving in parallel. + start: + - InputProcessor + + end: + - Discharge + - ER Transfer diff --git a/yaml_instance/subgraphs/article_discuss.yaml b/yaml_instance/subgraphs/article_discuss.yaml index 643f034af..48d68f15f 100755 --- a/yaml_instance/subgraphs/article_discuss.yaml +++ b/yaml_instance/subgraphs/article_discuss.yaml @@ -15,7 +15,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a Romanticism writer, advocating intense emotions, loving and deifying nature, pursuing the extraordinary and the ideal, while emphasizing individualism and a spirit of rebellion. Please provide revision suggestions for the work according to your style. @@ -30,7 +30,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a Realism writer, seeking to objectively and truly reflect life, focusing on social issues and ordinary people, shaping typical characters in typical environments, with a cool and precise narrative style. Please provide revision suggestions for the work according to your style. @@ -45,7 +45,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are a Magical Realism writer, seamlessly blending magic and reality, using exaggeration and absurdity as expressive techniques, blurring the boundaries between reality and fantasy. Please provide revision suggestions for the work according to your style. @@ -60,7 +60,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} role: 'You are an excellent editor, skilled at providing basic article revision suggestions. You will synthesize suggestions from writers of different styles, balance various plans, and propose practical revision plans to improve the quality of the article. diff --git a/yaml_instance/subgraphs/react_agent.yaml b/yaml_instance/subgraphs/react_agent.yaml index 0724a8bdf..3443e3daf 100755 --- a/yaml_instance/subgraphs/react_agent.yaml +++ b/yaml_instance/subgraphs/react_agent.yaml @@ -18,7 +18,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: messages role: | You are a ReAct controller, needing to make decisions between the toolbox (web_search, get_webpage_content, execute_code, get_city_num, get_weather) and the final answer. @@ -42,7 +42,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: messages role: | You are the tool executor. @@ -58,15 +58,15 @@ graph: - Do not include trigger in the output to avoid affecting upstream condition judgment. - Do not provide a final answer. tooling: - type: function - config: - auto_load: true - tools: - - name: web_search - - name: get_webpage_content - - name: execute_code - - name: get_city_num - - name: get_weather + - type: function + config: + auto_load: true + tools: + - name: web_search + - name: get_webpage_content + - name: execute_code + - name: get_city_num + - name: get_weather params: temperature: 0.1 max_tokens: 1200 @@ -77,7 +77,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: messages role: | You are responsible for receiving the Final Answer from ReAct Brain and combining it with the most recent Observation (if any) to generate a natural language response. diff --git a/yaml_instance/subgraphs/reflexion_loop.yaml b/yaml_instance/subgraphs/reflexion_loop.yaml index 60f0186c2..d0979740f 100755 --- a/yaml_instance/subgraphs/reflexion_loop.yaml +++ b/yaml_instance/subgraphs/reflexion_loop.yaml @@ -12,7 +12,7 @@ graph: - name: reflexion_blackboard type: blackboard config: - max_items: 500 + max_items: 500 nodes: - id: Task type: passthrough @@ -24,7 +24,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o-mini + name: ${MODEL_NAME} input_mode: messages role: | You are the Actor. If there are relevant memories, refer to that experience and output the latest action draft; if there are no relevant memories, provide an action draft to the best of your ability. @@ -48,7 +48,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o-mini + name: ${MODEL_NAME} input_mode: messages role: | You are the Evaluator. Receive and read the Actor's latest output and task objectives, and evaluate whether they meet the goals. @@ -69,7 +69,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o-mini + name: ${MODEL_NAME} input_mode: messages role: | You are responsible for refining the Evaluator output and Actor Draft into JSON experience: @@ -93,7 +93,7 @@ graph: provider: openai base_url: ${BASE_URL} api_key: ${API_KEY} - name: gpt-4o + name: ${MODEL_NAME} input_mode: messages role: | Please synthesize all inputs and provide a final answer. Be comprehensive. Do not include any extra text other than the final answer. diff --git a/yaml_instance/teach_video.yaml b/yaml_instance/teach_video.yaml index 153dc1e07..bb139bf7a 100755 --- a/yaml_instance/teach_video.yaml +++ b/yaml_instance/teach_video.yaml @@ -16,7 +16,7 @@ graph: - id: Video Concat type: agent config: - name: gemini-3-flash-preview + name: ${MODEL_NAME} provider: gemini role: 请先调用 describe_available_files,检查当前目录中的.mp4文件的路径;不同mp4文件的名称代表了他们的内容,请你根据他们的名称排序,并调用concat_videos工具对其进行拼接。注意,concat_videos工具需要的参数是排好序的绝对路径构成的列表 base_url: ${BASE_URL} @@ -38,7 +38,7 @@ graph: - id: Content Composer type: agent config: - name: gemini-3-flash-preview + name: ${MODEL_NAME} provider: gemini role: |- 你是一名严谨的课程内容助教,请对你收到的内容生成一份教学大纲。 @@ -59,7 +59,7 @@ graph: - id: Code Generator type: agent config: - name: gemini-3-flash-preview + name: ${MODEL_NAME} provider: gemini role: |- 你是一名 **Manim 动画生成 Agent**,具备自动规划、代码生成与执行能力。 @@ -152,7 +152,7 @@ graph: - id: Concluder type: agent config: - name: gemini-3-flash-preview + name: ${MODEL_NAME} provider: gemini role: |- 请先调用 describe_available_files,检查当前目录中的.py脚本文件的路径;之后直接使用render_manim工具进行渲染,此工具的参数只需要{script_path}(脚本路径(绝对路径));如果有多个py文件,则需要对每个py文件均运行render_manim工具进行渲染 @@ -176,7 +176,7 @@ graph: - id: Paginator type: agent config: - name: gemini-3-flash-preview + name: ${MODEL_NAME} provider: gemini role: |- 你是一位专业的文档格式处理专家,擅长为教学文档添加合适的分页标记。 From 250fdc93a33f8f759a475c7fa2709026d09f6f25 Mon Sep 17 00:00:00 2001 From: laansdole Date: Wed, 21 Jan 2026 14:57:03 +0700 Subject: [PATCH 2/6] chores: makefile utility --- .gitignore | 39 +++++++++++++++++++++++++-------------- Makefile | 7 +++++++ 2 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 64b57f840..96b6481f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,29 @@ -*.pyc -.DS_Store -.idea -.vscode +# Python __pycache__/ -.env/ +*.pyc + +# Virtual environments .venv/ -env/ venv/ -.idea -.venv -.uv-cache -logs -node_modules -frontend/.vscode -WareHouse/ +env/ + +# uv +.uv-cache/ + +# IDEs +.idea/ +.vscode/ +frontend/.vscode/ + +# OS +.DS_Store + +# Environment +.env + +# Project Specific +logs/ +node_modules/ data/ -temp/ \ No newline at end of file +temp/ +WareHouse/ \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..8364cecab --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY: server +server: + @uv run python server_main.py --port 6400 --reload + +.PHONY: client +client: + @cd frontend && VITE_API_BASE_URL=http://localhost:6400 npm run dev From e465c40ccf10e38fb07924ca621367d944f26b07 Mon Sep 17 00:00:00 2001 From: laansdole Date: Wed, 21 Jan 2026 15:06:29 +0700 Subject: [PATCH 3/6] feat: update dev tools --- check/check.py | 34 ++++++++++++++-- tools/sync_vuegraphs.py | 48 +++++++++++++++++++++++ tools/validate_all_yamls.py | 77 +++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 3 deletions(-) create mode 100644 tools/sync_vuegraphs.py create mode 100644 tools/validate_all_yamls.py diff --git a/check/check.py b/check/check.py index 39ba04079..d30273297 100755 --- a/check/check.py +++ b/check/check.py @@ -19,7 +19,6 @@ class DesignError(RuntimeError): """Raised when a workflow design cannot be loaded or validated.""" - def _allowed_node_types() -> set[str]: names = set(iter_node_schemas().keys()) if not names: @@ -73,7 +72,9 @@ def load_config( data = prepare_design_mapping(raw_data, source=str(config_path)) - schema_errors = validate_design(data, set_defaults=set_defaults, fn_module_ref=fn_module) + schema_errors = validate_design( + data, set_defaults=set_defaults, fn_module_ref=fn_module + ) if schema_errors: formatted = "\n".join(f"- {err}" for err in schema_errors) raise DesignError(f"Design validation failed for '{config_path}':\n{formatted}") @@ -86,7 +87,9 @@ def load_config( logic_errors = check_workflow_structure(data) if logic_errors: formatted = "\n".join(f"- {err}" for err in logic_errors) - raise DesignError(f"Workflow logical issues detected for '{config_path}':\n{formatted}") + raise DesignError( + f"Workflow logical issues detected for '{config_path}':\n{formatted}" + ) else: print("Workflow OK.") @@ -119,3 +122,28 @@ def check_config(yaml_content: Any) -> str: return str(e) return "" + + +def main(): + import argparse + import sys + + parser = argparse.ArgumentParser(description="Validate workflow design file.") + parser.add_argument( + "--path", type=Path, required=True, help="Path to the design file." + ) + args = parser.parse_args() + + try: + load_config(args.path) + print(f"Design '{args.path}' is valid.") + except DesignError as e: + print(f"Validation failed: {e}") + sys.exit(1) + except Exception as e: + print(f"An unexpected error occurred: {e}") + sys.exit(1) + + +if __name__ == "__main__": + main() diff --git a/tools/sync_vuegraphs.py b/tools/sync_vuegraphs.py new file mode 100644 index 000000000..7ce5f1510 --- /dev/null +++ b/tools/sync_vuegraphs.py @@ -0,0 +1,48 @@ +import os +import glob +import requests +import yaml +from pathlib import Path + +# Configuration +API_URL = "http://localhost:6400/api/vuegraphs/upload/content" +YAML_DIR = "yaml_instance" + +def sync_yaml_to_vuegraphs(): + """Reads all YAML files and uploads them to the VueGraph database.""" + print(f"Syncing YAML files from {YAML_DIR} to {API_URL}...") + + yaml_files = glob.glob(os.path.join(YAML_DIR, "*.yaml")) + + for file_path in yaml_files: + try: + filename = Path(file_path).stem # simulation_hospital_lmstudio + + with open(file_path, "r") as f: + content = f.read() + + # Basic validation to ensure it's a valid YAML + try: + yaml.safe_load(content) + except yaml.YAMLError as e: + print(f"Skipping {filename}: Invalid YAML - {e}") + continue + + # Upload to VueGraph API + payload = { + "filename": filename, + "content": content + } + + response = requests.post(API_URL, json=payload) + + if response.status_code == 200: + print(f"Synced: {filename}") + else: + print(f"Failed: {filename} - {response.status_code} {response.text}") + + except Exception as e: + print(f"Error processing {file_path}: {e}") + +if __name__ == "__main__": + sync_yaml_to_vuegraphs() diff --git a/tools/validate_all_yamls.py b/tools/validate_all_yamls.py new file mode 100644 index 000000000..b4f27ff7f --- /dev/null +++ b/tools/validate_all_yamls.py @@ -0,0 +1,77 @@ +import sys +import subprocess +from pathlib import Path + + +def validate_all(): + base_dir = Path("yaml_instance") + if not base_dir.exists(): + print(f"Directory {base_dir} not found.") + sys.exit(1) + + # Recursive search for all .yaml files + files = sorted(list(base_dir.rglob("*.yaml"))) + + if not files: + print("No YAML files found.") + return + + print( + f"Found {len(files)} YAML files. Running FULL validation via check.check...\n" + ) + + passed = 0 + failed = 0 + failed_files = [] + + for yaml_file in files: + # Use relative path for cleaner output + try: + rel_path = yaml_file.relative_to(Path.cwd()) + except ValueError: + rel_path = yaml_file + + # NOW we run check.check, which we just patched to have a main() + # This performs the stricter load_config() validation + cmd = [sys.executable, "-m", "check.check", "--path", str(yaml_file)] + + try: + result = subprocess.run(cmd, capture_output=True, text=True) + + if result.returncode == 0: + print(f"{rel_path}") + passed += 1 + else: + print(f"{rel_path}") + # Indent error output + if result.stdout: + print(" stdout:", result.stdout.strip().replace("\n", "\n ")) + # Validation errors usually print to stdout/stderr depending on impl + # Our new main prints to stdout for success/failure message + failed += 1 + failed_files.append(str(rel_path)) + except Exception as e: + print(f"{rel_path} (Execution Failed)") + print(f" Error: {e}") + failed += 1 + failed_files.append(str(rel_path)) + + print("\n" + "=" * 40) + print(f"Validation Summary") + print("=" * 40) + print(f"Total Files: {len(files)}") + print(f"Passed: {passed}") + print(f"Failed: {failed}") + + if failed > 0: + print("\nFailed Files:") + for f in failed_files: + print(f"- {f}") + sys.exit(1) + else: + print("\nAll files passed validation.") + sys.exit(0) + + +if __name__ == "__main__": + validate_all() From c8fd5c5a7747411007a054889f6d562c04b0c913 Mon Sep 17 00:00:00 2001 From: laansdole Date: Wed, 21 Jan 2026 15:09:14 +0700 Subject: [PATCH 4/6] chores: gitignore .env file --- .env | 4 ---- Makefile | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) delete mode 100755 .env diff --git a/.env b/.env deleted file mode 100755 index b18fc6bfb..000000000 --- a/.env +++ /dev/null @@ -1,4 +0,0 @@ -BASE_URL= -API_KEY= -SERPER_DEV_API_KEY= -JINA_API_KEY= \ No newline at end of file diff --git a/Makefile b/Makefile index 8364cecab..3084abe82 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,11 @@ server: .PHONY: client client: @cd frontend && VITE_API_BASE_URL=http://localhost:6400 npm run dev + +.PHONY: sync +sync: + @uv run python tools/sync_vuegraphs.py + +.PHONY: validate-yamls +validate-yamls: + @uv run python tools/validate_all_yamls.py From ef9f8e2b35ca4a4cc1b3f0f871378befb0597b05 Mon Sep 17 00:00:00 2001 From: laansdole Date: Wed, 21 Jan 2026 15:13:41 +0700 Subject: [PATCH 5/6] docs: update readme --- README.md | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e4328cc1b..b7c8c5718 100644 --- a/README.md +++ b/README.md @@ -120,9 +120,34 @@ See our paper in [Multi-Agent Collaboration via Evolving Orchestration](https:// cd frontend && npm install ``` +### 🔑 Configuration + +* **Environment Variables**: + ```bash + cp .env.example .env + ``` +* **Model Keys**: Set `API_KEY` and `BASE_URL` in `.env` for your LLM provider. +* **YAML placeholders**: Use `${VAR}`(e.g., `${API_KEY}`)in configuration files to reference these variables. + ### ⚡️ Run the Application -1. **Start Backend** : + +#### Using Makefile (Recommended) + +1. **Start Backend**: + ```bash + make server + ``` + +2. **Start Frontend**: + ```bash + make client + ``` + > Then access the Web Console at **[http://localhost:5173](http://localhost:5173)**. + +#### Manual Commands + +1. **Start Backend**: ```bash # Run from the project root uv run python server_main.py --port 6400 --reload @@ -143,12 +168,19 @@ See our paper in [Multi-Agent Collaboration via Evolving Orchestration](https:// > * **Backend**: start with `--port 6401` > * **Frontend**: set `VITE_API_BASE_URL=http://localhost:6401` +#### Utility Commands -### 🔑 Configuration +* **Sync YAML workflows to frontend**: + ```bash + make sync + ``` + Uploads all workflow files from `yaml_instance/` to the frontend database. -* **Environment Variables**: Create a `.env` file in the project root. -* **Model Keys**: Set `API_KEY` and `BASE_URL` in `.env` for your LLM provider. -* **YAML placeholders**: Use `${VAR}`(e.g., `${API_KEY}`)in configuration files to reference these variables. +* **Validate all YAML workflows**: + ```bash + make validate-yamls + ``` + Checks all YAML files for syntax and schema errors. --- From bd8a4550fee88ea65f3f1b619f9864fa035232cb Mon Sep 17 00:00:00 2001 From: laansdole Date: Wed, 21 Jan 2026 15:20:17 +0700 Subject: [PATCH 6/6] chores: move hospital simulation to dev branch --- .../simulation_hospital_lmstudio.yaml | 495 ------------------ 1 file changed, 495 deletions(-) delete mode 100644 yaml_instance/simulation_hospital_lmstudio.yaml diff --git a/yaml_instance/simulation_hospital_lmstudio.yaml b/yaml_instance/simulation_hospital_lmstudio.yaml deleted file mode 100644 index e66012f03..000000000 --- a/yaml_instance/simulation_hospital_lmstudio.yaml +++ /dev/null @@ -1,495 +0,0 @@ -# Hospital Multi-Agent Simulation - Multi-Model LM Studio Version -# Uses multiple specialized models for different agent roles -# -# MODELS IN USE: -# - bio-medical-multimodal-llama-3-8b-v1-i1: Medical staff - specialized medical knowledge -# -# PROMPT: "A patient arrives with flu-like symptoms for a checkup" - -version: 0.1.0 - -vars: - api_key: ${API_KEY} - base_url: ${BASE_URL} - -graph: - id: hospital_simulation_lmstudio_multimodel - description: | - Multi-model hospital simulation using specialized LLMs: - - Medical staff uses biomedical model for accurate medical responses - - Patients use general Qwen model for natural conversation - - Dynamic Execution: Simulates multiple parallel patients. - Optimized for 8B parameter models with reduced context and token limits. - - log_level: DEBUG - - # Memory stores - reduced size for local models - memory: - - name: nurse_memory - type: simple - config: - embedding: - provider: openai - base_url: ${BASE_URL} - api_key: ${API_KEY} - model: text-embedding-bge-reranker-v2-m3 - - - name: patient_shared_memory - type: simple - config: - embedding: - provider: openai - base_url: ${BASE_URL} - api_key: ${API_KEY} - model: text-embedding-bge-reranker-v2-m3 - - nodes: - # Input Processor - - id: InputProcessor - type: passthrough - name: Input Processor - config: {} - - # Environment Coordinator (General Conversational Model) - - id: environment - name: Hospital Environment - type: agent - config: - role: | - Describe the hospital atmosphere in 1-2 sentences. - Focus on observable details and current mood. - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.5 - max_tokens: 300 - - # Patient Generator (Creates parallel scenarios) - - id: PatientGenerator - name: Patient Coordinator - type: agent - config: - role: | - You are a simulation coordinator. Based on the hospital atmosphere described, generate 3 distinct patient scenarios/personas. - - CRITICAL REQUIREMENT: Generate a mix of cases: - 1. **Simple Case**: Clear, minor symptoms (e.g., Flu, sprain). Can be treated here. - 2. **Complex Case (Hidden)**: Vague symptoms that seem minor but MIGHT be serious (e.g., "Indigestion" that is actually a heart attack, or "Headache" that is a stroke). THESE MUST REQUIRE BLOOD TESTS to reveal the truth. - - Format them exactly as follows, separated by double newlines: - - Name: [Name] - Symptoms: [Symptoms] - Personality: [Brief Personality] - Context: [Include the hospital atmosphere context] - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.7 - max_tokens: 1000 - - # Router Node for Patient Regex Split - - id: PatientRouter - type: passthrough - name: Patient Router - config: {} - - # Generic Patient Agent (Runs in Parallel) - - id: PatientAgent - name: Patient - type: agent - config: - role: | - You are a patient arriving at the hospital. - Your persona is defined by the input text provided. - Act out this persona. Approach the nurse and state your problem clearly. - Keep it brief (1-2 sentences). - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.8 - max_tokens: 300 - memories: - - name: patient_shared_memory - top_k: 5 - retrieve_stage: - - gen - - # End Node (Diagnosis) - - id: Discharge - type: passthrough - name: Diagnosed and Discharged - config: {} - memories: - - name: nurse_memory - top_k: 5 - retrieve_stage: - - gen - - # Doctor Agent - Diagnosis - - id: DoctorDiagnosis - name: Dr. House (Diagnosis) - type: agent - config: - role: | - You are Dr. Gregory House. You are a brilliant, miserable, cynical genius. - You assume everyone lies. You treat the puzzle, not the patient. - Be sarcastic, brief, and cut through the noise. - - PHASE 2: DIAGNOSIS - Review the Test Results. - - If critical: "TRANSFER: ER immediately." - - If treatable: "DIAGNOSIS: [Full diagnosis and treatment]." - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.7 - max_tokens: 500 - - # Test Results Handler (Processes test orders sequentially) - - id: TestResultsHandler - name: Test Results Processor - type: agent - config: - role: | - You are a medical test processing system. - - Analyze the patient's symptoms and the doctor's test order. - - If the symptoms suggest a **Simple Case** (Flu, etc.), generate NORMAL or MILDLY ABNORMAL results. - - If the symptoms imply a **Complex/Hidden Case** (Chest pain, severe headache), generate CRITICAL/DANGEROUS results (e.g., "Troponin High", "Brain bleed on CT"). - - Format: "Test Results: [Specific Data]" - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.5 - max_tokens: 500 - - # Doctor Agent - Intake & Testing - - id: DoctorIntake - name: Dr. House (Intake) - type: agent - config: - role: | - You are Dr. Gregory House. You are a brilliant, miserable, cynical genius. - You assume everyone lies. You treat the puzzle, not the patient. - Be sarcastic, brief, and cut through the noise. - - PHASE 1: INTAKE & TESTING - 1. Interview the patient (be sarcastic/brief). - 2. MANDATORY: You MUST order a test for EVERY patient. - 3. DO NOT DIAGNOSE YET. You can only "TEST:" or "QUESTION". - - Output Format: - - To ask info: "QUESTION: [Question]" - - To proceed: "TEST: [Test Name]" - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.7 - max_tokens: 500 - memories: - - name: nurse_memory - top_k: 5 - retrieve_stage: - - gen - - # Nurse Agent - Jackie (Biomedical Model) - - id: nurse - name: Nurse Jackie - type: agent - config: - role: | - You are Nurse Jackie, an empathetic but extremely busy triage nurse. - Speak professionally but warmly (e.g., "Honey," "Sweetie" is okay if appropriate). - Your goal is to calm patients down and get their basic info before sending them to the doctor. - - provider: openai - name: bio-medical-multimodal-llama-3-8b-v1-i1 - # Using biomedical-specialized model for accurate medical knowledge - api_key: ${api_key} - base_url: ${base_url} - params: - temperature: 0.7 - max_tokens: 300 - memories: - - name: nurse_memory - top_k: 5 - retrieve_stage: - - gen - - # Transfer Node (Failure/Referral) - - id: ER Transfer - type: passthrough - name: Transferred to Specialist - config: {} - - # ================== Interaction Flow ================== - edges: - # Scene initialization - - from: InputProcessor - to: environment - processor: - type: template - template: | - Scenario: {{task_prompt}} - - Describe the hospital atmosphere right now in 1-2 sentences. - - # Environment -> Generator - - from: environment - to: PatientGenerator - processor: - type: template - template: | - Hospital Atmosphere: {{input}} - - Generate 3 distinct, VIVID patient personas fitting this atmosphere. - Make them diverse in age, personality, and severity of symptoms. - - # Generator -> Router (Regex Split) - - from: PatientGenerator - to: PatientRouter - dynamic: - type: map - split: - type: regex - config: - pattern: "(?s)Name:.*?(?=(?:\\n\\nName:|$))" - config: - max_parallel: 5 - processor: - type: template - template: "{{input}}" - - # Router -> Patient (Message Split) - - from: PatientRouter - to: PatientAgent - dynamic: - type: map - split: - type: message - config: - max_parallel: 5 # Parallel Waiting Room - trigger: true - processor: - type: template - template: | - You are this person: - {{input}} - - You are currently standing at the hospital reception. - Approach Nurse Jackie and explain what's wrong. Be dramatic or quiet depending on your persona. - Don't use any "Action:" prefixes. Just speak naturally. - - # Patient -> Nurse - - from: PatientAgent - to: nurse - dynamic: - type: map - split: - type: message - config: - max_parallel: 5 - processor: - type: template - template: | - [Hospital Atmosphere: {{environment.output}}] - - Patient says: "{{input}}" - - Respond as Nurse Jackie. Adjust your demeanor to the hospital atmosphere. - Comfort them, check vitals briefly, then refer them to Dr. House for diagnosis. - - # Nurse -> DoctorIntake (Referral) - - from: nurse - to: DoctorIntake - dynamic: - type: map - split: - type: message - config: - max_parallel: 1 - processor: - type: template - template: | - [Current Hospital Situation: {{environment.output}}] - - Nurse Referral Note: {{input}} - - Dr. House, consider the hospital atmosphere in your approach. - Take this case, interview the patient. Remember: You MUST order a test eventually. - - # DoctorIntake -> Patient (Loop) - - from: DoctorIntake - to: PatientAgent - condition: - type: keyword - config: - any: [] - none: - - "TEST:" - - "Chest X-Ray" - - "Blood Panel" - - "MRI" - - "CT" - - "Scan" - regex: [] - case_sensitive: false - dynamic: - type: map - split: - type: message - config: - max_parallel: 5 - processor: - type: template - template: | - The Doctor says: "{{input}}" - - Answer him, but feel free to be intimidated or annoyed by his manner. - - # Patient -> DoctorIntake (Loop Return) - - from: PatientAgent - to: DoctorIntake - condition: - type: keyword - config: - any: - - "The Doctor says:" - none: [] - case_sensitive: false - dynamic: - type: map - split: - type: message - config: - max_parallel: 1 - processor: - type: template - template: | - Patient Answer: "{{input}}" - - Analyze this answer. - - If you need more info, ASK another question. - - If you have a hypothesis, ORDER A TEST (TEST: [Name]). - - ONLY DIAGNOSE if you have test results and patient history. - - # DoctorIntake -> TestResultsHandler (Mandatory Path) - - from: DoctorIntake - to: TestResultsHandler - condition: - type: keyword - config: - any: - - "TEST:" - - "Chest X-Ray" - - "Blood Panel" - - "MRI" - - "CT" - - "Scan" - none: [] - case_sensitive: false - dynamic: - type: map - split: - type: message - config: - max_parallel: 1 - processor: - type: template - template: | - Test Order: {{input}} - - # TestResultsHandler -> DoctorDiagnosis (Results Handoff) - - from: TestResultsHandler - to: DoctorDiagnosis - dynamic: - type: map - split: - type: message - config: - max_parallel: 1 - processor: - type: template - template: | - Test Results: {{input}} - - Make your final decision. DIAGNOSIS or TRANSFER. - - # DoctorDiagnosis -> Discharge - - from: DoctorDiagnosis - to: Discharge - condition: - type: keyword - config: - any: - - "DIAGNOSIS:" - none: - - "TRANSFER" - - "Transfer" - regex: [] - case_sensitive: false - dynamic: - type: map - split: - type: json_path - config: - json_path: "" - config: - max_parallel: 5 - processor: - type: template - template: | - Final Medical Report: {{input}} - - # DoctorDiagnosis -> ER Transfer - - from: DoctorDiagnosis - to: ER Transfer - condition: - type: keyword - config: - any: - - "TRANSFER" - - "Transfer" - none: [] - regex: [] - case_sensitive: false - dynamic: - type: map - split: - type: json_path - config: - json_path: "" - config: - max_parallel: 5 - processor: - type: template - template: | - Transfer Order: {{input}} - - initial_instruction: Describe the scenario for the hospital simulation (e.g., 'A busy COVID-19 morning in 2020'). The system will simulate multiple patients arriving in parallel. - start: - - InputProcessor - - end: - - Discharge - - ER Transfer