Metadata-Version: 2.4
Name: aas-smt-verification
Version: 1.0.0rc1
Summary: Run a battery of checks on an AAS Submodel Template.
Author-email: Marko Ristin <marko@ristin.ch>
License-Expression: MIT
Project-URL: Homepage, https://github.com/eclipse-aascw/aas-smt-verification
Keywords: asset administration shell,submodel template,verification,industry 4.0,industrie 4.0,i4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: icontract<3,>=2.7.3
Requires-Dist: aas-core3.0<2,>=1.1.2
Requires-Dist: aas-core3.1<2,>=1.0.0
Requires-Dist: aas-core3.2<2,>=1.0.0rc2
Requires-Dist: aas-package3==1.0.0rc1
Requires-Dist: aas-smt-lint==1.0.0rc2
Requires-Dist: aas-smt-verification-with-llms==1.0.0rc5
Dynamic: license-file

********************
aas-smt-verification
********************

.. image:: https://github.com/eclipse-aascw/aas-smt-verification/actions/workflows/ci.yml/badge.svg
    :target: https://github.com/eclipse-aascw/aas-smt-verification/actions/workflows/ci.yml
    :alt: Continuous integration

Run a battery of checks on an AAS Submodel Template.

The submodel template is given either as an AAS environment in JSON (``.json``) or XML (``.xml``), or as an AAS package (``.aasx``).
In case of a package, all the AAS specs in it are read with `aas-package3`_ and merged into a single environment.

.. _aas-package3: https://pypi.org/project/aas-package3/

The versions 3.0, 3.1 and 3.2 of the AAS meta-model are supported, selected with ``--aas_version`` (default: 3.1).
XML files are checked to be in the namespace of the given version, while JSON files do not indicate the version, so they are simply assumed to be of the given version.

The checks are organized in groups:

``lint``
    The verification of the AAS meta-model constraints and the rule-based checks of `aas-smt-lint`_.
    Each rule is reported as a separate check (*e.g.*, ``lint.cardinality``).

``with-llms``
    The semantic checks of `aas-smt-verification-with-llms`_, where a Large Language Model judges whether the descriptions, concept descriptions, units, value types, display names and ID-shorts are consistent.
    Each prompt is reported as a separate check (*e.g.*, ``with-llms.concept_description_to_unit``).
    These checks need an LLM backend (``--llm``), either OpenAI or a local Ollama.
    The findings are only suggestions and need to be judged by a human.

.. _aas-smt-lint: https://pypi.org/project/aas-smt-lint/
.. _aas-smt-verification-with-llms: https://pypi.org/project/aas-smt-verification-with-llms/

All the groups run by default.
Use ``--select`` and ``--skip`` to choose the groups.

The report is written to STDOUT, unless you specify ``--report_path``.
It is human-readable by default; use ``--report_format json`` to process it further.

The program exits with code 0 if all the checks passed (or were not applicable), and 1 otherwise.

Installation
============

.. code-block::

    pip3 install aas-smt-verification

Usage
=====
Run only the rule-based checks:

.. code-block::

    aas-smt-verification \
        --path IDTA_02006_Template_DigitalNameplate.aasx \
        --skip with-llms

Run all the checks with OpenAI and write a JSON report to a file:

.. code-block::

    aas-smt-verification \
        --path IDTA_02006_Template_DigitalNameplate.json \
        --llm openai \
        --openai_api_key_file openai-key.txt \
        --report_format json \
        --report_path report.json

Run only the checks with a local Ollama model:

.. code-block::

    aas-smt-verification \
        --path IDTA_02006_Template_DigitalNameplate.xml \
        --select with-llms \
        --llm ollama \
        --ollama_model llama3.1

``--help``
==========

.. Help starts: aas-smt-verification --help
.. code-block::

    usage: aas-smt-verification [-h] --path PATH [--aas_version {3.0,3.1,3.2}]
                                [--report_path REPORT_PATH]
                                [--report_format {text,json}] [--select  [...]]
                                [--skip  [...]] [--llm {openai,ollama}]
                                [--openai_api_key_file OPENAI_API_KEY_FILE]
                                [--openai_model OPENAI_MODEL]
                                [--ollama_model OLLAMA_MODEL]
                                [--ollama_host OLLAMA_HOST]
                                [--ollama_timeout OLLAMA_TIMEOUT] [--version]

    Run a battery of checks on an AAS Submodel Template.

    options:
      -h, --help            show this help message and exit
      --path PATH           Path to the submodel template as an AAS environment in
                            JSON (.json), XML (.xml) or as an AAS package (.aasx)
      --aas_version {3.0,3.1,3.2}
                            Version of the AAS meta-model of the submodel template
                            (default: 3.1); XML files are checked to be in the
                            namespace of this version, while JSON files do not
                            indicate the version, so they are simply assumed to be
                            of this version
      --report_path REPORT_PATH
                            If set, write the report to this file instead of
                            STDOUT
      --report_format {text,json}
                            Format of the report
      --select  [ ...]      If set, run only the selected groups of checks, given
                            as a space-separated list of: lint with-llms
      --skip  [ ...]        If set, skip the given groups of checks, given as a
                            space-separated list of: lint with-llms
      --llm {openai,ollama}
                            LLM backend for the checks with LLMs; required unless
                            you skip with-llms
      --openai_api_key_file OPENAI_API_KEY_FILE
                            Path to the file containing the OpenAI API key; if not
                            set, the environment variable OPENAI_API_KEY is used
      --openai_model OPENAI_MODEL
                            OpenAI model name (default: gpt-5-2025-08-07)
      --ollama_model OLLAMA_MODEL
                            Ollama model name (default: llama3.1)
      --ollama_host OLLAMA_HOST
                            Ollama host URL; if not set, the environment variable
                            OLLAMA_HOST is used, or http://localhost:11434 if the
                            variable is not set
      --ollama_timeout OLLAMA_TIMEOUT
                            HTTP timeout in seconds for Ollama (default: 60)
      --version             Show the current version and exit

.. Help ends: aas-smt-verification --help

Contributing
============
See `CONTRIBUTING.rst`_.

.. _CONTRIBUTING.rst: https://github.com/eclipse-aascw/aas-smt-verification/tree/main/CONTRIBUTING.rst
