Testing ai applications

From vamseeachanta/workspace-hub · View interactive version

Testing ai applications is an AI agent skill from the GitHub repository vamseeachanta/workspace-hub. Sub-skill of ai-prompting: Testing AI Applications.

How to use this skill

Skill file

Testing AI Applications

Testing AI Applications

import pytest
from unittest.mock import Mock

def test_prompt_produces_valid_output():
    """Test prompt template produces expected format."""
    response = generate_with_template(
        template=SUMMARY_TEMPLATE,
        input_text="Sample text for testing..."
    )
    assert len(response) < len(input_text)
    assert response.strip()

def test_chain_handles_empty_context():
    """Test chain gracefully handles edge cases."""
    result = qa_chain.run(context="", question="What is X?")
    assert "cannot answer" in result.lower() or "no information" in result.lower()

def test_embedding_consistency():
    """Test embeddings are deterministic."""
    text = "Test sentence"
    emb1 = get_embedding(text)
    emb2 = get_embedding(text)
    assert emb1 == emb2
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.