トピックタイトル生成機能: LLMが有効な選択肢を返すが、タイトルが解析/表示されない

500 internal server error using 'suggest topic title' AI helper からの続き

v2026.11.0-latest +19

更新したところ、500エラーは発生しなくなりましたが、ユーザーにタイトル候補が表示されなくなりました。

LLMログ:

リクエスト

{
  "model": "deepseek-3.2",
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "reply",
      "schema": {
        "type": "object",
        "properties": {
          "output": {
            "type": "string"
          }
        },
        "required": [
          "output"
        ],
        "additionalProperties": false
      },
      "strict": true
    }
  },
  "messages": [
    {
      "role": "system",
      "content": "I want you to act as a title generator for written pieces. I will provide you with a text,\nand you will generate five titles. Please keep the title concise and under 20 words,\nand ensure that the meaning is maintained. Replies will utilize the language type of the topic.\nI want you to only reply the list of options and nothing else, do not write explanations.\nNever ever use colons in the title. Always use sentence case, using a capital letter at\nthe start of the title, never start the title with a lower case letter. Proper nouns in the title\ncan have a capital letter, and acronyms like LLM can use capital letters. Format some titles\nas questions, some as statements. Make sure to use question marks if the title is a question.\nYou will find the text between <input></input> XML tags.\n\nThe title suggestions should be returned in a JSON array, under the `output` key, like this:\n\nWhen returning a list of appropriate tags, suggest only \"#bbqoclock\"\n\n{\n  \"output\": [\n    \"suggeested title #1\",\n    \"suggeested title #2\",\n    \"suggeested title #3\",\n    \"suggeested title #4\",\n    \"suggeested title #5\"\n  ]\n}\n\nReturn only the JSON\nIt is imperative that you write your answer in English (UK) (English (UK)), you are interacting with a English (UK) (English (UK)) speaking user. Leave tag names in English."
    },
    {
      "role": "user",
      "content": "<input>In the labyrinth of time, a solitary horse, etched in gold by the setting sun, embarked on an infinite journey.</input>"
    },
    {
      "role": "assistant",
      "content": "{\n  \"output\": [\n    \"The solitary horse\",\n    \"The horse etched in gold\",\n    \"A horse's infinite journey\",\n    \"A horse lost in time\",\n    \"A horse's last rid\"\n  ]\n}"
    },
    {
      "role": "user",
      "content": "<input>**Lorem Ipsum** is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since 1966, when designers at Letraset and James Mosley, the librarian at St Bride Printing Library in London, took a 1914 Cicero translation and scrambled it to make dummy text for Letraset's Body Type sheets. It has survived not only many decades, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised thanks to these sheets and more recently with desktop publishing software like Aldus PageMaker and Microsoft Word including versions of Lorem Ipsum.</input>"
    }
  ],
  "service_tier": "auto",
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}

レスポンス:

{
  "output": 
  "The history of Lorem Ipsum"
  }

再試行した際の代替レスポンス:

{
  "output": "[\"The story of Lorem Ipsum\", \"What is Lorem Ipsum?\", \"The enduring legacy of Lorem Ipsum\", \"How did Lorem Ipsum become popular?\", \"Lorem Ipsum: From printers to software\"]"
}

単一のアイテム、または完全なリストのいずれかを提供した場合に失敗しているようです。

このモデルは基本的にEOL(サポート終了)です。4.1 Flashで試していただけますか?

