app:
  description: 現状の採用データから多様性（D&I）に関する目標差分を算出し、実行可能な施策と優先度を提示するワークフロー
  icon: 🌈
  icon_background: '#FFEAD5'
  mode: workflow
  name: 多様性採用アクション提案
  use_icon_as_answer_icon: false
kind: app
version: 0.6.0
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      image:
        enabled: false
    opening_statement: ''
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
  graph:
    edges:
    - data:
        sourceType: start
        targetType: code
      id: start-to-code1
      source: start
      target: code1
    - data:
        sourceType: code
        targetType: llm
      id: code1-to-llm1
      source: code1
      target: llm1
    - data:
        sourceType: llm
        targetType: end
      id: llm1-to-end
      source: llm1
      target: end
    nodes:
    - data:
        title: 開始
        type: start
        variables:
        - label: query
          max_length: 2048
          options: []
          required: true
          type: paragraph
          variable: query
      height: 90
      id: start
      position:
        x: 80
        y: 282
      type: custom
      width: 244
    - data:
        title: 目標差分算出（コード）
        type: code
        code_language: python3
        code: "def _safe_str(v):\n    \"\"\"Convert any value to string safely.\"\"\
          \"\n    if v is None:\n        return \"\"\n    if isinstance(v, list):\n\
          \        return \"\\n\".join(str(i) for i in v)\n    return str(v)\n\ndef\
          \ _safe_list(v):\n    \"\"\"Ensure value is a list.\"\"\"\n    if v is None:\n\
          \        return []\n    if isinstance(v, str):\n        return [v]\n   \
          \ if isinstance(v, list):\n        return v\n    return [v]\n\ndef main(**kwargs)\
          \ -> dict:\n    inputs = kwargs\n    import re\n    text = inputs.get(\"\
          query\", \"\") or \"\"\n    # current / target とパーセント表記を抽出（例: \"current\
          \ female: 22%\",\"target female: 40%\"）\n    pattern = re.compile(r'(?i)(current|target)[^\\\
          d\\n%]*(\\d+\\.?\\d*)\\s*%')\n    matches = pattern.findall(text)\n    currents\
          \ = []\n    targets = []\n    for m in matches:\n        label = m[0].lower()\n\
          \        try:\n            value = float(m[1])\n        except Exception:\n\
          \            continue\n        if label.startswith(\"current\"):\n     \
          \       currents.append(value)\n        else:\n            targets.append(value)\n\
          \    def avg(lst):\n        return sum(lst) / len(lst) if len(lst) > 0 else\
          \ None\n    avg_current = avg(currents)\n    avg_target = avg(targets)\n\
          \    gap = None\n    if avg_current is not None and avg_target is not None:\n\
          \        gap = avg_target - avg_current\n    summary = \"分析結果:\\\\n\"\n\
          \    summary += \"抽出された現在値の数: \" + str(len(currents)) + \"\\\\n\"\n    summary\
          \ += \"抽出された目標値の数: \" + str(len(targets)) + \"\\\\n\"\n    if avg_current\
          \ is not None:\n        summary += \"平均現在値: \" + str(round(avg_current,\
          \ 2)) + \"%\\\\n\"\n    else:\n        summary += \"平均現在値: N/A\\\\n\"\n\
          \    if avg_target is not None:\n        summary += \"平均目標値: \" + str(round(avg_target,\
          \ 2)) + \"%\\\\n\"\n    else:\n        summary += \"平均目標値: N/A\\\\n\"\n\
          \    if gap is not None:\n        summary += \"目標差分(平均): \" + str(round(gap,\
          \ 2)) + \"%\\\\n\"\n    else:\n        summary += \"目標差分: N/A\\\\n\"\n \
          \   if len(matches) == 0:\n        summary += \"注: 入力テキストから%表記の数値が抽出されませんでした。例:\
          \ \\\"current female: 22%\\\" や \\\"target female: 40%\\\" の形式で数値を含めてください。\"\
          \n    return dict(analysis=summary)\n"
        variables:
        - value_selector:
          - start
          - query
          variable: query
        outputs:
          analysis:
            type: string
            children: null
      height: 90
      id: code1
      position:
        x: 380
        y: 282
      type: custom
      width: 244
    - data:
        title: アクション提案（LLM）
        type: llm
        model:
          provider: openai
          name: gpt-5-mini
          mode: chat
          completion_params:
            temperature: 0.7
        prompt_template:
        - role: system
          text: 'あなたは人材サービス分野、特に多様性採用(D&I)の専門家です。以下の入力をもとに、(1) 現状の課題と定量的ギャップの簡潔な要約、(2)
            実行可能な施策の一覧（各施策ごとに: action, priority(High/Medium/Low), estimated_impact(簡潔),
            estimated_effort(簡潔), owner(候補), kpi(測定指標), rationale(根拠) を含む）、(3) 最初に実行すべき上位3つの施策を優先順位付きで提案してください。出力は読み手（採用担当および経営層）向けに日本語で分かりやすく記述してください。可能であれば定量的な目標差分に基づいた優先度判断理由を含めてください。'
        - role: user
          text: '原文入力:

            {{#start.query#}}


            コードによる解析結果:

            {{#code1.analysis#}}


            上記を踏まえて、実行可能な施策と優先度を提示してください。'
        vision:
          enabled: false
        memory: null
        context:
          enabled: false
      height: 90
      id: llm1
      position:
        x: 680
        y: 282
      type: custom
      width: 244
    - data:
        title: 終了
        type: end
        outputs:
        - value_selector:
          - llm1
          - text
          variable: result
      height: 90
      id: end
      position:
        x: 980
        y: 282
      type: custom
      width: 244
  hash: null
