2023-04-04 10:24:09 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscourseAi
|
|
|
|
module Summarization
|
|
|
|
class EntryPoint
|
|
|
|
def inject_into(plugin)
|
2023-06-27 11:26:33 -04:00
|
|
|
foldable_models = [
|
|
|
|
Models::OpenAi.new("gpt-4", max_tokens: 8192),
|
|
|
|
Models::OpenAi.new("gpt-4-32k", max_tokens: 32_768),
|
|
|
|
Models::OpenAi.new("gpt-3.5-turbo", max_tokens: 4096),
|
|
|
|
Models::OpenAi.new("gpt-3.5-turbo-16k", max_tokens: 16_384),
|
2023-07-13 11:32:08 -04:00
|
|
|
Models::Anthropic.new("claude-2", max_tokens: 100_000),
|
2023-08-16 14:09:52 -04:00
|
|
|
Models::Anthropic.new("claude-instant-1", max_tokens: 100_000),
|
2023-08-03 14:29:30 -04:00
|
|
|
Models::Llama2.new("Llama2-chat-hf", max_tokens: SiteSetting.ai_hugging_face_token_limit),
|
|
|
|
Models::Llama2FineTunedOrcaStyle.new(
|
|
|
|
"StableBeluga2",
|
|
|
|
max_tokens: SiteSetting.ai_hugging_face_token_limit,
|
|
|
|
),
|
2023-06-27 11:26:33 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
foldable_models.each do |model|
|
|
|
|
plugin.register_summarization_strategy(Strategies::FoldContent.new(model))
|
|
|
|
end
|
|
|
|
|
|
|
|
truncable_models = [
|
2023-11-23 10:58:54 -05:00
|
|
|
Models::Discourse.new("long-t5-tglobal-base-16384-book-summary", max_tokens: 16_384),
|
2023-06-27 11:26:33 -04:00
|
|
|
Models::Discourse.new("bart-large-cnn-samsum", max_tokens: 1024),
|
|
|
|
Models::Discourse.new("flan-t5-base-samsum", max_tokens: 512),
|
|
|
|
]
|
|
|
|
|
|
|
|
truncable_models.each do |model|
|
|
|
|
plugin.register_summarization_strategy(Strategies::TruncateContent.new(model))
|
|
|
|
end
|
2023-04-04 10:24:09 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|