fusionkit-core 0.1.1__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.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.3
2
+ Name: fusionkit-core
3
+ Version: 0.1.1
4
+ Summary: Core local model fusion primitives.
5
+ Requires-Dist: anthropic>=0.40.0
6
+ Requires-Dist: google-genai>=1.0.0
7
+ Requires-Dist: openai>=2.13.0
8
+ Requires-Dist: pydantic>=2.12.5
9
+ Requires-Dist: pyyaml>=6.0.3
10
+ Requires-Python: >=3.11
@@ -0,0 +1,16 @@
1
+ [project]
2
+ name = "fusionkit-core"
3
+ version = "0.1.1"
4
+ description = "Core local model fusion primitives."
5
+ requires-python = ">=3.11"
6
+ dependencies = [
7
+ "anthropic>=0.40.0",
8
+ "google-genai>=1.0.0",
9
+ "openai>=2.13.0",
10
+ "pydantic>=2.12.5",
11
+ "pyyaml>=6.0.3",
12
+ ]
13
+
14
+ [build-system]
15
+ requires = ["uv_build>=0.11.21,<0.12.0"]
16
+ build-backend = "uv_build"
@@ -0,0 +1,181 @@
1
+ from fusionkit_core.artifacts import LocalArtifactStore, hash_bytes, hash_text
2
+ from fusionkit_core.clients import (
3
+ AnthropicModelClient,
4
+ FakeModelClient,
5
+ GoogleModelClient,
6
+ LocalModelClient,
7
+ OpenAICompatibleClient,
8
+ build_client,
9
+ build_clients,
10
+ )
11
+ from fusionkit_core.config import (
12
+ CostMetadata,
13
+ EndpointCapabilities,
14
+ FusionConfig,
15
+ FusionMode,
16
+ ModelEndpoint,
17
+ ProviderKind,
18
+ RunBudget,
19
+ SamplingConfig,
20
+ )
21
+ from fusionkit_core.contracts import (
22
+ ArtifactRefV1,
23
+ BenchmarkTaskRecordV1,
24
+ ContractMetadata,
25
+ ContractRecord,
26
+ EnsembleReceiptV1,
27
+ FusionRecordV1,
28
+ FusionRunRequestV1,
29
+ FusionRunState,
30
+ HarnessCandidateRecordV1,
31
+ HarnessRunResultV1,
32
+ HarnessTrajectoryV1,
33
+ JudgeSynthesisRecordV1,
34
+ ModelCallRecordV1,
35
+ ModelEndpointV1,
36
+ ToolCallPlanV1,
37
+ ToolExecutionRecordV1,
38
+ contract_metadata,
39
+ contract_model_for_schema,
40
+ producer,
41
+ producer_git_sha,
42
+ producer_version,
43
+ schema_bundle_hash,
44
+ status_for_run_state,
45
+ )
46
+ from fusionkit_core.fusion import FusionEngine
47
+ from fusionkit_core.judge import CandidateEvidence, JudgeSynthesisResult, JudgeSynthesizer
48
+ from fusionkit_core.providers import (
49
+ endpoint_to_contract,
50
+ estimate_cost,
51
+ normalize_usage,
52
+ provider_metadata,
53
+ resolve_api_key,
54
+ )
55
+ from fusionkit_core.router import HeuristicRouter
56
+ from fusionkit_core.run import (
57
+ CandidateInspection,
58
+ CreateRunResult,
59
+ FusionRunEvent,
60
+ FusionRunManager,
61
+ IdempotencyRecord,
62
+ NativeRunError,
63
+ RunEventPage,
64
+ RunInspection,
65
+ RunStateSummary,
66
+ ToolExecutionMode,
67
+ ToolExecutionPolicy,
68
+ ToolPausePlaceholder,
69
+ ToolResultSubmission,
70
+ canonical_json,
71
+ hash_json,
72
+ make_id,
73
+ )
74
+ from fusionkit_core.run_store import FileSystemRunStore
75
+ from fusionkit_core.trace import (
76
+ TRACE_CANDIDATE_HEADER,
77
+ TRACE_ID_HEADER,
78
+ TRACE_PARENT_SPAN_HEADER,
79
+ TRACE_SPAN_HEADER,
80
+ TraceEmitter,
81
+ ambient_trace_id,
82
+ emit,
83
+ get_emitter,
84
+ new_span_id,
85
+ new_trace_id,
86
+ )
87
+ from fusionkit_core.types import (
88
+ Candidate,
89
+ ChatMessage,
90
+ ModelResponse,
91
+ StreamChunk,
92
+ ToolCall,
93
+ Usage,
94
+ )
95
+
96
+ __all__ = [
97
+ "AnthropicModelClient",
98
+ "ArtifactRefV1",
99
+ "BenchmarkTaskRecordV1",
100
+ "Candidate",
101
+ "CandidateEvidence",
102
+ "CandidateInspection",
103
+ "ChatMessage",
104
+ "ContractMetadata",
105
+ "ContractRecord",
106
+ "CostMetadata",
107
+ "CreateRunResult",
108
+ "EndpointCapabilities",
109
+ "EnsembleReceiptV1",
110
+ "FakeModelClient",
111
+ "FileSystemRunStore",
112
+ "FusionConfig",
113
+ "FusionEngine",
114
+ "FusionMode",
115
+ "FusionRunEvent",
116
+ "FusionRunManager",
117
+ "FusionRecordV1",
118
+ "FusionRunRequestV1",
119
+ "FusionRunState",
120
+ "GoogleModelClient",
121
+ "HarnessCandidateRecordV1",
122
+ "HarnessTrajectoryV1",
123
+ "HarnessRunResultV1",
124
+ "HeuristicRouter",
125
+ "IdempotencyRecord",
126
+ "JudgeSynthesisRecordV1",
127
+ "JudgeSynthesizer",
128
+ "JudgeSynthesisResult",
129
+ "LocalArtifactStore",
130
+ "LocalModelClient",
131
+ "ModelCallRecordV1",
132
+ "ModelEndpoint",
133
+ "ModelEndpointV1",
134
+ "ModelResponse",
135
+ "NativeRunError",
136
+ "OpenAICompatibleClient",
137
+ "ProviderKind",
138
+ "RunEventPage",
139
+ "RunInspection",
140
+ "RunBudget",
141
+ "RunStateSummary",
142
+ "SamplingConfig",
143
+ "StreamChunk",
144
+ "TRACE_CANDIDATE_HEADER",
145
+ "TRACE_ID_HEADER",
146
+ "TRACE_PARENT_SPAN_HEADER",
147
+ "TRACE_SPAN_HEADER",
148
+ "TraceEmitter",
149
+ "ToolCall",
150
+ "ToolExecutionMode",
151
+ "ToolExecutionPolicy",
152
+ "ToolPausePlaceholder",
153
+ "ToolResultSubmission",
154
+ "ToolCallPlanV1",
155
+ "ToolExecutionRecordV1",
156
+ "Usage",
157
+ "ambient_trace_id",
158
+ "build_client",
159
+ "build_clients",
160
+ "canonical_json",
161
+ "contract_metadata",
162
+ "contract_model_for_schema",
163
+ "emit",
164
+ "endpoint_to_contract",
165
+ "estimate_cost",
166
+ "get_emitter",
167
+ "hash_bytes",
168
+ "hash_json",
169
+ "hash_text",
170
+ "make_id",
171
+ "new_span_id",
172
+ "new_trace_id",
173
+ "normalize_usage",
174
+ "producer",
175
+ "producer_git_sha",
176
+ "producer_version",
177
+ "provider_metadata",
178
+ "resolve_api_key",
179
+ "schema_bundle_hash",
180
+ "status_for_run_state",
181
+ ]
@@ -0,0 +1,48 @@
1
+ from __future__ import annotations
2
+
3
+ import hashlib
4
+ from pathlib import Path
5
+
6
+ from fusionkit_core.contracts import ArtifactKind, ContractArtifactRef
7
+
8
+
9
+ def hash_bytes(content: bytes) -> str:
10
+ return "sha256:" + hashlib.sha256(content).hexdigest()
11
+
12
+
13
+ def hash_text(content: str) -> str:
14
+ return hash_bytes(content.encode("utf-8"))
15
+
16
+
17
+ class LocalArtifactStore:
18
+ def __init__(self, root: str | Path) -> None:
19
+ self.root = Path(root)
20
+ self.root.mkdir(parents=True, exist_ok=True)
21
+
22
+ def write_text(
23
+ self,
24
+ run_id: str,
25
+ artifact_id: str,
26
+ kind: ArtifactKind,
27
+ content: str,
28
+ *,
29
+ suffix: str = ".txt",
30
+ ) -> ContractArtifactRef:
31
+ artifact_dir = self.root / run_id / "artifacts"
32
+ artifact_dir.mkdir(parents=True, exist_ok=True)
33
+ path = artifact_dir / f"{artifact_id}{suffix}"
34
+ path.write_text(content, encoding="utf-8")
35
+ return ContractArtifactRef(
36
+ artifact_id=artifact_id,
37
+ kind=kind,
38
+ uri=str(path),
39
+ hash=hash_text(content),
40
+ redaction_status="synthetic",
41
+ )
42
+
43
+
44
+ __all__ = [
45
+ "LocalArtifactStore",
46
+ "hash_bytes",
47
+ "hash_text",
48
+ ]