Querying system tables for AI endpoints

Querying system tables for AI endpoints#

⚙️ Compute: General Compute Serverless for SQL, classic cluster for first cell

⛓️ Dependency: a serving model using either your own models from Unity Catalog, or an External model provider. The easiest to test out is probably the External models for Chat, although you will need to use the model provider API key.

📺 This accompanies this youtube video, which at under 2 mins I recommend watching to get the context of this notebook

%sh
curl -v -X PUT -H "Authorization: Bearer <PAToken>" "https://<workspace_id>.databricks.com/api/2.0/unity-catalog/metastores/<metastore_id>/systemschemas/serving"
#PAToken - can be found in: User > Developer > Access Tokens
#workspace_id: found in the URL
#metastore_id: select metastore_id from system.information_schema.metastores
show tables in system.serving
databasetableNameisTemporary
servingendpoint_usagefalse
servingserved_entitiesfalse
_sqldftrue
select * from system.serving.endpoint_usage
workspace_idaccount_idclient_request_iddatabricks_request_idrequesterstatus_coderequest_timeinput_token_countoutput_token_countinput_character_countoutput_character_countusage_contextrequest_streamingserved_entity_id
55684977115052205054295-4959-42dc-abf8-934d75c36417nullb336623b-6f95-4ddd-8992-e54a873a1b46[email protected]2002024-12-11T11:59:14.046Z2591591112734Map()falsef7c5c305af1d4dacb0ebdd6f447ba1be
55684977115052205054295-4959-42dc-abf8-934d75c36417null04ff5243-ba02-471d-afdc-9b382a364b7f[email protected]2002024-12-11T11:57:39.551Z13232211067Map()falsef7c5c305af1d4dacb0ebdd6f447ba1be
55684977115052205054295-4959-42dc-abf8-934d75c36417null2d11499f-56a9-4044-9e74-bd1cd6859860[email protected]4002024-12-11T11:58:12.250Z0011200Map()falsef7c5c305af1d4dacb0ebdd6f447ba1be
55684977115052205054295-4959-42dc-abf8-934d75c36417null69a173a6-f21a-4516-bff7-6df730795911[email protected]4002024-12-11T11:59:48.876Z0018730Map()falsef7c5c305af1d4dacb0ebdd6f447ba1be
55684977115052205054295-4959-42dc-abf8-934d75c36417nulld7926e60-d150-415c-8a51-e12e4a4541b5[email protected]4002024-12-11T11:58:52.684Z0011200Map()false455f0d9643774b9d983341c928fe03c6
55684977115052205054295-4959-42dc-abf8-934d75c36417null1fe6a664-fff8-46b1-badc-6fade0934e3c[email protected]4002024-12-11T11:59:11.609Z0011120Map()false455f0d9643774b9d983341c928fe03c6
55684977115052205054295-4959-42dc-abf8-934d75c36417nulla4b5374b-7029-4e65-b474-2c884e087f48[email protected]4002024-12-11T11:56:43.078Z00210Map()false455f0d9643774b9d983341c928fe03c6
55684977115052205054295-4959-42dc-abf8-934d75c36417null9a2b8197-b167-46de-b3f4-1c3ef83d7221[email protected]4002024-12-11T11:55:40.779Z00380Map()false455f0d9643774b9d983341c928fe03c6
55684977115052205054295-4959-42dc-abf8-934d75c36417nulldbb5e0da-c788-4936-90b3-c98bd1954ce9[email protected]4002024-12-11T11:54:38.386Z00380Map()false455f0d9643774b9d983341c928fe03c6
55684977115052205054295-4959-42dc-abf8-934d75c36417nullb43ddd25-6fa2-4967-9a1b-e9cbe1025399[email protected]4002024-12-11T11:55:47.318Z00380Map()false455f0d9643774b9d983341c928fe03c6
select * from system.serving.served_entities
served_entity_idaccount_idworkspace_idcreated_byendpoint_nameendpoint_idserved_entity_nameentity_typeentity_nameentity_versionendpoint_config_versiontaskexternal_model_configfoundation_model_configcustom_model_configfeature_spec_configchange_timeendpoint_delete_time
455f0d9643774b9d983341c928fe03c605054295-4959-42dc-abf8-934d75c36417556849771150522[email protected]DL-external-models89fe6eeb07d246b2bab727e9d5ecd78dclaude-3-haikuEXTERNAL_MODELclaude-3-haiku-20240307null1llm/v1/chatList(anthropic)nullnullnull2024-08-15T15:29:48.000Znull
f7c5c305af1d4dacb0ebdd6f447ba1be05054295-4959-42dc-abf8-934d75c36417556849771150522[email protected]DL-external-models89fe6eeb07d246b2bab727e9d5ecd78dgpt-4o-miniEXTERNAL_MODELgpt-4o-mininull1llm/v1/chatList(openai)nullnullnull2024-08-15T15:29:48.000Znull
select * from demo_sample_data.tables.`DL-external-models_payload`
--replace with the table you specified for inference at the serving stage
--and yes, this is technically not a system table
request_datedatabricks_request_idclient_request_idrequest_timestatus_codesampling_fractionexecution_duration_msrequestresponseserved_entity_idlogging_error_codesrequester
2024-12-1104ff5243-ba02-471d-afdc-9b382a364b7fnull2024-12-11T11:57:39.551Z2001.05625{"messages":[{"role":"user","content":"what's a good cookie?"}],"temperature":0,"top_p":0.95,"stream":false}{ "id": "chatcmpl-AdFdUDeGKqobSaUUCnsq2GW2QJQWJ", "object": "chat.completion", "created": 1733918260, "model": "gpt-4o-mini-2024-07-18", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "A good cookie often depends on personal preference, but some popular favorites include:\n\n1. **Chocolate Chip Cookies**: Classic and beloved, these cookies are soft and chewy with melty chocolate chips.\n2. **Oatmeal Raisin Cookies**: Chewy and hearty, these cookies combine oats and raisins for a satisfying texture and flavor.\n3. **Peanut Butter Cookies**: Rich and nutty, these cookies often have a crisscross pattern on top and a deliciously creamy taste.\n4. **Snickerdoodles**: Soft and cinnamon-sugar coated, these cookies have a delightful tang from cream of tartar.\n5. **Sugar Cookies**: Simple and sweet, sugar cookies can be decorated with icing or sprinkles for a festive touch.\n6. **Double Chocolate Cookies**: For chocolate lovers, these cookies are made with cocoa powder and chocolate chips for an extra chocolatey experience.\n7. **Macarons**: These French cookies are delicate and come in various flavors, with a crisp shell and a creamy filling.\n\nUltimately, a good cookie is one that brings you joy, whether it's homemade or from your favorite bakery!", "refusal": null }, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 13, "completion_tokens": 232, "total_tokens": 245, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 } }, "system_fingerprint": "fp_818c284075" } f7c5c305af1d4dacb0ebdd6f447ba1beList()[email protected]
2024-12-11b336623b-6f95-4ddd-8992-e54a873a1b46null2024-12-11T11:59:14.046Z2001.08467{"messages":[{"role":"user","content":"what's a good cookie?"},{"role":"assistant","content":"A good cookie often depends on personal preference, but some popular favorites include:\n\n1. **Chocolate Chip Cookies**: Classic and beloved, these cookies are soft and chewy with melty chocolate chips.\n2. **Oatmeal Raisin Cookies**: Chewy and hearty, these cookies combine oats and raisins for a satisfying texture and flavor.\n3. **Peanut Butter Cookies**: Rich and nutty, these cookies often have a crisscross pattern on top and a deliciously creamy taste.\n4. **Snickerdoodles**: Soft and cinnamon-sugar coated, these cookies have a delightful tang from cream of tartar.\n5. **Sugar Cookies**: Simple and sweet, sugar cookies can be decorated with icing or sprinkles for a festive touch.\n6. **Double Chocolate Cookies**: For chocolate lovers, these cookies are made with cocoa powder and chocolate chips for an extra chocolatey experience.\n7. **Macarons**: These French cookies are delicate and come in various flavors, with a crisp shell and a creamy filling.\n\nUltimately, a good cookie is one that brings you joy, whether it's homemade or from your favorite bakery!"},{"role":"user","content":"are cookies a good gift?"}],"temperature":0,"top_p":0.95,"stream":false}{ "id": "chatcmpl-AdFf0Zta2ChROJxtGpYJ08kX6XRcW", "object": "chat.completion", "created": 1733918354, "model": "gpt-4o-mini-2024-07-18", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Yes, cookies can make a great gift! Here are a few reasons why:\n\n1. **Personal Touch**: Homemade cookies show thoughtfulness and effort, making them a heartfelt gift.\n2. **Variety**: There are countless cookie recipes and flavors, allowing you to customize your gift to the recipient's preferences.\n3. **Shareable**: Cookies are easy to share, making them a great treat for gatherings or family events.\n4. **Presentation**: You can package cookies beautifully in jars, boxes, or tins, adding to the gift's appeal.\n5. **Occasions**: Cookies are suitable for various occasions, from holidays and birthdays to thank-you gifts or just because.\n\nOverall, cookies can be a delightful and appreciated gift for friends, family, or colleagues!", "refusal": null }, "logprobs": null, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 259, "completion_tokens": 159, "total_tokens": 418, "prompt_tokens_details": { "cached_tokens": 0, "audio_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0 } }, "system_fingerprint": "fp_bba3c8e70b" } f7c5c305af1d4dacb0ebdd6f447ba1beList()[email protected]
2024-12-1169a173a6-f21a-4516-bff7-6df730795911null2024-12-11T11:59:48.876Z4001.0515{"messages":[{"role":"user","content":"what's a good cookie?"},{"role":"assistant","content":"A good cookie often depends on personal preference, but some popular favorites include:\n\n1. **Chocolate Chip Cookies**: Classic and beloved, these cookies are soft and chewy with melty chocolate chips.\n2. **Oatmeal Raisin Cookies**: Chewy and hearty, these cookies combine oats and raisins for a satisfying texture and flavor.\n3. **Peanut Butter Cookies**: Rich and nutty, these cookies often have a crisscross pattern on top and a deliciously creamy taste.\n4. **Snickerdoodles**: Soft and cinnamon-sugar coated, these cookies have a delightful tang from cream of tartar.\n5. **Sugar Cookies**: Simple and sweet, sugar cookies can be decorated with icing or sprinkles for a festive touch.\n6. **Double Chocolate Cookies**: For chocolate lovers, these cookies are made with cocoa powder and chocolate chips for an extra chocolatey experience.\n7. **Macarons**: These French cookies are delicate and come in various flavors, with a crisp shell and a creamy filling.\n\nUltimately, a good cookie is one that brings you joy, whether it's homemade or from your favorite bakery!"},{"role":"user","content":"are cookies a good gift?"},{"role":"assistant","content":"Yes, cookies can make a great gift! Here are a few reasons why:\n\n1. **Personal Touch**: Homemade cookies show thoughtfulness and effort, making them a heartfelt gift.\n2. **Variety**: There are countless cookie recipes and flavors, allowing you to customize your gift to the recipient's preferences.\n3. **Shareable**: Cookies are easy to share, making them a great treat for gatherings or family events.\n4. **Presentation**: You can package cookies beautifully in jars, boxes, or tins, adding to the gift's appeal.\n5. **Occasions**: Cookies are suitable for various occasions, from holidays and birthdays to thank-you gifts or just because.\n\nOverall, cookies can be a delightful and appreciated gift for friends, family, or colleagues!"},{"role":"user","content":"is cake good for birthdays?"}],"temperature":0,"top_p":0.95,"stream":false}{"usage":{"prompt_tokens":587,"total_tokens":587},"input_guardrail":[{"flagged":false,"categories":{"violent-crimes":false,"non-violent-crimes":false,"sex-crimes":false,"child-exploitation":false,"specialized-advice":false,"privacy":false,"intellectual-property":false,"indiscriminate-weapons":false,"hate":false,"self-harm":false,"sexual-content":false},"category_scores":null,"pii_detection":false,"anonymized_input":null,"invalid_keywords":null,"off_topic":true}],"finishReason":"input_guardrail_triggered"}f7c5c305af1d4dacb0ebdd6f447ba1beList()[email protected]
2024-12-112d11499f-56a9-4044-9e74-bd1cd6859860null2024-12-11T11:58:12.250Z4001.07615{"messages":[{"role":"user","content":"what's a good cookie?"},{"role":"assistant","content":"A good cookie often depends on personal preference, but some popular favorites include:\n\n1. **Chocolate Chip Cookies**: Classic and beloved, these cookies are soft and chewy with melty chocolate chips.\n2. **Oatmeal Raisin Cookies**: Chewy and hearty, these cookies combine oats and raisins for a satisfying texture and flavor.\n3. **Peanut Butter Cookies**: Rich and nutty, these cookies often have a crisscross pattern on top and a deliciously creamy taste.\n4. **Snickerdoodles**: Soft and cinnamon-sugar coated, these cookies have a delightful tang from cream of tartar.\n5. **Sugar Cookies**: Simple and sweet, sugar cookies can be decorated with icing or sprinkles for a festive touch.\n6. **Double Chocolate Cookies**: For chocolate lovers, these cookies are made with cocoa powder and chocolate chips for an extra chocolatey experience.\n7. **Macarons**: These French cookies are delicate and come in various flavors, with a crisp shell and a creamy filling.\n\nUltimately, a good cookie is one that brings you joy, whether it's homemade or from your favorite bakery!"},{"role":"user","content":"are croissants a good breakfast?"}],"temperature":0,"top_p":0.95,"stream":false}{"usage":{"prompt_tokens":413,"total_tokens":413},"output_guardrail":[{"flagged":false,"categories":{"violent-crimes":false,"non-violent-crimes":false,"sex-crimes":false,"child-exploitation":false,"specialized-advice":false,"privacy":false,"intellectual-property":false,"indiscriminate-weapons":false,"hate":false,"self-harm":false,"sexual-content":false},"category_scores":null,"pii_detection":null,"anonymized_input":null,"invalid_keywords":true,"off_topic":null}],"finishReason":"output_guardrail_triggered"}f7c5c305af1d4dacb0ebdd6f447ba1beList()[email protected]
2024-12-11d7926e60-d150-415c-8a51-e12e4a4541b5null2024-12-11T11:58:52.684Z4001.0840{"messages":[{"role":"user","content":"what's a good cookie?"},{"role":"assistant","content":"A good cookie often depends on personal preference, but some popular favorites include:\n\n1. **Chocolate Chip Cookies**: Classic and beloved, these cookies are soft and chewy with melty chocolate chips.\n2. **Oatmeal Raisin Cookies**: Chewy and hearty, these cookies combine oats and raisins for a satisfying texture and flavor.\n3. **Peanut Butter Cookies**: Rich and nutty, these cookies often have a crisscross pattern on top and a deliciously creamy taste.\n4. **Snickerdoodles**: Soft and cinnamon-sugar coated, these cookies have a delightful tang from cream of tartar.\n5. **Sugar Cookies**: Simple and sweet, sugar cookies can be decorated with icing or sprinkles for a festive touch.\n6. **Double Chocolate Cookies**: For chocolate lovers, these cookies are made with cocoa powder and chocolate chips for an extra chocolatey experience.\n7. **Macarons**: These French cookies are delicate and come in various flavors, with a crisp shell and a creamy filling.\n\nUltimately, a good cookie is one that brings you joy, whether it's homemade or from your favorite bakery!"},{"role":"user","content":"are croissants a good breakfast?"}],"temperature":0,"top_p":0.95,"stream":false}{"usage":{"prompt_tokens":425,"total_tokens":425},"input_guardrail":[{"flagged":false,"categories":{"violent-crimes":false,"non-violent-crimes":false,"sex-crimes":false,"child-exploitation":false,"specialized-advice":false,"privacy":false,"intellectual-property":false,"indiscriminate-weapons":false,"hate":false,"self-harm":false,"sexual-content":false},"category_scores":null,"pii_detection":false,"anonymized_input":null,"invalid_keywords":null,"off_topic":true}],"finishReason":"input_guardrail_triggered"}455f0d9643774b9d983341c928fe03c6List()[email protected]
2024-12-111fe6a664-fff8-46b1-badc-6fade0934e3cnull2024-12-11T11:59:11.609Z4001.0537{"messages":[{"role":"user","content":"what's a good cookie?"},{"role":"assistant","content":"A good cookie often depends on personal preference, but some popular favorites include:\n\n1. **Chocolate Chip Cookies**: Classic and beloved, these cookies are soft and chewy with melty chocolate chips.\n2. **Oatmeal Raisin Cookies**: Chewy and hearty, these cookies combine oats and raisins for a satisfying texture and flavor.\n3. **Peanut Butter Cookies**: Rich and nutty, these cookies often have a crisscross pattern on top and a deliciously creamy taste.\n4. **Snickerdoodles**: Soft and cinnamon-sugar coated, these cookies have a delightful tang from cream of tartar.\n5. **Sugar Cookies**: Simple and sweet, sugar cookies can be decorated with icing or sprinkles for a festive touch.\n6. **Double Chocolate Cookies**: For chocolate lovers, these cookies are made with cocoa powder and chocolate chips for an extra chocolatey experience.\n7. **Macarons**: These French cookies are delicate and come in various flavors, with a crisp shell and a creamy filling.\n\nUltimately, a good cookie is one that brings you joy, whether it's homemade or from your favorite bakery!"},{"role":"user","content":"are cookies a good gift?"}],"temperature":0,"top_p":0.95,"stream":false}{"error":"Received error from anthropic","external_model_message":{"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: 8192 > 4096, which is the maximum allowed number of output tokens for claude-3-haiku-20240307"}}}455f0d9643774b9d983341c928fe03c6List()[email protected]
2024-12-11a4b5374b-7029-4e65-b474-2c884e087f48null2024-12-11T11:56:43.078Z4001.0499{"messages":[{"role":"user","content":"what's a good cookie?"}],"temperature":0,"top_p":0.95,"stream":false}{"error":"Received error from anthropic","external_model_message":{"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: 8192 > 4096, which is the maximum allowed number of output tokens for claude-3-haiku-20240307"}}}455f0d9643774b9d983341c928fe03c6List()[email protected]
2024-12-119a2b8197-b167-46de-b3f4-1c3ef83d7221null2024-12-11T11:55:40.779Z4001.01935{"messages":[{"role":"user","content":"what do you think makes a good cookie?"}],"temperature":0,"top_p":0.95,"stream":false}{"error":"Received error from anthropic","external_model_message":{"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: 8192 > 4096, which is the maximum allowed number of output tokens for claude-3-haiku-20240307"}}}455f0d9643774b9d983341c928fe03c6List()[email protected]
2024-12-11dbb5e0da-c788-4936-90b3-c98bd1954ce9null2024-12-11T11:54:38.386Z4001.01267{"messages":[{"role":"user","content":"what do you think makes a good cookie?"}],"temperature":0,"top_p":0.95,"stream":false}{"error":"Received error from anthropic","external_model_message":{"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: 8192 > 4096, which is the maximum allowed number of output tokens for claude-3-haiku-20240307"}}}455f0d9643774b9d983341c928fe03c6List()[email protected]
2024-12-11b43ddd25-6fa2-4967-9a1b-e9cbe1025399null2024-12-11T11:55:47.318Z4001.01260{"messages":[{"role":"user","content":"what do you think makes a good cookie?"}],"temperature":0,"top_p":0.95,"stream":false}{"error":"Received error from anthropic","external_model_message":{"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: 8192 > 4096, which is the maximum allowed number of output tokens for claude-3-haiku-20240307"}}}455f0d9643774b9d983341c928fe03c6List()[email protected]