# Model Metadata

Seldon Enterprise Platform supports the storage and management of model metadata. This includes project name, artifact URI, ML runtime, and prediction schema, amongst other things.

Model metadata is dependent on Postgres. For more information on configuring Postgres with Seldon Enterprise Platform, see [the installation instructions](/seldon-enterprise-platform/production-environment/postgresql.md).

You can create and manage model metadata through the Enterprise Platform UI and API. Enterprise Platform will also watch for deployments in the Kubernetes cluster and sync this information into the metadata store. In this case, the Platform will only populate basic information, but this can then be enriched via the UI and API as with any other model metadata.

## Queries

Seldon Enterprise Platform provides an advanced query language that allows you to make sophisticated search queries over your model metadata.

Simple fields can be compared using SQL-like comparison and partial match operators. Nested fields can be compared by first using index notation to extract simple fields. More complex expressions can be formed with the `AND` and `OR` operators and parentheses. Note that the `AND` and `OR` operators are treated as having equal precedence.

| Operator | Meaning                  |
| -------- | ------------------------ |
| `=`      | Equal                    |
| `!=`     | Not equal                |
| `>`      | Greater than             |
| `<`      | Less than                |
| `>=`     | Greater than or equal to |
| `<=`     | Less than or equal to    |
| `%`      | Like -- partial match    |
| `AND`    | Conjunction              |
| `OR`     | Disjunction              |
| `(...)`  | Subexpression for `...`  |

Field names and operators are not case-sensitive. Field **values** are case-sensitive, however, and should not be wrapped in quotes. The list of valid fields to query is:

| Field name      | Type   | Description                                                                                                                                                                                 |
| --------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `URI`           | Simple | String                                                                                                                                                                                      |
| `name`          | Simple | String                                                                                                                                                                                      |
| `version`       | Simple | String, e.g. `1.0`, `v2`, `dev`                                                                                                                                                             |
| `project`       | Simple | String                                                                                                                                                                                      |
| `artifact_type` | Simple | One of `ALIBI_DETECT`, `ALIBI_EXPLAIN`, `CUSTOM`, `HUGGINGFACE`, `MLFLOW`, `MLSERVER_PYTHON`, `ONNX`, `PYTORCH`, `SKLEARN`, `TENSORFLOW`, `TENSORRT`, `TRITON_PYTHON`, `UNKNOWN`, `XGBOOST` |
| `task_type`     | Simple | String, e.g. `classification` or `object-detection`                                                                                                                                         |
| `tags`          | Nested | Map of string to string                                                                                                                                                                     |
| `metrics`       | Nested | Map of string to number                                                                                                                                                                     |

### Examples

```
name % iris

name=iris AND version=2.0

(name=iris AND version=2.0) OR version=3.0

metrics[metricName] > 1.0 AND tags[tagKey] != someValue
```

### API

Using the model metadata API, you can specify a string query the same way you would in the UI, e.g.

```
<yourSeldonDomain>/seldon-deploy/api/v1alpha1/model/metadata?query=(version=1.0)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seldon.ai/seldon-enterprise-platform/operations/model-metadata.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