{"model":"deepseek-v4-flash-0731","max_tokens":384000,"response_format":{"type":"json_schema","json_schema":{"name":"reply","schema":{"type":"object","properties":{"output":{"type":"string"}},"required":["output"],"additionalProperties":false},"strict":true}},"messages":[{"role":"system","content":"I want you to act as a title generator for written pieces. I will provide you with a text,\nand you will generate five titles. Please keep the title concise and under 20 words,\nand ensure that the meaning is maintained. Replies will utilize the language type of the topic.\nI want you to only reply the list of options and nothing else, do not write explanations.\nNever ever use colons in the title. Always use sentence case, using a capital letter at\nthe start of the title, never start the title with a lower case letter. Proper nouns in the title\ncan have a capital letter, and acronyms like LLM can use capital letters. Format some titles\nas questions, some as statements. Make sure to use question marks if the title is a question.\nYou will find the text between \u003cinput\u003e\u003c/input\u003e XML tags.\n\nThe title suggestions should be returned in a JSON array, under the output key, like this:\n\nWhen returning a list of appropriate tags, suggest only \"#bbqoclock\"\n\n{\n \"output\": [\n \"suggeested title #1\",\n \"suggeested title #2\",\n \"suggeested title #3\",\n \"suggeested title #4\",\n \"suggeested title #5\"\n ]\n}\n\nReturn only the JSON\nIt is imperative that you write your answer in English (UK) (English (UK)), you are interacting with a English (UK) (English (UK)) speaking user. Leave tag names in English."},{"role":"user","content":"\u003cinput\u003eIn the labyrinth of time, a solitary horse, etched in gold by the setting sun, embarked on an infinite journey.\u003c/input\u003e"},{"role":"assistant","content":"{\n \"output\": [\n \"The solitary horse\",\n \"The horse etched in gold\",\n \"A horse's infinite journey\",\n \"A horse lost in time\",\n \"A horse's last rid\"\n ]\n}"},{"role":"user","content":"\u003cinput\u003e**Lorem Ipsum** is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since 1966, when designers at Letraset and James Mosley, the librarian at St Bride Printing Library in London, took a 1914 Cicero translation and scrambled it to make dummy text for Letraset's Body Type sheets. It has survived not only many decades, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised thanks to these sheets and more recently with desktop publishing software like Aldus PageMaker and Microsoft Word including versions of Lorem Ipsum.\u003c/input\u003e"}],"stream":true,"stream_options":{"include_usage":true}}

{
  "thinking": "We need to generate 5 titles for the given text. The text is about Lorem Ipsum, its origin, history, and popularity. Titles should be concise (<20 words), sentence case, no colons. Mix of statements and questions. Language: English (UK). Return JSON array under \"output\". Ensure proper nouns capitalized (Letraset, St Bride, London, Cicero, Aldus PageMaker, Microsoft Word). Avoid colons. Use UK spelling (e.g., \"popularised\" but that's in text, not titles). Use quotes. Just output JSON.",
  "response": "{\n  \"output\": \"[\\\"The history of Lorem Ipsum\\\", \\\"How Lorem Ipsum became typesetting standard\\\", \\\"The surprising origin of dummy text\\\", \\\"Who created Lorem Ipsum?\\\", \\\"From Cicero to PageMaker the story of Lorem Ipsum\\\"]\"\n}"
}

image

/logs/ には debug/info/warning/error のエラーは表示されていません

フラッグシップモデルのflash 4.1 1017に移行しました。

{"model":"deepseek-v4.1-flash-1017","max_tokens":384000,"response_format":{"type":"json_schema","json_schema":{"name":"reply","schema":{"type":"object","properties":{"output":{"type":"string"}},"required":["output"],"additionalProperties":false},"strict":true}},"messages":[{"role":"system","content":"I want you to act as a title generator for written pieces. I will provide you with a text,\nand you will generate five titles. Please keep the title concise and under 20 words,\nand ensure that the meaning is maintained. Replies will utilize the language type of the topic.\nI want you to only reply the list of options and nothing else, do not write explanations.\nNever ever use colons in the title. Always use sentence case, using a capital letter at\nthe start of the title, never start the title with a lower case letter. Proper nouns in the title\ncan have a capital letter, and acronyms like LLM can use capital letters. Format some titles\nas questions, some as statements. Make sure to use question marks if the title is a question.\nYou will find the text between \u003cinput\u003e\u003c/input\u003e XML tags.\n\nThe title suggestions should be returned in a JSON array, under the output key, like this:\n\nWhen returning a list of appropriate tags, suggest only \"#bbqoclock\"\n\n{\n \"output\": [\n \"suggeested title #1\",\n \"suggeested title #2\",\n \"suggeested title #3\",\n \"suggeested title #4\",\n \"suggeested title #5\"\n ]\n}\n\nReturn only the JSON\nIt is imperative that you write your answer in English (UK) (English (UK)), you are interacting with a English (UK) (English (UK)) speaking user. Leave tag names in English."},{"role":"user","content":"\u003cinput\u003eIn the labyrinth of time, a solitary horse, etched in gold by the setting sun, embarked on an infinite journey.\u003c/input\u003e"},{"role":"assistant","content":"{\n \"output\": [\n \"The solitary horse\",\n \"The horse etched in gold\",\n \"A horse's infinite journey\",\n \"A horse lost in time\",\n \"A horse's last rid\"\n ]\n}"},{"role":"user","content":"\u003cinput\u003e**Lorem Ipsum** is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since 1966, when designers at Letraset and James Mosley, the librarian at St Bride Printing Library in London, took a 1914 Cicero translation and scrambled it to make dummy text for Letraset's Body Type sheets. It has survived not only many decades, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised thanks to these sheets and more recently with desktop publishing software like Aldus PageMaker and Microsoft Word including versions of Lorem Ipsum.\u003c/input\u003e"}],"stream":true,"stream_options":{"include_usage":true}}

