Skip to content

Python: Content Filtering not triggering as expected #1571

@Justrebl

Description

@Justrebl

Hello,

I've been playing with the Agent Framework, and built the simplest ChatAgent just to test the format of content filtering in the agent.run() result.
Using a demo example from the guardrail testing in Azure AI Foundry portal, i can see the content filtering trigger as expected :

Image

Running the exact same prompt to my basic agent, i actually retrieve an information, no content-filtering triggered, same AI Foundry Project, model and content-filtering configurations :

Image

Here's the code behind :

@app.route('/ask', methods=['POST'])
async def ask():
    data = request.get_json()
    try:
        model = Query(**data)
        async with (
            AzureCliCredential() as credential,
            ChatAgent(
                chat_client=AzureAIAgentClient(async_credential=credential),
                instructions="You are a helpful assistant."
            ) as agent,
        ):
            await agent.chat_client.setup_azure_ai_observability(enable_sensitive_data=True)
            result = await agent.run(model.query)
            return jsonify({
                'query': model.query,
                'sessionId': model.sessionId,
                'answer': result.text
            })

Am I missing something ?
Thanks !

Metadata

Metadata

Assignees

Labels

agentsIssues related to single agentspythonv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions