@elizaos/training 2.0.0-alpha.76 → 2.0.0-alpha.78

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 (89) hide show
  1. package/package.json +2 -2
  2. package/.turbo/turbo-lint.log +0 -3
  3. package/.turbo/turbo-typecheck.log +0 -1
  4. package/dist/.tsbuildinfo +0 -1
  5. package/dist/adapter.js +0 -59
  6. package/dist/archetypes/ArchetypeConfigService.js +0 -510
  7. package/dist/archetypes/derive-archetype.js +0 -196
  8. package/dist/archetypes/index.js +0 -7
  9. package/dist/benchmark/ArchetypeMatchupBenchmark.js +0 -547
  10. package/dist/benchmark/BenchmarkChartGenerator.js +0 -632
  11. package/dist/benchmark/BenchmarkDataGenerator.js +0 -825
  12. package/dist/benchmark/BenchmarkDataViewer.js +0 -197
  13. package/dist/benchmark/BenchmarkHistoryService.js +0 -135
  14. package/dist/benchmark/BenchmarkRunner.js +0 -483
  15. package/dist/benchmark/BenchmarkValidator.js +0 -158
  16. package/dist/benchmark/FastEvalRunner.js +0 -133
  17. package/dist/benchmark/MetricsValidator.js +0 -104
  18. package/dist/benchmark/MetricsVisualizer.js +0 -775
  19. package/dist/benchmark/ModelBenchmarkService.js +0 -433
  20. package/dist/benchmark/ModelRegistry.js +0 -122
  21. package/dist/benchmark/RulerBenchmarkIntegration.js +0 -168
  22. package/dist/benchmark/SimulationA2AInterface.js +0 -683
  23. package/dist/benchmark/SimulationEngine.js +0 -522
  24. package/dist/benchmark/TaskRunner.js +0 -60
  25. package/dist/benchmark/__tests__/BenchmarkRunner.test.js +0 -409
  26. package/dist/benchmark/__tests__/HeadToHead.test.js +0 -105
  27. package/dist/benchmark/index.js +0 -23
  28. package/dist/benchmark/parseSimulationMetrics.js +0 -86
  29. package/dist/benchmark/simulation-types.js +0 -1
  30. package/dist/dependencies.js +0 -197
  31. package/dist/generation/TrajectoryGenerator.js +0 -244
  32. package/dist/generation/index.js +0 -6
  33. package/dist/huggingface/HuggingFaceDatasetUploader.js +0 -463
  34. package/dist/huggingface/HuggingFaceIntegrationService.js +0 -272
  35. package/dist/huggingface/HuggingFaceModelUploader.js +0 -385
  36. package/dist/huggingface/index.js +0 -9
  37. package/dist/huggingface/shared/HuggingFaceUploadUtil.js +0 -144
  38. package/dist/index.js +0 -41
  39. package/dist/init-training.js +0 -43
  40. package/dist/metrics/TrajectoryMetricsExtractor.js +0 -523
  41. package/dist/metrics/__tests__/TrajectoryMetricsExtractor.test.js +0 -628
  42. package/dist/metrics/index.js +0 -7
  43. package/dist/metrics/types.js +0 -21
  44. package/dist/rubrics/__tests__/index.test.js +0 -150
  45. package/dist/rubrics/ass-kisser.js +0 -83
  46. package/dist/rubrics/degen.js +0 -78
  47. package/dist/rubrics/goody-twoshoes.js +0 -82
  48. package/dist/rubrics/index.js +0 -184
  49. package/dist/rubrics/information-trader.js +0 -82
  50. package/dist/rubrics/infosec.js +0 -99
  51. package/dist/rubrics/liar.js +0 -102
  52. package/dist/rubrics/perps-trader.js +0 -85
  53. package/dist/rubrics/researcher.js +0 -79
  54. package/dist/rubrics/scammer.js +0 -80
  55. package/dist/rubrics/social-butterfly.js +0 -71
  56. package/dist/rubrics/super-predictor.js +0 -95
  57. package/dist/rubrics/trader.js +0 -65
  58. package/dist/scoring/ArchetypeScoringService.js +0 -301
  59. package/dist/scoring/JudgePromptBuilder.js +0 -401
  60. package/dist/scoring/LLMJudgeCache.js +0 -263
  61. package/dist/scoring/index.js +0 -8
  62. package/dist/training/AutomationPipeline.js +0 -714
  63. package/dist/training/BenchmarkService.js +0 -370
  64. package/dist/training/ConfigValidator.js +0 -153
  65. package/dist/training/MarketOutcomesTracker.js +0 -142
  66. package/dist/training/ModelDeployer.js +0 -128
  67. package/dist/training/ModelFetcher.js +0 -48
  68. package/dist/training/ModelSelectionService.js +0 -248
  69. package/dist/training/ModelUsageVerifier.js +0 -106
  70. package/dist/training/MultiModelOrchestrator.js +0 -349
  71. package/dist/training/RLModelConfig.js +0 -295
  72. package/dist/training/RewardBackpropagationService.js +0 -117
  73. package/dist/training/RulerScoringService.js +0 -450
  74. package/dist/training/TrainingMonitor.js +0 -108
  75. package/dist/training/TrajectoryRecorder.js +0 -281
  76. package/dist/training/__tests__/TrajectoryRecorder.test.js +0 -363
  77. package/dist/training/index.js +0 -30
  78. package/dist/training/logRLConfig.js +0 -29
  79. package/dist/training/pipeline.js +0 -80
  80. package/dist/training/storage/ModelStorageService.js +0 -190
  81. package/dist/training/storage/TrainingDataArchiver.js +0 -136
  82. package/dist/training/storage/index.js +0 -7
  83. package/dist/training/types.js +0 -6
  84. package/dist/training/window-utils.js +0 -100
  85. package/dist/utils/index.js +0 -73
  86. package/dist/utils/logger.js +0 -55
  87. package/dist/utils/snowflake.js +0 -15
  88. package/dist/utils/synthetic-detector.js +0 -67
  89. package/vitest.config.ts +0 -8
