Skip to content

Testing Your Customer Service Model

Let's verify that your deployed model works correctly for customer service scenarios. This will take about 15 minutes.

Quick Test

from azure.identity import DefaultAzureCredential
from azure.ai.resources import AIProjectClient
import os

def test_customer_service_model():
    """Test the deployed customer service model."""
    try:
        # Initialize client
        credential = DefaultAzureCredential()
        client = AIProjectClient(
            subscription_id=os.getenv("AZURE_SUBSCRIPTION_ID"),
            resource_group=os.getenv("AZURE_RESOURCE_GROUP"),
            credential=credential
        )

        # Test cases
        test_cases = [
            {
                "input": "How do I reset my password?",
                "expected_topics": ["password", "reset", "account"]
            },
            {
                "input": "When is my next billing date?",
                "expected_topics": ["billing", "payment", "date"]
            },
            {
                "input": "What features are included?",
                "expected_topics": ["features", "product", "capabilities"]
            }
        ]

        # Run tests
        results = []
        for test in test_cases:
            response = client.models.generate(
                deployment_name="customer-service-v1",
                prompt=test["input"],
                max_tokens=100
            )

            # Simple topic check
            topics_found = any(
                topic in response.lower() 
                for topic in test["expected_topics"]
            )

            results.append({
                "input": test["input"],
                "response": response,
                "topics_found": topics_found
            })

        return results
    except Exception as e:
        print(f"Testing error: {str(e)}")
        raise

# Usage example
if __name__ == "__main__":
    results = test_customer_service_model()
    for result in results:
        print(f"\nTest: {result['input']}")
        print(f"Response: {result['response']}")
        print(f"Topics found: {result['topics_found']}")

What to Check

  1. Response Relevance
  2. Does the model understand customer queries?
  3. Are responses on-topic and helpful?
  4. Is the context maintained?

  5. Response Quality

  6. Clear and concise answers
  7. Professional tone
  8. Accurate information

  9. Error Handling

  10. Graceful handling of unclear queries
  11. Appropriate error messages
  12. Fallback responses

Interactive Workshop

For hands-on practice with model testing in Azure AI Foundry, try our interactive notebook:

Launch Model Testing Workshop

This notebook provides: - Basic model testing examples - Performance evaluation techniques - Load testing scenarios - Error handling and validation - Best practices for comprehensive testing

Next: Creating Your Agent