Skip to main content
Glama

export_databricks_bundle

Export RLHF logs and proof artifacts as a Databricks-ready analytics bundle for persistent storage and retrieval across sessions.

Instructions

Export RLHF logs and proof artifacts as a Databricks-ready analytics bundle

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputPathNo

Implementation Reference

  • The implementation of exportDatabricksBundle, which generates a Databricks-ready analytics bundle by processing feedback and proof data.
    function exportDatabricksBundle(feedbackDir = getDefaultFeedbackDir(), outputPath, options = {}) {
      const resolvedFeedbackDir = path.resolve(feedbackDir || getDefaultFeedbackDir());
      const resolvedProofDir = path.resolve(options.proofDir || DEFAULT_PROOF_DIR);
      const exportedAt = new Date().toISOString();
      const bundlePath = path.resolve(outputPath || path.join(
        resolvedFeedbackDir,
        'analytics',
        `databricks-${timestampSlug()}`
      ));
      const tablesDir = path.join(bundlePath, 'tables');
      ensureDir(tablesDir);
    
      const datasets = [
        {
          tableName: 'feedback_events',
          sourcePath: path.join(resolvedFeedbackDir, 'feedback-log.jsonl'),
          description: 'Raw RLHF feedback events from feedback-log.jsonl',
        },
        {
          tableName: 'memory_records',
          sourcePath: path.join(resolvedFeedbackDir, 'memory-log.jsonl'),
          description: 'Promoted learning and mistake memories from memory-log.jsonl',
        },
        {
          tableName: 'feedback_sequences',
          sourcePath: path.join(resolvedFeedbackDir, 'feedback-sequences.jsonl'),
          description: 'Sequence-model training rows derived from accepted feedback',
        },
        {
          tableName: 'feedback_attributions',
          sourcePath: path.join(resolvedFeedbackDir, 'attributed-feedback.jsonl'),
          description: 'Tool-call attribution rows for negative feedback events',
        },
      ];
    
      const tables = datasets.map((dataset) => {
        const rows = annotateRows(
          readJSONL(dataset.sourcePath),
          dataset.tableName,
          path.basename(dataset.sourcePath),
          exportedAt,
        );
        const fileName = `${dataset.tableName}.jsonl`;
        const relativePath = toBundleRelativePath('tables', fileName);
        writeJSONL(path.join(tablesDir, fileName), rows);
        return {
          tableName: dataset.tableName,
          relativePath,
          rowCount: rows.length,
          description: dataset.description,
        };
      });
    
      const proofRows = collectProofReports(resolvedProofDir, exportedAt);
      const proofRelativePath = toBundleRelativePath('tables', 'proof_reports.jsonl');
      writeJSONL(path.join(tablesDir, 'proof_reports.jsonl'), proofRows);
      tables.push({
        tableName: 'proof_reports',
        relativePath: proofRelativePath,
        rowCount: proofRows.length,
        description: 'Machine-readable proof artifacts discovered under proof/**/*.json',
      });
    
      const manifest = {
        format: 'databricks-analytics-bundle',
        version: 1,
        exportedAt,
        bundlePath,
        feedbackDir: resolvedFeedbackDir,
        proofDir: resolvedProofDir,
        placeholders: {
          catalog: '__CATALOG__',
          schema: '__SCHEMA__',
          bundleRoot: '__BUNDLE_ROOT__',
        },
        tables,
      };
    
      const manifestPath = path.join(bundlePath, 'manifest.json');
      const sqlTemplatePath = path.join(bundlePath, 'load_databricks.sql');
      fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n');
      fs.writeFileSync(sqlTemplatePath, buildSqlTemplate(manifest) + '\n');
    
      return {
        bundlePath,
        manifestPath,
        sqlTemplatePath,
        tableCount: tables.length,
        totalRows: tables.reduce((sum, table) => sum + table.rowCount, 0),
        tables,
      };
    }
  • Tool handler registration for 'export_databricks_bundle' in the MCP server adapter.
    case 'export_databricks_bundle': {
      const outputPath = args.outputPath ? resolveSafePath(args.outputPath) : undefined;
      return toTextResult(exportDatabricksBundle(undefined, outputPath));
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IgorGanapolsky/mcp-memory-gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server