Skip to content

Commit 6b7cdc3

Browse files
committed
Include the embedding provider in metrics
It'll probably be useful to know which provider was used.
1 parent ba21f64 commit 6b7cdc3

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

lib/search/results_for_question.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def self.call(question_message)
2626
embedding_provider: provider,
2727
)
2828
metrics[:search_duration] = Clock.monotonic_time - search_start_time
29+
metrics[:embedding_provider] = provider
2930

3031
reranking_start_time = Clock.monotonic_time
3132
weighted_results = Search::ResultsForQuestion::Reranker.call(results)

spec/lib/search/results_for_question_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
["not found 2", a_value_between(0.2, 0.3)])
4646
end
4747

48-
it "populates the metrics attribute with the durations of the embedding, search, and reranking steps" do
48+
it "populates the metrics attribute" do
4949
result = described_class.call(question_message)
50-
expect(result.metrics).to eq({ embedding_duration: 1.5, search_duration: 2.0, reranking_duration: 1.0 })
50+
expect(result.metrics).to eq({ embedding_duration: 1.5, search_duration: 2.0, reranking_duration: 1.0, embedding_provider: "openai" })
5151
end
5252

5353
it "raises an error if the embedding provider is not recognised" do

0 commit comments

Comments
 (0)