2023-09-05 10:08:23 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscourseAi
|
|
|
|
module Embeddings
|
|
|
|
module VectorRepresentations
|
|
|
|
class TextEmbeddingAda002 < Base
|
2024-02-01 14:54:09 -05:00
|
|
|
class << self
|
|
|
|
def name
|
|
|
|
"text-embedding-ada-002"
|
|
|
|
end
|
|
|
|
|
|
|
|
def correctly_configured?
|
|
|
|
SiteSetting.ai_openai_api_key.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def dependant_setting_names
|
|
|
|
%w[ai_openai_api_key]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-09-05 10:08:23 -04:00
|
|
|
def id
|
|
|
|
2
|
|
|
|
end
|
|
|
|
|
|
|
|
def version
|
|
|
|
1
|
|
|
|
end
|
|
|
|
|
|
|
|
def dimensions
|
|
|
|
1536
|
|
|
|
end
|
|
|
|
|
|
|
|
def max_sequence_length
|
|
|
|
8191
|
|
|
|
end
|
|
|
|
|
|
|
|
def pg_function
|
|
|
|
"<=>"
|
|
|
|
end
|
|
|
|
|
|
|
|
def tokenizer
|
|
|
|
DiscourseAi::Tokenizer::OpenAiTokenizer
|
|
|
|
end
|
2024-11-25 11:12:43 -05:00
|
|
|
|
|
|
|
def inference_client
|
|
|
|
DiscourseAi::Inference::OpenAiEmbeddings.instance(model: self.class.name)
|
|
|
|
end
|
2023-09-05 10:08:23 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|