FEATURE: improve logging by including llm name (#640)
Log the language model name when logging api requests
This commit is contained in:
parent
d8a0f44fed
commit
baf88e7cfc
|
@ -31,4 +31,5 @@ end
|
||||||
# topic_id :integer
|
# topic_id :integer
|
||||||
# post_id :integer
|
# post_id :integer
|
||||||
# feature_name :string(255)
|
# feature_name :string(255)
|
||||||
|
# language_model :string(255)
|
||||||
#
|
#
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
class AddLanguageModelToAiAuditLogs < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column :ai_api_audit_logs, :language_model, :string, limit: 255
|
||||||
|
end
|
||||||
|
end
|
|
@ -120,6 +120,7 @@ module DiscourseAi
|
||||||
topic_id: dialect.prompt.topic_id,
|
topic_id: dialect.prompt.topic_id,
|
||||||
post_id: dialect.prompt.post_id,
|
post_id: dialect.prompt.post_id,
|
||||||
feature_name: feature_name,
|
feature_name: feature_name,
|
||||||
|
language_model: self.class.endpoint_name(@model),
|
||||||
)
|
)
|
||||||
|
|
||||||
if !@streaming_mode
|
if !@streaming_mode
|
||||||
|
|
|
@ -120,6 +120,8 @@ RSpec.describe DiscourseAi::Completions::Endpoints::Cohere do
|
||||||
# billing should be picked
|
# billing should be picked
|
||||||
expect(audit.request_tokens).to eq(17)
|
expect(audit.request_tokens).to eq(17)
|
||||||
expect(audit.response_tokens).to eq(22)
|
expect(audit.response_tokens).to eq(22)
|
||||||
|
|
||||||
|
expect(audit.language_model).to eq("Cohere - command-r-plus")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is able to perform streaming completions" do
|
it "is able to perform streaming completions" do
|
||||||
|
|
Loading…
Reference in New Issue