DEV: Mark hypothetical_post_from method public (#607)
This commit is contained in:
parent
27827c0898
commit
ab4544d897
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue