cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Add AI Guardrail results into response?

Rjdudley
Honored Contributor

We're considering switching from Azure AI Foundry to Mosaic AI Gateway.  One nice feature AI Foundry has is it adds the content filter results to the response (and in a streaming response, each delta).  This allows us to provide some feedback to the user, and because the filter results are in the response, they end up in the inference table, and we can extract and analyze the results.  We turned on AI Guardrails for some Databricks-hosted models but we don't see any results in the inference tables.  Is there a way to add these results to the response so we can manifest them in our UI?

4 REPLIES 4

KaushalVachhani
Databricks Employee
Databricks Employee

Hi @Rjdudley, if you enable the guardrails on the endpoint and configure the inference table, the appropriate information gets logged in the response column of the inference table (When the guardrail is triggered). In th snapshot below, it has been tripped for PII data detection.

KaushalVachhani_0-1762954261524.png

KaushalVachhani_3-1762954802328.png

Do you not see the same behaviour? Or let me know if I misunderstood the question. 

Rjdudley
Honored Contributor

@KaushalVachhani Does that only happen if you trigger the guardrail?  We have not seen that yet but maybe we have not triggered it yet.  AI Foundry adds that information in every response (and in the case of streaming, every chunk).  We have been experimenting with Safety but we'll try the PII guardrail.

@Rjdudley, in the inference table, it appears to log the guardrails information only when they are tripped. Maybe you can filter the response using finishReason to get only tripped requests.

CharlotteMarti2
New Contributor II

To include AI Guardrail results in your responses, you need to enable logging or metadata propagation when the model generates output. Check if Mosaic AI Gateway supports attaching Guardrail flags or filter results as part of the response payload or streaming deltas. If not, consider using a post-processing step that queries the Guardrail service separately and merges results into your UI or inference table.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now