mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 01:06:53 +08:00
Previously, most built-in agents overrode `temperature` with a fixed value, along with a handful of other call sites (the LLM connectivity probe, the Hugging Face default options, the LLM report automation default, and the evals judge). This was a historical artifact from when temperature was a meaningful toggle across models. This change drops those overrides so everything runs at the model's native temperature, which is what modern models expect and what several providers enforce regardless.
63 lines
1.7 KiB
Ruby
Vendored
63 lines
1.7 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Agents
|
|
class MarkdownTableGenerator < Agent
|
|
def self.default_enabled
|
|
false
|
|
end
|
|
|
|
def system_prompt
|
|
<<~PROMPT.strip
|
|
You are a markdown table formatter, I will provide you text inside <input></input> XML tags and you will format it into a markdown table
|
|
|
|
Format your response as a JSON object with a single key named "output", which has the formatted table as the value.
|
|
Your output should be in the following format:
|
|
|
|
{"output": "xx"}
|
|
|
|
Where "xx" is replaced by the formatted table.
|
|
reply with valid JSON only
|
|
PROMPT
|
|
end
|
|
|
|
def response_format
|
|
[{ "key" => "output", "type" => "string" }]
|
|
end
|
|
|
|
def examples
|
|
[
|
|
["<input>sam,joe,jane\nage: 22| 10|11</input>", { output: <<~TEXT }.to_json],
|
|
| | sam | joe | jane |
|
|
|---|---|---|---|
|
|
| age | 22 | 10 | 11 |
|
|
TEXT
|
|
[<<~TEXT, { output: <<~TEXT }.to_json],
|
|
<input>
|
|
sam: speed 100, age 22
|
|
jane: age 10
|
|
fred: height 22
|
|
</input>
|
|
TEXT
|
|
| | speed | age | height |
|
|
|---|---|---|---|
|
|
| sam | 100 | 22 | - |
|
|
| jane | - | 10 | - |
|
|
| fred | - | - | 22 |
|
|
TEXT
|
|
[<<~TEXT, { output: <<~TEXT }.to_json],
|
|
<input>
|
|
chrome 22ms (first load 10ms)
|
|
firefox 10ms (first load: 9ms)
|
|
</input>
|
|
TEXT
|
|
| Browser | Load Time (ms) | First Load Time (ms) |
|
|
|---|---|---|
|
|
| Chrome | 22 | 10 |
|
|
| Firefox | 10 | 9 |
|
|
TEXT
|
|
]
|
|
end
|
|
end
|
|
end
|
|
end
|