plural 0.6.0__py3-none-any.whl
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.
- plural/__init__.py +123 -0
- plural/benchmarks/__init__.py +33 -0
- plural/benchmarks/runner.py +891 -0
- plural/catalog/__init__.py +27 -0
- plural/catalog/data/__init__.py +1 -0
- plural/catalog/data/models.json +1468 -0
- plural/catalog/models.py +509 -0
- plural/catalog/sync.py +1236 -0
- plural/client.py +674 -0
- plural/config.py +37 -0
- plural/environments/__init__.py +70 -0
- plural/environments/action.py +135 -0
- plural/environments/dataset.py +477 -0
- plural/environments/env.py +1240 -0
- plural/environments/episode.py +74 -0
- plural/environments/export/__init__.py +8 -0
- plural/environments/export/hf.py +56 -0
- plural/environments/export/verifiers.py +86 -0
- plural/environments/fingerprint.py +239 -0
- plural/environments/policy.py +120 -0
- plural/environments/replay.py +321 -0
- plural/environments/rollout.py +44 -0
- plural/environments/runtime.py +129 -0
- plural/environments/step.py +43 -0
- plural/environments/stop.py +42 -0
- plural/environments/task.py +47 -0
- plural/environments/tool.py +233 -0
- plural/environments/types.py +109 -0
- plural/errors.py +119 -0
- plural/providers/__init__.py +54 -0
- plural/providers/anthropic.py +653 -0
- plural/providers/azure.py +142 -0
- plural/providers/base.py +298 -0
- plural/providers/bedrock.py +925 -0
- plural/providers/google.py +426 -0
- plural/providers/openai_compatible.py +675 -0
- plural/providers/openai_responses.py +552 -0
- plural/providers/structured.py +136 -0
- plural/py.typed +0 -0
- plural/routing/__init__.py +29 -0
- plural/routing/policies.py +293 -0
- plural/routing/router.py +497 -0
- plural/schemas/__init__.py +1 -0
- plural/schemas/trace.v1.json +1529 -0
- plural/tracing/__init__.py +52 -0
- plural/tracing/redaction.py +226 -0
- plural/tracing/resources.py +23 -0
- plural/tracing/schema.py +686 -0
- plural/tracing/sinks.py +318 -0
- plural/tracing/writer.py +170 -0
- plural/types.py +494 -0
- plural-0.6.0.dist-info/METADATA +147 -0
- plural-0.6.0.dist-info/RECORD +55 -0
- plural-0.6.0.dist-info/WHEEL +4 -0
- plural-0.6.0.dist-info/licenses/LICENSE +201 -0
plural/__init__.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Plural: unified LLM routing with first-class traces, environments, and benchmarks.
|
|
2
|
+
|
|
3
|
+
Examples:
|
|
4
|
+
>>> from plural import __version__
|
|
5
|
+
>>> isinstance(__version__, str)
|
|
6
|
+
True
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
12
|
+
|
|
13
|
+
from plural.benchmarks import (
|
|
14
|
+
Benchmark,
|
|
15
|
+
CaseKey,
|
|
16
|
+
CaseResult,
|
|
17
|
+
ModelStats,
|
|
18
|
+
Report,
|
|
19
|
+
RunManifest,
|
|
20
|
+
TaskDatasetMetadata,
|
|
21
|
+
TaskSetMetadata,
|
|
22
|
+
WinRatePair,
|
|
23
|
+
)
|
|
24
|
+
from plural.catalog import ModelCatalog, ModelSpec, estimate_cost
|
|
25
|
+
from plural.client import Plural
|
|
26
|
+
from plural.environments import (
|
|
27
|
+
ActionResult,
|
|
28
|
+
Dataset,
|
|
29
|
+
Environment,
|
|
30
|
+
PluralPolicy,
|
|
31
|
+
Policy,
|
|
32
|
+
ScriptedPolicy,
|
|
33
|
+
StopReason,
|
|
34
|
+
TaskData,
|
|
35
|
+
TaskDataset,
|
|
36
|
+
TraceDataset,
|
|
37
|
+
TraceFilter,
|
|
38
|
+
)
|
|
39
|
+
from plural.errors import (
|
|
40
|
+
AuthenticationError,
|
|
41
|
+
BudgetExceededError,
|
|
42
|
+
ConfigurationError,
|
|
43
|
+
ContentFilterError,
|
|
44
|
+
ContextLengthError,
|
|
45
|
+
InvalidRequestError,
|
|
46
|
+
NotFoundError,
|
|
47
|
+
PluralError,
|
|
48
|
+
ProviderUnavailable,
|
|
49
|
+
RateLimitError,
|
|
50
|
+
TimeoutError,
|
|
51
|
+
is_retryable,
|
|
52
|
+
)
|
|
53
|
+
from plural.tracing import (
|
|
54
|
+
JSONLSink,
|
|
55
|
+
Outcome,
|
|
56
|
+
Redactor,
|
|
57
|
+
Sampler,
|
|
58
|
+
SQLiteSink,
|
|
59
|
+
Trace,
|
|
60
|
+
TraceContext,
|
|
61
|
+
TraceKind,
|
|
62
|
+
TraceWriter,
|
|
63
|
+
)
|
|
64
|
+
from plural.types import ChatRequest, ChatResponse, Message, Tool, Usage
|
|
65
|
+
|
|
66
|
+
try:
|
|
67
|
+
__version__ = version("plural")
|
|
68
|
+
except PackageNotFoundError: # pragma: no cover
|
|
69
|
+
__version__ = "0.0.0"
|
|
70
|
+
|
|
71
|
+
__all__ = [
|
|
72
|
+
"ActionResult",
|
|
73
|
+
"AuthenticationError",
|
|
74
|
+
"Benchmark",
|
|
75
|
+
"BudgetExceededError",
|
|
76
|
+
"CaseKey",
|
|
77
|
+
"CaseResult",
|
|
78
|
+
"ChatRequest",
|
|
79
|
+
"ChatResponse",
|
|
80
|
+
"ConfigurationError",
|
|
81
|
+
"ContentFilterError",
|
|
82
|
+
"ContextLengthError",
|
|
83
|
+
"Dataset",
|
|
84
|
+
"Environment",
|
|
85
|
+
"InvalidRequestError",
|
|
86
|
+
"JSONLSink",
|
|
87
|
+
"Message",
|
|
88
|
+
"ModelCatalog",
|
|
89
|
+
"ModelSpec",
|
|
90
|
+
"ModelStats",
|
|
91
|
+
"NotFoundError",
|
|
92
|
+
"Outcome",
|
|
93
|
+
"Plural",
|
|
94
|
+
"PluralError",
|
|
95
|
+
"PluralPolicy",
|
|
96
|
+
"Policy",
|
|
97
|
+
"ProviderUnavailable",
|
|
98
|
+
"RateLimitError",
|
|
99
|
+
"Redactor",
|
|
100
|
+
"Report",
|
|
101
|
+
"RunManifest",
|
|
102
|
+
"SQLiteSink",
|
|
103
|
+
"Sampler",
|
|
104
|
+
"ScriptedPolicy",
|
|
105
|
+
"StopReason",
|
|
106
|
+
"TaskData",
|
|
107
|
+
"TaskDataset",
|
|
108
|
+
"TaskDatasetMetadata",
|
|
109
|
+
"TaskSetMetadata",
|
|
110
|
+
"TimeoutError",
|
|
111
|
+
"Tool",
|
|
112
|
+
"Trace",
|
|
113
|
+
"TraceContext",
|
|
114
|
+
"TraceDataset",
|
|
115
|
+
"TraceFilter",
|
|
116
|
+
"TraceKind",
|
|
117
|
+
"TraceWriter",
|
|
118
|
+
"Usage",
|
|
119
|
+
"WinRatePair",
|
|
120
|
+
"__version__",
|
|
121
|
+
"estimate_cost",
|
|
122
|
+
"is_retryable",
|
|
123
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Benchmarks: run environments across models and produce reports.
|
|
2
|
+
|
|
3
|
+
Examples:
|
|
4
|
+
>>> from plural.benchmarks import Benchmark, Report
|
|
5
|
+
>>> Benchmark.__name__
|
|
6
|
+
'Benchmark'
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from plural.benchmarks.runner import (
|
|
12
|
+
Benchmark,
|
|
13
|
+
CaseKey,
|
|
14
|
+
CaseResult,
|
|
15
|
+
ModelStats,
|
|
16
|
+
Report,
|
|
17
|
+
RunManifest,
|
|
18
|
+
TaskDatasetMetadata,
|
|
19
|
+
TaskSetMetadata,
|
|
20
|
+
WinRatePair,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"Benchmark",
|
|
25
|
+
"CaseKey",
|
|
26
|
+
"CaseResult",
|
|
27
|
+
"ModelStats",
|
|
28
|
+
"Report",
|
|
29
|
+
"RunManifest",
|
|
30
|
+
"TaskDatasetMetadata",
|
|
31
|
+
"TaskSetMetadata",
|
|
32
|
+
"WinRatePair",
|
|
33
|
+
]
|