Skip to main content

ASPICE Knowledge Base & Agent Workflow evaluation tool for SDP gap analysis

Project description

aspice-eval

ASPICE evaluation engine — knowledge base, gap analysis evaluator, and reports.

Library Usage

Evaluate an SDP

from aspice_eval import evaluate_sdp, ModelConfig

result = evaluate_sdp(
    "docs/sdp.md",
    ModelConfig(
        provider="bedrock",
        model_name="us.anthropic.claude-sonnet-4-20250514-v1:0",
        region="us-east-1",
    ),
    target_level=3,
    process_groups=["SWE", "SYS"],
)

print(f"Criteria assessed: {len(result.ratings)}")
print(f"Gaps found: {len([r for r in result.ratings if r.gaps])}")
print(f"Tokens used: {result.token_usage['total_tokens']}")

Validate a Knowledge Base

from aspice_eval import validate_kb

result = validate_kb("knowledge_base")

if not result.is_valid:
    for error in result.schema_errors:
        print(f"Schema error: {error}")
    for gap in result.completeness_gaps:
        print(f"Completeness gap: {gap}")
else:
    print("Knowledge base is valid")

Extension Points

Custom Evaluator

Subclass GapAnalysisEvaluator to plug in a custom LLM provider or rule-based engine:

from aspice_eval import GapAnalysisEvaluator, ModelConfig, register_evaluator

class LocalLlamaEvaluator(GapAnalysisEvaluator):
    """Evaluator using a local Llama model."""

    def _call_model(self, prompt: str) -> str:
        # Call your local model and return JSON response
        ...

# Register the custom provider
register_evaluator("local-llama", LocalLlamaEvaluator)

# Use it via the standard factory
from aspice_eval import create_evaluator

evaluator = create_evaluator(ModelConfig(provider="local-llama"))

Custom Knowledge Base Standards

Three levels of extensibility for non-ASPICE standards:

Level 1 — Custom YAML files (no code required):

Drop a new subdirectory under the KB root with YAML files conforming to the criteria schema:

knowledge_base/
├── aspice/          # Built-in ASPICE v4.0
└── iso26262/        # Your custom standard
    ├── _metadata.yaml
    └── functional_safety.yaml
from aspice_eval import evaluate_sdp, ModelConfig

result = evaluate_sdp(
    "docs/sdp.md",
    ModelConfig(provider="bedrock", model_name="...", region="us-east-1"),
    standard="iso26262",
)

Level 2 — In-memory construction via from_dict:

from aspice_eval import KnowledgeBase

kb = KnowledgeBase.from_dict({
    "processes": [
        {
            "process_id": "SWE.1",
            "process_name": "Software Requirements Analysis",
            "criteria": [...],
        }
    ]
})
criteria = kb.get_criteria(groups=["SWE"], max_level=3)

Level 3 — Custom KB loader (pluggable schema):

For standards with fundamentally different structures, subclass KnowledgeBase and register a loader:

from aspice_eval import KnowledgeBase, register_kb_loader, CriteriaEntry

class NISTCSFKnowledgeBase(KnowledgeBase):
    """Custom loader for NIST Cybersecurity Framework."""

    def load(self, standard: str) -> None:
        # Read NIST-shaped YAML/JSON, convert to CriteriaEntry list
        ...

    def get_criteria(self, groups, max_level) -> list[CriteriaEntry]:
        # Return entries filtered by NIST "Functions" instead of ASPICE groups
        ...

register_kb_loader("nist-csf", NISTCSFKnowledgeBase)

Custom Report Renderer

Subclass ReportRenderer to output evaluation results in formats beyond Markdown and HTML:

from aspice_eval import ReportRenderer, register_renderer
from aspice_eval import EvaluationResult, CapabilityLevelResult, EvaluationConfig

class JSONReportRenderer(ReportRenderer):
    """Render evaluation results as JSON."""

    def render(self, evaluation, levels, config, kb_metadata) -> str:
        import json
        return json.dumps({
            "ratings": [
                {"criteria_id": r.criteria_id, "rating": r.rating, "gaps": r.gaps}
                for r in evaluation.ratings
            ],
        }, indent=2)

# Register and use
register_renderer("json", JSONReportRenderer)

CLI Usage

aspice-eval evaluate

# Evaluate an SDP document
aspice-eval evaluate --sdp path/to/sdp.md --target-level 2 --groups SWE,MAN

# Write report to a file
aspice-eval evaluate --sdp path/to/sdp.md --output report.md

# Use a specific AI provider
aspice-eval evaluate --sdp path/to/sdp.md --provider bedrock \
  --model us.anthropic.claude-sonnet-4-20250514-v1:0 --region us-east-1

aspice-eval validate-kb

# Validate the default knowledge base
aspice-eval validate-kb

# Validate a custom knowledge base
aspice-eval validate-kb --kb-path /path/to/knowledge_base

Installation

pip install aspice-eval

# With AI provider support
pip install "aspice-eval[bedrock]"     # Amazon Bedrock (Claude)
pip install "aspice-eval[openai]"      # OpenAI GPT-4o
pip install "aspice-eval[anthropic]"   # Anthropic Claude (direct API)
pip install "aspice-eval[all]"         # All providers

Requires Python 3.10+.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aspice_eval-0.2.1.tar.gz (88.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aspice_eval-0.2.1-py3-none-any.whl (71.6 kB view details)

Uploaded Python 3

File details

Details for the file aspice_eval-0.2.1.tar.gz.

File metadata

  • Download URL: aspice_eval-0.2.1.tar.gz
  • Upload date:
  • Size: 88.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aspice_eval-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8170d5516b62dc41a30f5f4fae3342ad4138a52c35458b6a4b30cac99e971e27
MD5 1e8d4db163d3b3cbfdb060db0a7663ec
BLAKE2b-256 fa44f72afc64c6118f928af2eecfe2915c559724b2c3615f9b886b07caf4af4e

See more details on using hashes here.

File details

Details for the file aspice_eval-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: aspice_eval-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 71.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for aspice_eval-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da4f6c33d3ac1454f5b1fefe9f84224fbc4275ac849426401a4de7dc9e2cda9e
MD5 e0cc50651e5d823139c55613ebd78b51
BLAKE2b-256 d0f40a3ebfef5787b9df75e71316be80c8f805c1d21819a807d10b63586ecfee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page