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.
Files changed (55) hide show
  1. plural/__init__.py +123 -0
  2. plural/benchmarks/__init__.py +33 -0
  3. plural/benchmarks/runner.py +891 -0
  4. plural/catalog/__init__.py +27 -0
  5. plural/catalog/data/__init__.py +1 -0
  6. plural/catalog/data/models.json +1468 -0
  7. plural/catalog/models.py +509 -0
  8. plural/catalog/sync.py +1236 -0
  9. plural/client.py +674 -0
  10. plural/config.py +37 -0
  11. plural/environments/__init__.py +70 -0
  12. plural/environments/action.py +135 -0
  13. plural/environments/dataset.py +477 -0
  14. plural/environments/env.py +1240 -0
  15. plural/environments/episode.py +74 -0
  16. plural/environments/export/__init__.py +8 -0
  17. plural/environments/export/hf.py +56 -0
  18. plural/environments/export/verifiers.py +86 -0
  19. plural/environments/fingerprint.py +239 -0
  20. plural/environments/policy.py +120 -0
  21. plural/environments/replay.py +321 -0
  22. plural/environments/rollout.py +44 -0
  23. plural/environments/runtime.py +129 -0
  24. plural/environments/step.py +43 -0
  25. plural/environments/stop.py +42 -0
  26. plural/environments/task.py +47 -0
  27. plural/environments/tool.py +233 -0
  28. plural/environments/types.py +109 -0
  29. plural/errors.py +119 -0
  30. plural/providers/__init__.py +54 -0
  31. plural/providers/anthropic.py +653 -0
  32. plural/providers/azure.py +142 -0
  33. plural/providers/base.py +298 -0
  34. plural/providers/bedrock.py +925 -0
  35. plural/providers/google.py +426 -0
  36. plural/providers/openai_compatible.py +675 -0
  37. plural/providers/openai_responses.py +552 -0
  38. plural/providers/structured.py +136 -0
  39. plural/py.typed +0 -0
  40. plural/routing/__init__.py +29 -0
  41. plural/routing/policies.py +293 -0
  42. plural/routing/router.py +497 -0
  43. plural/schemas/__init__.py +1 -0
  44. plural/schemas/trace.v1.json +1529 -0
  45. plural/tracing/__init__.py +52 -0
  46. plural/tracing/redaction.py +226 -0
  47. plural/tracing/resources.py +23 -0
  48. plural/tracing/schema.py +686 -0
  49. plural/tracing/sinks.py +318 -0
  50. plural/tracing/writer.py +170 -0
  51. plural/types.py +494 -0
  52. plural-0.6.0.dist-info/METADATA +147 -0
  53. plural-0.6.0.dist-info/RECORD +55 -0
  54. plural-0.6.0.dist-info/WHEEL +4 -0
  55. 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
+ ]