aisc-plugin-interface 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aisc_plugin_interface-0.2.4/.gitignore +12 -0
- aisc_plugin_interface-0.2.4/PKG-INFO +86 -0
- aisc_plugin_interface-0.2.4/README.md +77 -0
- aisc_plugin_interface-0.2.4/pyproject.toml +25 -0
- aisc_plugin_interface-0.2.4/src/aisc_plugin_interface/templates/init.py.tpl +3 -0
- aisc_plugin_interface-0.2.4/src/aisc_plugin_interface/templates/plugin.py.tpl +19 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aisc-plugin-interface
|
|
3
|
+
Version: 0.2.4
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: pydantic>=2.12.5
|
|
7
|
+
Requires-Dist: rich>=14.3.3
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# AISC Plugin Interface
|
|
11
|
+
|
|
12
|
+
This repository provides the base interface for writing evaluation plugins.
|
|
13
|
+
|
|
14
|
+
If you are new to the platform, start here:
|
|
15
|
+
|
|
16
|
+
- [Plugin Developer Guide](PLUGIN_DEVELOPER_GUIDE.md)
|
|
17
|
+
|
|
18
|
+
That guide covers:
|
|
19
|
+
|
|
20
|
+
- the plugin contract and discovery model
|
|
21
|
+
- how to create a plugin project
|
|
22
|
+
- how to implement configuration, inputs, metrics, and progress reporting
|
|
23
|
+
- optional integration hooks and current extension points
|
|
24
|
+
- common failure modes and architectural feedback areas
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
Create a new plugin project:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
mkdir my-aisc-plugin
|
|
32
|
+
cd my-aisc-plugin
|
|
33
|
+
uv init --lib
|
|
34
|
+
uv add git+https://github.com/lux-ai-factory/aisc-plugin-interface
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Implement a plugin class that inherits from `BaseEvaluationPlugin[T]`, then export it from your package `__init__.py`.
|
|
38
|
+
|
|
39
|
+
Minimal example:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from typing import Any
|
|
43
|
+
|
|
44
|
+
from aisc_plugin_interface.models.measure import Measure
|
|
45
|
+
from aisc_plugin_interface.base_evaluation_plugin import metric, BaseEvaluationPlugin
|
|
46
|
+
from pydantic import BaseModel, Field
|
|
47
|
+
|
|
48
|
+
from aisc_plugin_interface import BaseEvaluationPlugin, Measure, metric
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ConfigFormSchema(BaseModel):
|
|
52
|
+
threshold: float = Field(default=0.5, ge=0.0, le=1.0)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class MyPlugin(BaseEvaluationPlugin[ConfigFormSchema]):
|
|
56
|
+
def evaluate(self, config_data: dict) -> Any:
|
|
57
|
+
# Dependencies only used during evaluation should be imported locally here
|
|
58
|
+
import numpy as np
|
|
59
|
+
|
|
60
|
+
# Access configuration form data
|
|
61
|
+
config: ConfigFormSchema = self.validate_config_form_data(config_data)
|
|
62
|
+
threshold: float = config.threshold
|
|
63
|
+
|
|
64
|
+
# Your evaluation logic here
|
|
65
|
+
|
|
66
|
+
# Use self.logger for logging
|
|
67
|
+
self.logger.info("Evaluation completed successfully")
|
|
68
|
+
|
|
69
|
+
return {"MyMetric": [0.99, 0.5, 0.67], "OtherMetric": [0.01, 0.22, 0.77]}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@metric("MyMetric")
|
|
73
|
+
def my_metric(self, evaluation_output: Any) -> list[Measure]:
|
|
74
|
+
values = evaluation_output.get("MyMetric", [])
|
|
75
|
+
return [Measure(name="MyMetric", score=value) for value in values]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Export it:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from .plugin import MyPlugin
|
|
82
|
+
|
|
83
|
+
__all__ = ["MyPlugin"]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For the full development workflow, use the guide above.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# AISC Plugin Interface
|
|
2
|
+
|
|
3
|
+
This repository provides the base interface for writing evaluation plugins.
|
|
4
|
+
|
|
5
|
+
If you are new to the platform, start here:
|
|
6
|
+
|
|
7
|
+
- [Plugin Developer Guide](PLUGIN_DEVELOPER_GUIDE.md)
|
|
8
|
+
|
|
9
|
+
That guide covers:
|
|
10
|
+
|
|
11
|
+
- the plugin contract and discovery model
|
|
12
|
+
- how to create a plugin project
|
|
13
|
+
- how to implement configuration, inputs, metrics, and progress reporting
|
|
14
|
+
- optional integration hooks and current extension points
|
|
15
|
+
- common failure modes and architectural feedback areas
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Create a new plugin project:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
mkdir my-aisc-plugin
|
|
23
|
+
cd my-aisc-plugin
|
|
24
|
+
uv init --lib
|
|
25
|
+
uv add git+https://github.com/lux-ai-factory/aisc-plugin-interface
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Implement a plugin class that inherits from `BaseEvaluationPlugin[T]`, then export it from your package `__init__.py`.
|
|
29
|
+
|
|
30
|
+
Minimal example:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from typing import Any
|
|
34
|
+
|
|
35
|
+
from aisc_plugin_interface.models.measure import Measure
|
|
36
|
+
from aisc_plugin_interface.base_evaluation_plugin import metric, BaseEvaluationPlugin
|
|
37
|
+
from pydantic import BaseModel, Field
|
|
38
|
+
|
|
39
|
+
from aisc_plugin_interface import BaseEvaluationPlugin, Measure, metric
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ConfigFormSchema(BaseModel):
|
|
43
|
+
threshold: float = Field(default=0.5, ge=0.0, le=1.0)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class MyPlugin(BaseEvaluationPlugin[ConfigFormSchema]):
|
|
47
|
+
def evaluate(self, config_data: dict) -> Any:
|
|
48
|
+
# Dependencies only used during evaluation should be imported locally here
|
|
49
|
+
import numpy as np
|
|
50
|
+
|
|
51
|
+
# Access configuration form data
|
|
52
|
+
config: ConfigFormSchema = self.validate_config_form_data(config_data)
|
|
53
|
+
threshold: float = config.threshold
|
|
54
|
+
|
|
55
|
+
# Your evaluation logic here
|
|
56
|
+
|
|
57
|
+
# Use self.logger for logging
|
|
58
|
+
self.logger.info("Evaluation completed successfully")
|
|
59
|
+
|
|
60
|
+
return {"MyMetric": [0.99, 0.5, 0.67], "OtherMetric": [0.01, 0.22, 0.77]}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@metric("MyMetric")
|
|
64
|
+
def my_metric(self, evaluation_output: Any) -> list[Measure]:
|
|
65
|
+
values = evaluation_output.get("MyMetric", [])
|
|
66
|
+
return [Measure(name="MyMetric", score=value) for value in values]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Export it:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from .plugin import MyPlugin
|
|
73
|
+
|
|
74
|
+
__all__ = ["MyPlugin"]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For the full development workflow, use the guide above.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "aisc-plugin-interface"
|
|
3
|
+
version = "0.2.4"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pydantic>=2.12.5",
|
|
9
|
+
"rich>=14.3.3",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["hatchling"]
|
|
14
|
+
build-backend = "hatchling.build"
|
|
15
|
+
|
|
16
|
+
[tool.hatch.build.targets.wheel]
|
|
17
|
+
packages = ["src/aisc_plugin_interface"]
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build]
|
|
20
|
+
include = [
|
|
21
|
+
"src/aisc_plugin_interface/templates/*.tpl",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
aisc-plugin-interface = "aisc_plugin_interface.cli:main"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
from aisc_plugin_interface import BaseEvaluationPlugin, Measure, metric
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Define the configuration form schema
|
|
9
|
+
class ConfigFormSchema(BaseModel):
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class {{ plugin_name }}(BaseEvaluationPlugin[ConfigFormSchema]):
|
|
14
|
+
def evaluate(self, config_data: dict) -> Any:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
@metric("my-metric")
|
|
18
|
+
def my_metric(self, evaluation_output: Any) -> list[Measure]:
|
|
19
|
+
pass
|