2024-05-13 11:46:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class LlmModelSerializer < ApplicationSerializer
|
|
|
|
root "llm"
|
|
|
|
|
2024-06-18 13:32:14 -04:00
|
|
|
attributes :id,
|
|
|
|
:display_name,
|
|
|
|
:name,
|
|
|
|
:provider,
|
|
|
|
:max_prompt_tokens,
|
|
|
|
:tokenizer,
|
|
|
|
:api_key,
|
|
|
|
:url,
|
|
|
|
:enabled_chat_bot,
|
2024-07-24 15:29:47 -04:00
|
|
|
:provider_params,
|
2024-08-06 13:35:35 -04:00
|
|
|
:vision_enabled,
|
|
|
|
:used_by
|
2024-06-18 13:32:14 -04:00
|
|
|
|
2024-06-19 10:21:21 -04:00
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :object
|
|
|
|
|
2024-08-06 13:35:35 -04:00
|
|
|
def used_by
|
|
|
|
DiscourseAi::Configuration::LlmValidator.new.modules_using(object)
|
2024-06-18 13:32:14 -04:00
|
|
|
end
|
2024-05-13 11:46:42 -04:00
|
|
|
end
|