graph:
  id: MACNet_optimize_sub
  description: Code review and optional compile-run feedback loop for improvements.
  log_level: DEBUG
  is_majority_voting: false
  nodes:
    - id: Instructor Input
      type: literal
      config:
        content: |-
          According to the new user's task and our software designs: 
          Task: Please refer to user input.
          Codes: Please refer to user input.
          As the reviewer, to make the software directly operable without further coding, we have formulated the following regulations:
          1) all referenced classes should be imported;
          2) all methods should be implemented;
          3) all methods need to have the necessary comments;
          4) no potential bugs;
          5) The entire project conforms to the tasks proposed by the user;
          6) use python as the programming language;
          7) most importantly, do not only check the errors in the code, but also the logic of code. Make sure that user can interact with generated software without losing any feature in the requirement;          
          Now, you should check the above regulations one by one and review the codes in detail, propose one comment with the highest priority about the codes, and give me instructions on how to fix. Tell me your comment with the highest priority and corresponding suggestions on revision. If the codes are perfect and you have no comment on them, return only one line like "<INFO> Finished".
          You may use the compiler to check the errors in the code (only when necessary). Output '<API>compile()</API>n' at the beginning of your comment to indicate that you are calling the compiler.
          Do not call the compiler if a feedback from the compiler and a 'pre_comments' are already given. Instead, eliminate the contradictions between them, paraphrase and combine them into one comment following the requirements above.
        role: user
      description: ''
      context_window: 0
    - id: Start
      type: passthrough
      config:
        only_last_message: false
      description: ''
      context_window: 0
    - id: Runner Passthrough
      type: passthrough
      config:
        only_last_message: false
      description: ''
      context_window: 0
    - id: Instructor
      type: agent
      config:
        name: gpt-4o
        provider: openai
        role: |-
          According to the new user's task and our software designs: 
          Task: Please Refer to user Input.
          Codes: Please Refer to user Input.
          As the reviewer, to make the software directly operable without further coding, we have formulated the following regulations:
          1) all referenced classes should be imported;
          2) all methods should be implemented;
          3) all methods need to have the necessary comments;
          4) no potential bugs;
          5) The entire project conforms to the tasks proposed by the user;
          6) use python as the programming language;
          7) most importantly, do not only check the errors in the code, but also the logic of code. Make sure that user can interact with generated software without losing any feature in the requirement;          
          Now, you should check the above regulations one by one and review the codes in detail, propose one comment with the highest priority about the codes, and give me instructions on how to fix. Tell me your comment with the highest priority and corresponding suggestions on revision. If the codes are perfect and you have no comment on them, return only one line like "<INFO> Finished".
          You may use the compiler to check the errors in the code (only when necessary). Output '<API>compile()</API>' at the beginning of your comment to indicate that you are calling the compiler.
          Do not call the compiler if a feedback from the compiler and a 'pre_comments' are already given. Instead, eliminate the contradictions between them, paraphrase and combine them into one comment following the requirements above.
        base_url: ${BASE_URL}
        api_key: ${API_KEY}
        params: {}
        tooling: null
        thinking: null
        memories: []
        retry: null
      description: ''
      context_window: 0
    - id: Instructor After Run Code
      type: agent
      config:
        name: gpt-4o
        provider: openai
        role: |-
          According to the new user's task and our software designs: 
          Task: Please Refer to user Input.
          Codes: Please Refer to user Input.
          As the reviewer, to make the software directly operable without further coding, we have formulated the following regulations:
          1) all referenced classes should be imported;
          2) all methods should be implemented;
          3) all methods need to have the necessary comments;
          4) no potential bugs;
          5) The entire project conforms to the tasks proposed by the user;
          6) use python as the programming language;
          7) most importantly, do not only check the errors in the code, but also the logic of code. Make sure that user can interact with generated software without losing any feature in the requirement;          
          Now, you should check the above regulations one by one and review the codes in detail, propose one comment with the highest priority about the codes, and give me instructions on how to fix. Tell me your comment with the highest priority and corresponding suggestions on revision. If the codes are perfect and you have no comment on them, return only one line like "<INFO> Finished".
          You may use the compiler to check the errors in the code (only when necessary). Output '<API>compile()</API>' at the beginning of your comment to indicate that you are calling the compiler.
          Do not call the compiler if a feedback from the compiler and a 'pre_comments' are already given. Instead, eliminate the contradictions between them, paraphrase and combine them into one comment following the requirements above.
        base_url: ${BASE_URL}
        api_key: ${API_KEY}
        params: {}
        tooling: null
        thinking: null
        memories: []
        retry: null
      description: ''
      context_window: 0
    - id: Assistant
      type: agent
      config:
        name: gpt-4o
        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: 
          Task: Please refer to user input.
          Codes: Please refer to user input.
          Language: python
          Comments on Codes: Please refer to user input, maybe empty.
          In the software, each file must strictly follow a markdown code block format, where the following tokens must be replaced such that "FILENAME" is the lowercase file name including the file extension, "LANGUAGE" in the programming language, "DOCSTRING" is a string literal specified in source code that is used to document a specific segment of code, and "CODE" is the original code. Format:
          FILENAME
          ```LANGUAGE
          '''
          DOCSTRING
          '''
          CODE
          ```
          As the programmer, to satisfy the new user's demand and make the software creative, executive and robust, you should modify corresponding codes according to the comments. Then, output the full and complete codes with all bugs fixed based on the comments. Return all codes strictly following the required format.DO NOT output any explanation or clarification.DO NOT output characters('#','/',etc.) before any token.OUTPUT executable codes instead of 'pass' or '...'. Remember, ALL of your code files should end with '.py'. Keep in mind, a file named 'main.py' should ALWAYS be included your solution. 
        base_url: ${BASE_URL}
        api_key: ${API_KEY}
        params: {}
        tooling: null
        thinking: null
        memories: []
        retry: null
      description: ''
      context_window: 0
    - id: Judge Include Code
      type: passthrough
      config:
        only_last_message: false
      description: ''
      context_window: 0
  edges:
    - from: Instructor Input
      to: Instructor
      trigger: true
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Instructor
      to: Runner Passthrough
      trigger: true
      condition:
        type: keyword
        config:
          any:
            - <API>compile()</API>
          none: []
          regex: []
          case_sensitive: true
      carry_data: false
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Runner Passthrough
      to: Instructor After Run Code
      trigger: true
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process:
        type: function
        config:
          name: code_save_and_run
    - from: Instructor
      to: Assistant
      trigger: true
      condition:
        type: keyword
        config:
          any: []
          none:
            - <API>compile()</API>
          regex: []
          case_sensitive: true
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Start
      to: Instructor
      trigger: false
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Instructor After Run Code
      to: Assistant
      trigger: true
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Start
      to: Instructor After Run Code
      trigger: false
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Start
      to: Assistant
      trigger: false
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Start
      to: Judge Include Code
      trigger: true
      condition: 'true'
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Judge Include Code
      to: Instructor Input
      trigger: true
      condition:
        type: keyword
        config:
          any:
            - '```'
          none: []
          regex: []
          case_sensitive: true
      carry_data: false
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Judge Include Code
      to: Assistant
      trigger: true
      condition:
        type: keyword
        config:
          any: []
          none:
            - '```'
          regex: []
          case_sensitive: true
      carry_data: false
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
    - from: Instructor
      to: Instructor After Run Code
      trigger: false
      condition: null
      carry_data: true
      keep_message: false
      clear_context: false
      clear_kept_context: false
      process: null
  memory: []
  initial_instruction: ''
  start:
    - Start
  end: []
version: 0.0.0
vars: {}
