FEATURE: support topic_id and post_id logging in ai audit log (#274)
This makes it easier to track who is responsible for a completion in logs Note: ai helper and summarization are not yet implemented
This commit is contained in:
@@ -53,12 +53,13 @@ module DiscourseAi
|
||||
).dig(:completion)
|
||||
end
|
||||
|
||||
def submit_prompt(prompt, prefer_low_cost: false, &blk)
|
||||
def submit_prompt(prompt, post: nil, prefer_low_cost: false, &blk)
|
||||
DiscourseAi::Inference::AnthropicCompletions.perform!(
|
||||
prompt,
|
||||
model_for,
|
||||
temperature: 0.4,
|
||||
max_tokens: 3000,
|
||||
post: post,
|
||||
&blk
|
||||
)
|
||||
end
|
||||
|
||||
@@ -137,7 +137,7 @@ module DiscourseAi
|
||||
context = {}
|
||||
functions = FunctionCalls.new
|
||||
|
||||
submit_prompt(prompt, prefer_low_cost: prefer_low_cost) do |partial, cancel|
|
||||
submit_prompt(prompt, post: post, prefer_low_cost: prefer_low_cost) do |partial, cancel|
|
||||
current_delta = get_delta(partial, context)
|
||||
partial_reply << current_delta
|
||||
|
||||
@@ -335,7 +335,14 @@ module DiscourseAi
|
||||
tokenizer.tokenize(text)
|
||||
end
|
||||
|
||||
def submit_prompt(prompt, prefer_low_cost: false, &blk)
|
||||
def submit_prompt(
|
||||
prompt,
|
||||
post:,
|
||||
prefer_low_cost: false,
|
||||
temperature: nil,
|
||||
max_tokens: nil,
|
||||
&blk
|
||||
)
|
||||
raise NotImplemented
|
||||
end
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ module DiscourseAi
|
||||
def submit_prompt(
|
||||
prompt,
|
||||
prefer_low_cost: false,
|
||||
post: nil,
|
||||
temperature: nil,
|
||||
top_p: nil,
|
||||
max_tokens: nil,
|
||||
@@ -57,7 +58,13 @@ module DiscourseAi
|
||||
|
||||
params[:functions] = available_functions if available_functions.present?
|
||||
|
||||
DiscourseAi::Inference::OpenAiCompletions.perform!(prompt, model, **params, &blk)
|
||||
DiscourseAi::Inference::OpenAiCompletions.perform!(
|
||||
prompt,
|
||||
model,
|
||||
**params,
|
||||
post: post,
|
||||
&blk
|
||||
)
|
||||
end
|
||||
|
||||
def tokenizer
|
||||
|
||||
Reference in New Issue
Block a user