DEV: Mark hypothetical_post_from method public (#607)

This commit is contained in:
Rafael dos Santos Silva 2024-05-07 15:17:26 -03:00 committed by GitHub
parent 27827c0898
commit ab4544d897
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 12 deletions

View File

@ -151,18 +151,6 @@ module DiscourseAi
guardian.filter_allowed_categories(reranked_semantic_results) guardian.filter_allowed_categories(reranked_semantic_results)
end 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) def hypothetical_post_from(search_term)
prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT.strip) prompt = DiscourseAi::Completions::Prompt.new(<<~TEXT.strip)
You are a content creator for a forum. The forum description is as follows: 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 Nokogiri::HTML5.fragment(llm_response).at("ai")&.text&.presence || llm_response
end 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 end
end end