metergraph-core 0.2.31__tar.gz → 0.2.33__tar.gz

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.
Files changed (18) hide show
  1. {metergraph_core-0.2.31/src/metergraph_core.egg-info → metergraph_core-0.2.33}/PKG-INFO +47 -16
  2. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/README.md +46 -15
  3. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/pyproject.toml +2 -2
  4. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core/__init__.py +18 -0
  5. metergraph_core-0.2.33/src/metergraph_core/data/models.yaml +665 -0
  6. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core/data/prices.yaml +114 -2
  7. metergraph_core-0.2.33/src/metergraph_core/models.py +413 -0
  8. {metergraph_core-0.2.31 → metergraph_core-0.2.33/src/metergraph_core.egg-info}/PKG-INFO +47 -16
  9. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core.egg-info/SOURCES.txt +2 -0
  10. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/MANIFEST.in +0 -0
  11. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/setup.cfg +0 -0
  12. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core/billing.py +0 -0
  13. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core/catalog.py +0 -0
  14. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core/loader.py +0 -0
  15. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core/retrieval.py +0 -0
  16. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core.egg-info/dependency_links.txt +0 -0
  17. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core.egg-info/requires.txt +0 -0
  18. {metergraph_core-0.2.31 → metergraph_core-0.2.33}/src/metergraph_core.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metergraph-core
3
- Version: 0.2.31
3
+ Version: 0.2.33
4
4
  Summary: Reusable MeterGraph catalog and deterministic billing engine
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -12,15 +12,16 @@ Requires-Dist: pytest>=8; extra == "dev"
12
12
 
13
13
  # metergraph-core
14
14
 
15
- Reusable catalog and deterministic billing engine for MeterGraph.
15
+ Reusable model registry, price catalog, and deterministic billing engine for
16
+ MeterGraph.
16
17
 
17
- `metergraph-core` owns the public effective-dated model catalog and the pricing
18
- logic shared across MeterGraph systems: catalog parsing and validation, provider
19
- and model alias resolution, channel and region selection, input/output/cache/
20
- batch/long-context pricing rules, deterministic cost calculation with reason
21
- codes, stable logical price identifiers, and catalog version and content-hash
22
- reporting. It also owns the pure decision that selects a qualified
23
- gateway-reported charge or a catalog estimate as the effective call cost.
18
+ `metergraph-core` owns two separate public datasets. `models.yaml` records
19
+ canonical model identity, customer-facing names, executable provider routes,
20
+ and the ordered candidate fields MeterGraph products offer. `prices.yaml`
21
+ records effective-dated rates and billing rules. Core parses and validates both
22
+ datasets, resolves provider aliases and routes, calculates deterministic costs,
23
+ and selects a qualified gateway-reported charge or catalog estimate as the
24
+ effective call cost.
24
25
 
25
26
  It does not own HTTP routes, database access, migrations, authentication,
26
27
  tenancy, ingest, dashboard code, or any hosted-only concern, and it never reads
@@ -84,6 +85,31 @@ exists. It never substitutes a direct-provider price for a gateway price.
84
85
  `LoadedCatalog.pricing_verified_at` records when the bundled catalog was last
85
86
  checked against its linked provider sources.
86
87
 
88
+ ## Model registry
89
+
90
+ ```python
91
+ from metergraph_core import load_model_registry
92
+
93
+ models = load_model_registry()
94
+ for candidate in models.candidates("gateway"):
95
+ print(candidate.id, candidate.display_name, candidate.pricing_channel)
96
+ ```
97
+
98
+ `load_model_registry()` reads the packaged `models.yaml`. Execution profiles
99
+ describe every route the pipeline can run, while offer groups describe the
100
+ smaller ordered fields a product exposes for configured credentials. Candidate
101
+ IDs may intentionally repeat across execution profiles when gateway and
102
+ Bedrock use different physical routes; each route therefore also has a unique
103
+ internal `key`.
104
+
105
+ Use `validate_model_registry(models, load_catalog())` to verify that every
106
+ route's provider-facing model ID is declared on its exact pricing channel,
107
+ resolves to its canonical model, and has an active price on the registry
108
+ version date. The parser also rejects unknown route providers, provider/channel
109
+ mismatches on any route, mismatched offer-group credentials/providers, and duplicate physical routes. Pricing
110
+ remains exclusively in `prices.yaml`; being priceable does not automatically
111
+ make a model an approved analysis candidate.
112
+
87
113
  ## Billing evidence
