nitro_intelligence 4.3.1 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cbb853c952d95a2f7daf43fe1b24e6fdc22a86037a521c90c35d6d15a3101a2
|
|
4
|
+
data.tar.gz: a7f86718cdc8408cf2a87011214ce9e4cf4cce904eaac9560f24decec840f89c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 239ee2221ce1120a1ff04b0a68316a8fb762086aebcf57ec2e7fc72302de51ae2b1cf30ea8cca40ab79c2cceb3af8e649cd23584192bc4547eec63b6730d13cb
|
|
7
|
+
data.tar.gz: 38b82841af416d45a904e3e8fbd63b50056dcbbb20e3d33fadb0b02fef7618b201c9c3e302dc217f06eeb8944c2c5a0a1a56fcf4ee9c7aa8023dae887a1e7dbd
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [4.3.2](https://github.com/powerhome/nitro-intelligence.rb/compare/v4.3.1...v4.3.2) (2026-11-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
* **embeddings:** stop Cerebro double-counting embedding usage ([#222](https://github.com/powerhome/nitro-intelligence.rb/issues/222)) ([93e076c](https://github.com/powerhome/nitro-intelligence.rb/commit/93e076c681d54e3d1baa789f4d74ada24637a3d1))
|
|
14
|
+
|
|
8
15
|
## [4.3.1](https://github.com/powerhome/nitro-intelligence.rb/compare/v4.3.0...v4.3.1) (2026-11-11)
|
|
9
16
|
|
|
10
17
|
|
data/docs/README.md
CHANGED
|
@@ -297,7 +297,7 @@ client.embed_query(query: "How do I request time off?", parameters: { dimensions
|
|
|
297
297
|
|
|
298
298
|
A model's `query_prefix` and `document_prefix` in `config.model_config` are what it expects before a query's text and before a document's, in the form it was trained on. Qwen3-Embedding takes an instruction before each query and nothing before a document, as in the configuration above; E5 takes `"query: "` and `"passage: "`. Leave both out for a model that embeds queries and documents the same way, such as OpenAI's. Switching to another embeddings model only means changing its `model_config` entry, but vectors from different models cannot be compared, so it also means embedding your stored documents again.
|
|
299
299
|
|
|
300
|
-
`embeddings.usage` holds `prompt_tokens` and `total_tokens` summed over every request, and `embeddings.responses` the gateway's responses, one per batch, each with its `last_response`. With observability enabled, each call is recorded in Cerebro as an embedding observation named `embed-query` or `embed-documents`, with the input as the model received it, prefix included, the gateway's cost added up over every batch, and the number and size of the vectors as output. The vectors themselves are never recorded. If the gateway did not price every batch, the cost is left unset rather than undercounted. If a batch fails after others succeeded, the failed call still records what those cost before the error is raised.
|
|
300
|
+
`embeddings.usage` holds `prompt_tokens` and `total_tokens` summed over every request, and `embeddings.responses` the gateway's responses, one per batch, each with its `last_response`. With observability enabled, each call is recorded in Cerebro as an embedding observation named `embed-query` or `embed-documents`, with the input as the model received it, prefix included, the input tokens as usage, the gateway's cost added up over every batch, and the number and size of the vectors as output. The vectors themselves are never recorded. If the gateway did not price every batch, the cost is left unset rather than undercounted. If a batch fails after others succeeded, the failed call still records what those cost before the error is raised.
|
|
301
301
|
|
|
302
302
|
Embeddings take no managed prompt: `prompt_name` and `prompt_variables` are ignored.
|
|
303
303
|
|
|
@@ -44,7 +44,7 @@ module NitroIntelligence
|
|
|
44
44
|
trace_attributes = {
|
|
45
45
|
model: embeddings.model,
|
|
46
46
|
output: { count: embeddings.vectors.size, dimensions: embeddings.vector&.size },
|
|
47
|
-
usage_details: embeddings.usage
|
|
47
|
+
usage_details: usage_details(embeddings.usage),
|
|
48
48
|
cost_details: @base_handler.cost_details(embeddings),
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -61,11 +61,18 @@ module NitroIntelligence
|
|
|
61
61
|
|
|
62
62
|
billed = Embeddings.new(responses)
|
|
63
63
|
attributes = {
|
|
64
|
-
usage_details: billed.usage
|
|
64
|
+
usage_details: usage_details(billed.usage),
|
|
65
65
|
cost_details: @base_handler.cost_details(billed),
|
|
66
66
|
}.compact
|
|
67
67
|
embedding.update(attributes) if attributes.any?
|
|
68
68
|
end
|
|
69
|
+
|
|
70
|
+
# Recorded under Langfuse's own `input` and `total` keys. OpenAI's names are only recognised
|
|
71
|
+
# alongside `completion_tokens`, which an embedding has none of, so Langfuse would otherwise
|
|
72
|
+
# keep `prompt_tokens` and `total_tokens` as two counters and total them, doubling the count.
|
|
73
|
+
def usage_details(usage)
|
|
74
|
+
{ input: usage[:prompt_tokens], total: usage[:total_tokens] }.compact.presence
|
|
75
|
+
end
|
|
69
76
|
end
|
|
70
77
|
end
|
|
71
78
|
end
|