@@ -1,144 +0,0 @@
1
- /**
2
- * HuggingFace Upload Utility
3
- *
4
- * Shared utility for uploading files to HuggingFace Hub.
5
- * Consolidates upload logic used across different services.
6
- */
7
- import { exec } from "node:child_process";
8
- import { promises as fs } from "node:fs";
9
- import * as path from "node:path";
10
- import { promisify } from "node:util";
11
- import * as hubModule from "@huggingface/hub";
12
- import { logger } from "../../utils/logger";
13
- /**
14
- * Get HuggingFace token from environment variables
15
- *
16
- * Checks both HUGGING_FACE_TOKEN and HF_TOKEN for compatibility
17
- * with different HuggingFace tooling conventions.
18
- *
19
- * @returns Token string or undefined if not set
20
- */
21
- export function getHuggingFaceToken() {
22
- return process.env.HUGGING_FACE_TOKEN || process.env.HF_TOKEN;
23
- }
24
- /**
25
- * Get HuggingFace token or throw error if not set
26
- *
27
- * @throws Error if token is not configured
28
- * @returns Token string
29
- */
30
- export function requireHuggingFaceToken() {
31
- const token = getHuggingFaceToken();
32
- if (!token) {
33
- throw new Error("HuggingFace token not configured. Set HUGGING_FACE_TOKEN or HF_TOKEN environment variable.");
34
- }
35
- return token;
36
- }
37
- /**
38
- * Upload a single file to HuggingFace Hub
39
- */
40
- export async function uploadFileToHub(repoName, repoType, filePath, fileContent, token) {
41
- const uploadFile = hubModule.uploadFile;
42
- await uploadFile({
43
- repo: { type: repoType, name: repoName },
44
- file: {
45
- path: filePath,
46
- content: new Blob([fileContent]),
47
- },
48
- credentials: {
49
- accessToken: token,
50
- },
51
- });
52
- logger.info(`Uploaded ${filePath} to ${repoName}`, {
53
- repo: repoName,
54
- type: repoType,
55
- });
56
- }
57
- /**
58
- * Upload directory to HuggingFace Hub
59
- */
60
- export async function uploadDirectoryToHub(repoName, repoType, localDir, token) {
61
- const files = await fs.readdir(localDir);
62
- let uploadCount = 0;
63
- for (const file of files) {
64
- const filePath = path.join(localDir, file);
65
- const stats = await fs.stat(filePath);
66
- if (stats.isFile()) {
67
- const content = await fs.readFile(filePath, "utf-8");
68
- await uploadFileToHub(repoName, repoType, file, content, token);
69
- uploadCount++;
70
- }
71
- }
72
- logger.info(`Uploaded ${uploadCount} files to ${repoName}`, {
73
- repo: repoName,
74
- count: uploadCount,
75
- });
76
- return uploadCount;
77
- }
78
- /**
79
- * Ensure repository exists (create if needed)
80
- */
81
- export async function ensureHubRepository(repoName, repoType, token, isPrivate = false) {
82
- const createRepo = hubModule.createRepo;
83
- try {
84
- await createRepo({
85
- repo: { type: repoType, name: repoName },
86
- credentials: { accessToken: token },
87
- private: isPrivate,
88
- });
89
- logger.info("Created new repository", { repo: repoName, type: repoType });
90
- }
91
- catch (error) {
92
- // Repository might already exist, which is fine
93
- if (error instanceof Error &&
94
- (error.message.includes("already exists") ||
95
- error.message.includes("Repository not found"))) {
96
- logger.info("Repository already exists or accessible", {
97
- repo: repoName,
98
- });
99
- }
100
- else {
101
- logger.warn("Could not ensure repository exists", {
102
- error,
103
- repo: repoName,
104
- });
105
- }
106
- }
107
- }
108
- /**
109
- * Upload using huggingface-cli (fallback method)
110
- */
111
- export async function uploadViaCLI(repoName, repoType, localDir, token) {
112
- try {
113
- const execAsync = promisify(exec);
114
- // Set token as environment variable
115
- process.env.HUGGINGFACE_HUB_TOKEN = token;
116
- console.log(`Uploading ${localDir} to ${repoName} via huggingface-cli...`);
117
- await execAsync(`huggingface-cli upload ${repoName} ${localDir} --repo-type ${repoType}`);
118
- logger.info("Successfully uploaded via huggingface-cli", {
119
- repo: repoName,
120
- });
121
- }
122
- catch (error) {
123
- logger.error("CLI upload failed", { error });
124
- throw error;
125
- }
126
- }
127
- /**
128
- * Provide manual upload instructions
129
- */
130
- export function getManualUploadInstructions(repoName, repoType, localDir) {
131
- return [
132
- "1. Install huggingface-cli: pip install huggingface_hub",
133
- "2. Login: huggingface-cli login",
134
- `3. Upload: huggingface-cli upload ${repoName} ${localDir} --repo-type ${repoType}`,
135
- ];
136
- }
137
- /** @deprecated Use uploadFileToHub, uploadDirectoryToHub, etc. instead */
138
- export const HuggingFaceUploadUtil = {
139
- uploadFile: uploadFileToHub,
140
- uploadDirectory: uploadDirectoryToHub,
141
- ensureRepository: ensureHubRepository,
142
- uploadViaCLI,
143
- getManualUploadInstructions,
144
- };
package/dist/index.js DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * ElizaOS Training Package
3
- *
4
- * A reusable RL training pipeline for agent trajectories including:
5
- * - Benchmarking and evaluation
6
- * - Automated training orchestration
7
- * - HuggingFace publishing helpers
8
- * - Archetype-aware scoring utilities
9
- *
10
- * ## Setup
11
- *
12
- * Before using training operations, register a data adapter:
13
- *
14
- * ```ts
15
- * import { setTrainingDataAdapter } from '@elizaos/training';
16
- * setTrainingDataAdapter(myDrizzleAdapter);
17
- * ```
18
- *
19
- * @packageDocumentation
20
- */
21
- // Data adapter (must be registered before DB-dependent operations)
22
- export { getLlmLogAdapter, getMarketDataAdapter, getTrainingDataAdapter, isDataAdapterRegistered, resetAdapters, setLlmLogAdapter, setMarketDataAdapter, setTrainingDataAdapter, } from "./adapter";
23
- // Archetypes
24
- export * from "./archetypes";
25
- // Re-export all sub-modules
26
- export * from "./benchmark";
27
- // Dependencies configuration
28
- export { areAgentDependenciesConfigured, areDependenciesConfigured, configureTrainingDependencies, getAgentRuntimeManager, getAgentService, getAutonomousCoordinator, getExportGroupedForGRPO, getExportToHuggingFace, getLLMCaller, getToTrainingMessages, } from "./dependencies";
29
- // Generation
30
- export * from "./generation";
31
- export * from "./huggingface";
32
- // Training initialization
33
- export { initializeTrainingPackage, isTrainingInitialized, resetTrainingInitialization, } from "./init-training";
34
- // Metrics (re-export for backwards compatibility, prefer import from './metrics')
35
- export * from "./metrics";
36
- export * from "./rubrics";
37
- export * from "./scoring";
38
- export * from "./training";
39
- export { benchmarkAndMaybeDeployModel, checkTrainingReadiness, deployModelVersion, getAutomationPipelineStatus, getNextTrainingModelSelection, monitorTrainingJob, rollbackModelVersion, triggerTraining, } from "./training/pipeline";
40
- // Utilities
41
- export * from "./utils";
@@ -1,43 +0,0 @@
1
- /**
2
- * Training Package Initialization
3
- *
4
- * This module sets up all dependencies required by the training package.
5
- * Import this before using TrajectoryGenerator or other training services.
6
- *
7
- * Usage:
8
- * import { configureTrainingDependencies, initializeTrainingPackage } from '@elizaos/training';
9
- * configureTrainingDependencies({ ... });
10
- * await initializeTrainingPackage();
11
- */
12
- import { areDependenciesConfigured } from "./dependencies";
13
- import { logger } from "./utils/logger";
14
- let initialized = false;
15
- /**
16
- * Initialize training package.
17
- *
18
- * External dependencies must be configured first via `configureTrainingDependencies`.
19
- */
20
- export async function initializeTrainingPackage() {
21
- if (initialized) {
22
- logger.debug("Training package already initialized", {}, "TrainingInit");
23
- return;
24
- }
25
- logger.info("Initializing training package...", {}, "TrainingInit");
26
- if (!areDependenciesConfigured()) {
27
- throw new Error("Training dependencies not configured. Call configureTrainingDependencies() first.");
28
- }
29
- initialized = true;
30
- logger.info("Training package initialized successfully", {}, "TrainingInit");
31
- }
32
- /**
33
- * Check if training package is initialized
34
- */
35
- export function isTrainingInitialized() {
36
- return initialized;
37
- }
38
- /**
39
- * Reset initialization state (for testing)
40
- */
41
- export function resetTrainingInitialization() {
42
- initialized = false;
43
- }