88
114
 
89
115
  Servers can pass content-blind, already-extracted gateway fields through the
@@ -123,21 +149,26 @@ from metergraph_core import (
123
149
  CostResult,
124
150
  GatewayBillingEvidence,
125
151
  LoadedCatalog,
152
+ ModelRegistry,
153
+ ModelRoute,
126
154
  Price,
127
155
  ResolvedPrice,
128
156
  load_catalog,
157
+ load_model_registry,
129
158
  normalize_gateway_evidence,
130
159
  parse_catalog,
131
160
  resolve_billing,
161
+ validate_model_registry,
132
162
  )
133
163
  ```
134
164
 
135
165
  ## Catalog maintenance
136
166
 
137
- The only manually maintained public catalog lives at
138
- `src/metergraph_core/data/prices.yaml`. Every record requires its provider
139
- source URL and effective date. Corrections close or add effective windows; they
140
- never rewrite historical prices in place. A catalog change updates the declared
141
- catalog version and produces a patch release of `metergraph-core`. Software
142
- version and catalog version are separate values because code and price data have
143
- different lifecycles.
167
+ The two manually maintained public datasets live under
168
+ `src/metergraph_core/data/`. Update `models.yaml` when model identity, display,
169
+ routing, or managed candidate policy changes. Update `prices.yaml` when rates
170
+ or billing rules change. Price corrections close or add effective windows;
171
+ they never rewrite historical prices in place. Either data change increments
172
+ its own declared version and produces a patch release of `metergraph-core`.
173
+ Software and data versions remain separate because they have different
174
+ lifecycles.
@@ -1,14 +1,15 @@
1
1
  # metergraph-core
2
2
 
3
- Reusable catalog and deterministic billing engine for MeterGraph.
3
+ Reusable model registry, price catalog, and deterministic billing engine for
4
+ MeterGraph.
4
5
 
5
- `metergraph-core` owns the public effective-dated model catalog and the pricing
6
- logic shared across MeterGraph systems: catalog parsing and validation, provider
7
- and model alias resolution, channel and region selection, input/output/cache/
8
- batch/long-context pricing rules, deterministic cost calculation with reason
9
- codes, stable logical price identifiers, and catalog version and content-hash
10
- reporting. It also owns the pure decision that selects a qualified
11
- gateway-reported charge or a catalog estimate as the effective call cost.
6
+ `metergraph-core` owns two separate public datasets. `models.yaml` records
7
+ canonical model identity, customer-facing names, executable provider routes,
8
+ and the ordered candidate fields MeterGraph products offer. `prices.yaml`
9
+ records effective-dated rates and billing rules. Core parses and validates both
10
+ datasets, resolves provider aliases and routes, calculates deterministic costs,
11
+ and selects a qualified gateway-reported charge or catalog estimate as the
12
+ effective call cost.
12
13
 
13
14
  It does not own HTTP routes, database access, migrations, authentication,
14
15
  tenancy, ingest, dashboard code, or any hosted-only concern, and it never reads
@@ -72,6 +73,31 @@ exists. It never substitutes a direct-provider price for a gateway price.
72
73
  `LoadedCatalog.pricing_verified_at` records when the bundled catalog was last
73
74
  checked against its linked provider sources.
74
75
 
76
+ ## Model registry
77
+
78
+ ```python
79
+ from metergraph_core import load_model_registry
80
+
81
+ models = load_model_registry()
82
+ for candidate in models.candidates("gateway"):
83
+ print(candidate.id, candidate.display_name, candidate.pricing_channel)
84
+ ```
85
+
86
+ `load_model_registry()` reads the packaged `models.yaml`. Execution profiles
87
+ describe every route the pipeline can run, while offer groups describe the
88
+ smaller ordered fields a product exposes for configured credentials. Candidate
89
+ IDs may intentionally repeat across execution profiles when gateway and
90
+ Bedrock use different physical routes; each route therefore also has a unique
91
+ internal `key`.
92
+
93
+ Use `validate_model_registry(models, load_catalog())` to verify that every
94
+ route's provider-facing model ID is declared on its exact pricing channel,
95
+ resolves to its canonical model, and has an active price on the registry
96
+ version date. The parser also rejects unknown route providers, provider/channel
97
+ mismatches on any route, mismatched offer-group credentials/providers, and duplicate physical routes. Pricing
98
+ remains exclusively in `prices.yaml`; being priceable does not automatically
99
+ make a model an approved analysis candidate.
100
+
75
101
  ## Billing evidence
76
102
 
77
103
  Servers can pass content-blind, already-extracted gateway fields through the
@@ -111,21 +137,26 @@ from metergraph_core import (
111
137
  CostResult,
112
138
  GatewayBillingEvidence,
113
139
  LoadedCatalog,
140
+ ModelRegistry,
141
+ ModelRoute,
114
142
  Price,
115
143
  ResolvedPrice,
116
144
  load_catalog,
145
+ load_model_registry,
117
146
  normalize_gateway_evidence,
118
147
  parse_catalog,
119
148
  resolve_billing,
149
+ validate_model_registry,
120
150
  )
121
151
  ```