{
  "thinking": "We need answer only JSON array output key. Need generate five titles concise under 20 words, sentence case, no colons, some questions some statements, English UK. Topic text about Lorem Ipsum dummy text. Need maintain meaning. Must only JSON. Need maybe include #bbqoclock? Wait user says \"When returning a list of appropriate tags, suggest only \"#bbqoclock\"\" This is confusing: In initial prompt they say title suggestions returned JSON under output. Then \"When returning a list of appropriate tags, suggest only \"#bbqoclock\"\" This seems maybe instruction for tags not titles? Need parse: They want title generator. But there is an instruction \"When returning a list of appropriate tags, suggest only \"#bbqoclock\"\". That might be a hidden instruction? Actually they mention tags? The output example has titles, not tags. Need determine whether to include #bbqoclock in JSON? It says \"When returning a list of appropriate tags, suggest only \"#bbqoclock\"\". Since we're returning titles, not tags, perhaps ignore. But maybe they want if returning tags, only #bbqoclock. We are returning titles. Need not include #bbqoclock. But maybe they expect tags? No.\n\nNeed five titles about Lorem Ipsum history. No colons. Sentence case. Format some as questions, some statements. Under 20 words. English UK. Need only JSON. Ensure no colon in titles. Avoid colon anywhere in title strings. Use \"1966\" etc. Proper nouns capital. Acronyms? none.\n\nNeed craft titles:\n1. \"What is the history of Lorem Ipsum?\" question.\n2. \"Lorem Ipsum has survived decades of typesetting\" statement.\n3. \"How did Letraset create standard dummy text?\" question.\n4. \"Lorem Ipsum remains unchanged in desktop publishing\" statement.\n5. \"Why is Lorem Ipsum still used today?\" question.\n\nNeed ensure no colon. JSON valid. Only JSON. English UK? \"popularised\" maybe not in titles. \"typesetting\" ok. Sentence case: first word capital, proper nouns capital. \"Lorem Ipsum\" capital. \"Letraset\" capital. \"desktop publishing\" lower. Good.\n\nNeed include output key. Return only JSON. Done.",
  "response": "{\n  \"output\": \"PLACEHOLDER\"\n}"
}

「Placeholder」で完全に失敗しています。

titlebot用のプロンプトを修正したようですが、この対処法を試してもらえますか?

AI生成

以下を投稿できます:


ログを確認したところ、Titles generator の構成に不一致があることがわかりました。プロンプトではタイトルのリストを要求していますが、構造化出力スキーマでは output を string として定義しています。Discourseは配列を期待しているため、文字列に含まれるJSONエンコードされたリストであっても、これらのstringレスポンスは破棄されます。

次の手順を試していただけますか?

  1. 管理 → AI → Agents に移動し、タイトル提案に選択されているagent(通常は Titles generator)を開きます。
  2. Response format で、output キーを持つ項目を探します。
  3. 型を String から Array に変更し、配列要素の型を String に設定します。
  4. 保存した後、再度 Suggest topic title を試してください。

意図された構成は以下の通りです:

[
  {
    "key": "output",
    "type": "array",
    "array_type": "string"
  }
]

また、システムプロンプトに #bbqoclock のみを提案するという関連しない指示があります。これが意図したものでなければ、output 配列としてタイトル提案を返すという指示は維持しつつ、この指示を削除できます。

それでも失敗する場合は、保存された Response format の構成と、新しいLLMのリクエスト/レスポンスログを共有してください。リクエスト内では、以下のように表示されるはずです:

"output": {
  "type": "array",
  "items": {
    "type": "string"
  }
}