View and analyze captured inference data from model services with Auto-Capture enabled. Use when: querying INFERENCE_TABLE, viewing inference logs, analyzing request/response data, debugging inference history, checking captured predictions. Triggers: inference logs, inference table, captured inference, autocapture data, view inference history, inference requests, inference responses.
Query and analyze captured inference data from model services that have Auto-Capture enabled.
autocapture=True enabled during creationNote: Auto-Capture is not supported for vLLM or HuggingFace inference engines.
Ask user:
Which model would you like to view inference logs for?
Please provide:
- Model name
- Database and schema where the model is registered
⚠️ STOP: Wait for user response.
Verify the model has services with autocapture enabled:
from snowflake.ml.registry import Registry
session = <SESSION_SETUP> # Per environment guide
reg = Registry(session=session, database_name="<DATABASE>", schema_name="<SCHEMA>")
mv = reg.get_model("<MODEL_NAME>").version("<VERSION>")
services_df = mv.list_services()
print(services_df[['name', 'status', 'autocapture_enabled']])
If no services have autocapture_enabled=True:
None of the services for this model have Auto-Capture enabled.
Auto-Capture must be enabled when creating the service (it cannot be added later).
To enable it, you would need to recreate the service with autocapture=True.
Would you like help creating a new service with Auto-Capture enabled?
If yes, load ../spcs-inference/SKILL.md.
Ask user:
You can filter the inference logs. All filters are optional — press Enter to skip any:
- Model version (e.g., V1):
- Service name (e.g., MY_SERVICE):
- Gateway name (if using a gateway):
- Time range: How far back? (e.g., "1 hour", "24 hours", "7 days")
⚠️ STOP: Wait for user response.
SELECT *
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'));
Include only the filters the user provided:
SELECT *
FROM TABLE(
INFERENCE_TABLE(
'<MODEL_NAME>',
VERSION => '<VERSION>',
SERVICE => '<SERVICE_NAME>',
GATEWAY => '<GATEWAY_NAME>'
)
)
WHERE TIMESTAMP > DATEADD('<unit>', -<N>, CURRENT_TIMESTAMP());
SELECT *
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'))
WHERE RECORD_ATTRIBUTES:"snow.model_serving.function.name" = '<function_name>';
SELECT *
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'))
WHERE TIMESTAMP > DATEADD('hour', -1, CURRENT_TIMESTAMP())
ORDER BY TIMESTAMP DESC
LIMIT 100;
After running the query, present the results and ask:
I found <N> inference records. What would you like to do?
1. View the raw data
2. Summarize request/response patterns
3. Analyze input feature distributions
4. Done
⚠️ STOP: Wait for user response.
SELECT
DATE_TRUNC('hour', TIMESTAMP) as hour,
COUNT(*) as request_count
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'))
WHERE TIMESTAMP > DATEADD('day', -1, CURRENT_TIMESTAMP())
GROUP BY 1
ORDER BY 1;
| Field | Description |
|---|---|
RECORD_ATTRIBUTES:"snow.model_serving.request.data.<column>" | Input features sent to the model |
RECORD_ATTRIBUTES:"snow.model_serving.response.data.<column>" | Inference output returned by the model |
RECORD_ATTRIBUTES:"snow.model_serving.request.timestamp" | When the request hit the inference service |
RECORD_ATTRIBUTES:"snow.model_serving.response.code" | HTTP status code |
RECORD_ATTRIBUTES:"snow.model_serving.truncation_policy" | NONE or TRUNCATED_DEFAULT if data exceeded 1MB limit |
RECORD_ATTRIBUTES:"snow.model_serving.last_hop_id" | Last gateway ID the request passed through |
RECORD_ATTRIBUTES:"snow.model_serving.hop_ids" | List of gateway IDs showing request path |
TIMESTAMP | Event timestamp (use for time-range filtering) |
TIMESTAMP for large inference tables.Even after deleting a service, version, or gateway, you can still query the historical data:
-- All logs for model (includes deleted services)
SELECT * FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'));
-- Filter by deleted version
SELECT * FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>', MODEL_VERSION => '<VERSION>'));
-- Filter by deleted service
SELECT * FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>', MODEL_VERSION => '<VERSION>', SERVICE => '<SERVICE>'));
SELECT
RECORD_ATTRIBUTES:"snow.model_serving.request.data" as input,
RECORD_ATTRIBUTES:"snow.model_serving.response.data" as output,
TIMESTAMP
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'))
WHERE TIMESTAMP > DATEADD('hour', -1, CURRENT_TIMESTAMP())
ORDER BY TIMESTAMP DESC
LIMIT 10;
CREATE TABLE training_data_from_prod AS
SELECT
RECORD_ATTRIBUTES:"snow.model_serving.request.data.feature1"::FLOAT as feature1,
RECORD_ATTRIBUTES:"snow.model_serving.request.data.feature2"::FLOAT as feature2,
RECORD_ATTRIBUTES:"snow.model_serving.response.data.prediction"::FLOAT as prediction,
TIMESTAMP
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'))
WHERE TIMESTAMP > DATEADD('day', -30, CURRENT_TIMESTAMP());
SELECT
RECORD_ATTRIBUTES:"snow.model_serving.version" as version,
AVG(RECORD_ATTRIBUTES:"snow.model_serving.response.data.score"::FLOAT) as avg_score,
COUNT(*) as request_count
FROM TABLE(INFERENCE_TABLE('<MODEL_NAME>'))
WHERE TIMESTAMP > DATEADD('day', -7, CURRENT_TIMESTAMP())
GROUP BY 1;