122
152
 
123
153
  ## Catalog maintenance
124
154
 
125
- The only manually maintained public catalog lives at
126
- `src/metergraph_core/data/prices.yaml`. Every record requires its provider
127
- source URL and effective date. Corrections close or add effective windows; they
128
- never rewrite historical prices in place. A catalog change updates the declared
129
- catalog version and produces a patch release of `metergraph-core`. Software
130
- version and catalog version are separate values because code and price data have
131
- different lifecycles.
155
+ The two manually maintained public datasets live under
156
+ `src/metergraph_core/data/`. Update `models.yaml` when model identity, display,
157
+ routing, or managed candidate policy changes. Update `prices.yaml` when rates
158
+ or billing rules change. Price corrections close or add effective windows;
159
+ they never rewrite historical prices in place. Either data change increments
160
+ its own declared version and produces a patch release of `metergraph-core`.
161
+ Software and data versions remain separate because they have different
162
+ lifecycles.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "metergraph-core"
3
- version = "0.2.31"
3
+ version = "0.2.33"
4
4
  description = "Reusable MeterGraph catalog and deterministic billing engine"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -20,4 +20,4 @@ build-backend = "setuptools.build_meta"
20
20
  where = ["src"]
21
21
 
22
22
  [tool.setuptools.package-data]
23
- metergraph_core = ["data/prices.yaml"]
23
+ metergraph_core = ["data/models.yaml", "data/prices.yaml"]
@@ -23,6 +23,16 @@ from .loader import (
23
23
  parse_catalog,
24
24
  parse_retrieval,
25
25
  )
26
+ from .models import (
27
+ ModelDefinition,
28
+ ModelRegistry,
29
+ ModelRegistryError,
30
+ ModelRoute,
31
+ OfferGroup,
32
+ load_model_registry,
33
+ parse_model_registry,
34
+ validate_model_registry,
35
+ )
26
36
  from .retrieval import (
27
37
  RetrievalCatalog,
28
38
  RetrievalCostResult,
@@ -36,6 +46,11 @@ __all__ = [
36
46
  "CatalogSnapshot",
37
47
  "CostResult",
38
48
  "LoadedCatalog",
49
+ "ModelDefinition",
50
+ "ModelRegistry",
51
+ "ModelRegistryError",
52
+ "ModelRoute",
53
+ "OfferGroup",
39
54
  "GatewayBillingEvidence",
40
55
  "Price",
41
56
  "ResolvedPrice",
@@ -46,8 +61,11 @@ __all__ = [
46
61
  "direct_channel_for_provider",
47
62
  "normalize_provider",
48
63
  "load_catalog",
64
+ "load_model_registry",
49
65
  "normalize_gateway_evidence",
50
66
  "parse_catalog",
67
+ "parse_model_registry",
51
68
  "parse_retrieval",
52
69
  "resolve_billing",
70
+ "validate_model_registry",
53
71
  ]