lex-azure-ai 0.1.3 → 0.1.4
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: d62cce58c74c7629813ee041e1170b89b8bf840290e4780df44c498842e74575
|
|
4
|
+
data.tar.gz: d7ec97c677ba8c83c3e13fcfacf5e5ac9f3fb34eae518b65d57f21d37e1314e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2658586dd660d0a5dfce414f12932ca82582a7d142ad4605ef7eaf649aaf30368ebb3fd31a48dc6459f3120539622c34c82fd017a68d961e15075a23ae896998
|
|
7
|
+
data.tar.gz: dde8723318bf4c19c9c7396d6f2df1f6e25abcbf59f9f24051f1f0fdd1a3f95cc26153955aba57bbf16db34cca825a2a7d0f1c65a556532a70565003b0ab7daf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.4] - 2026-03-31
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Standardized `usage:` key in Chat and Embeddings runner return hashes, exposing `input_tokens`, `output_tokens`, `cache_read_tokens`, and `cache_write_tokens` for consumption by legion-llm CostEstimator and metering
|
|
7
|
+
|
|
3
8
|
## [0.1.3] - 2026-03-30
|
|
4
9
|
|
|
5
10
|
### Changed
|
|
@@ -17,7 +17,15 @@ module Legion
|
|
|
17
17
|
|
|
18
18
|
path = "/openai/deployments/#{deployment}/chat/completions?api-version=#{api_version}"
|
|
19
19
|
response = client(api_key: api_key, endpoint: endpoint, api_version: api_version).post(path, body)
|
|
20
|
-
{
|
|
20
|
+
{
|
|
21
|
+
result: response.body,
|
|
22
|
+
usage: {
|
|
23
|
+
input_tokens: response.body.dig('usage', 'prompt_tokens') || 0,
|
|
24
|
+
output_tokens: response.body.dig('usage', 'completion_tokens') || 0,
|
|
25
|
+
cache_read_tokens: response.body.dig('usage', 'prompt_tokens_details', 'cached_tokens') || 0,
|
|
26
|
+
cache_write_tokens: 0
|
|
27
|
+
}
|
|
28
|
+
}
|
|
21
29
|
end
|
|
22
30
|
|
|
23
31
|
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
@@ -13,7 +13,15 @@ module Legion
|
|
|
13
13
|
body = { input: input }
|
|
14
14
|
path = "/openai/deployments/#{deployment}/embeddings?api-version=#{api_version}"
|
|
15
15
|
response = client(api_key: api_key, endpoint: endpoint, api_version: api_version).post(path, body)
|
|
16
|
-
{
|
|
16
|
+
{
|
|
17
|
+
result: response.body,
|
|
18
|
+
usage: {
|
|
19
|
+
input_tokens: response.body.dig('usage', 'prompt_tokens') || 0,
|
|
20
|
+
output_tokens: response.body.dig('usage', 'completion_tokens') || 0,
|
|
21
|
+
cache_read_tokens: response.body.dig('usage', 'prompt_tokens_details', 'cached_tokens') || 0,
|
|
22
|
+
cache_write_tokens: 0
|
|
23
|
+
}
|
|
24
|
+
}
|
|
17
25
|
end
|
|
18
26
|
|
|
19
27
|
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|