chore: Update LLM formatter classes to include additional details (#11491)
This PR introduces support for optionally exposing more data during LLM function calls. This will be useful as we expand Copilot’s capabilities. Changes included: - Add support for ArticleLlmFormatter - Add missing specs for ContactLLMFormatter and ArticleLLMFormatter - Add additional spec for ConversationLLMFormatter based on config
This commit is contained in:
22
app/services/llm_formatter/article_llm_formatter.rb
Normal file
22
app/services/llm_formatter/article_llm_formatter.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class LlmFormatter::ArticleLlmFormatter
|
||||
attr_reader :article
|
||||
|
||||
def initialize(article)
|
||||
@article = article
|
||||
end
|
||||
|
||||
def format(*)
|
||||
<<~TEXT
|
||||
Title: #{article.title}
|
||||
ID: #{article.id}
|
||||
Status: #{article.status}
|
||||
Category: #{article.category&.name || 'Uncategorized'}
|
||||
Author: #{article.author&.name || 'Unknown'}
|
||||
Views: #{article.views}
|
||||
Created At: #{article.created_at}
|
||||
Updated At: #{article.updated_at}
|
||||
Content:
|
||||
#{article.content}
|
||||
TEXT
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user