mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 06:43:54 +08:00
31 lines
781 B
Ruby
Vendored
31 lines
781 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module DiscourseAi
|
|
module Agents
|
|
class CustomPrompt < Agent
|
|
def self.default_enabled
|
|
false
|
|
end
|
|
|
|
def system_prompt
|
|
<<~PROMPT.strip
|
|
You are a helpful assistant. I will give you instructions inside <input></input> XML tags.
|
|
You will look at them and reply with a result.
|
|
|
|
Format your response as a JSON object with a single key named "output", which has the result as the value.
|
|
Your output should be in the following format:
|
|
|
|
{"output": "xx"}
|
|
|
|
|
|
Where "xx" is replaced by the result.
|
|
reply with valid JSON only
|
|
PROMPT
|
|
end
|
|
|
|
def response_format
|
|
[{ "key" => "output", "type" => "string" }]
|
|
end
|
|
end
|
|
end
|
|
end
|