class documentation
class PartitionedModel(ExposedModel): (source)
Returns an model that routes the inference request to a new model based on a partition key
```python @model_contract(
input_features=[MyFeature().name], exposed_model=partitioned_on(
"lang", partitions={
"no": openai_embedding("text-embedding-3-large"), "en": openai_embedding("text-embedding-ada-002"),}, default_partition="no"
),
) class MyEmbedding:
my_entity = Int32().as_entity() name = String() lang = String() embedding = Embedding(1536) predicted_at = EventTimestamp()
- embeddings = await store.model(MyEmbedding).predict_over({
- "my_entity": [1, 2, 3], "name": ["Hello", "Hei", "Hola"], "lang": ["en", "no", "es"]
}).to_polars() ```
Method | needed |
Undocumented |
Async Method | needed |
Undocumented |
Async Method | needed |
Undocumented |
Async Method | run |
Undocumented |
Class Variable | default |
Undocumented |
Class Variable | model |
Undocumented |
Class Variable | partition |
Undocumented |
Class Variable | partitions |
Undocumented |
Property | as |
Undocumented |
async def run_polars(self, values:
RetrievalJob
, store: ModelFeatureStore
) -> pl.DataFrame
:
(source)
¶
Undocumented