From ab4544d8977ec0e9d6aa42b4551df8317aa9b365 Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Tue, 7 May 2024 15:17:26 -0300 Subject: [PATCH] DEV: Mark hypothetical_post_from method public (#607) --- lib/embeddings/semantic_search.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/embeddings/semantic_search.rb b/lib/embeddings/semantic_search.rb index e13ada39..8de23797 100644 --- a/lib/embeddings/semantic_search.rb +++ b/lib/embeddings/semantic_search.rb @@ -151,18 +151,6 @@ module DiscourseAi guardian.filter_allowed_categories(reranked_semantic_results) end - private - - attr_reader :guardian - - def build_hyde_key(digest, hyde_model) - "semantic-search-#{digest}-#{hyde_model}" - end - - def build_embedding_key(digest, hyde_model, embedding_model) - "#{build_hyde_key(digest, hyde_model)}-#{embedding_model}" - end - def hypothetical_post_from(search_term) prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT.strip) You are a content creator for a forum. The forum description is as follows: @@ -185,6 +173,18 @@ module DiscourseAi Nokogiri::HTML5.fragment(llm_response).at("ai")&.text&.presence || llm_response end + + private + + attr_reader :guardian + + def build_hyde_key(digest, hyde_model) + "semantic-search-#{digest}-#{hyde_model}" + end + + def build_embedding_key(digest, hyde_model, embedding_model) + "#{build_hyde_key(digest, hyde_model)}-#{embedding_model}" + end end end end