/** * DSPy Adapter * * Integrates Stanford DSPy modules and programs with the SwarmOrchestrator. * DSPy is a framework for algorithmically optimising LM prompts and weights, * enabling systematic prompt engineering and agent compilation. * * Usage: * const adapter = new DSPyAdapter(); * adapter.registerModule("classifier", myDSPyModule); * adapter.registerProgram("rag-pipeline", myCompiledProgram); * await registry.addAdapter(adapter); * * Then in the orchestrator: * delegateTask({ targetAgent: "dspy:classifier", ... }) * * @module DSPyAdapter * @version 1.0.0 */ import { BaseAdapter } from './base-adapter'; import type { AdapterCapabilities, AgentPayload, AgentContext, AgentResult } from '../types/agent-adapter'; /** Matches DSPy Module (ChainOfThought, Predict, ReAct, etc.) */ export interface DSPyModule { /** Forward pass / inference */ forward(inputs: Record): Promise; /** Alternative call interface */ __call__?(inputs: Record): Promise; } /** Matches a compiled DSPy program */ export interface DSPyProgram { /** Run the compiled program */ run(inputs: Record): Promise; /** Compile / optimise (optional) */ compile?(trainset?: unknown[], options?: Record): Promise; } /** DSPy prediction result */ export interface DSPyPrediction { /** Named output fields */ [key: string]: unknown; /** Common output: answer, response, output */ answer?: string; rationale?: string; response?: string; /** Completion metadata */ completions?: Record; } /** A simple function-based predictor (for lightweight usage) */ export type DSPyPredictor = (inputs: Record) => Promise; export declare class DSPyAdapter extends BaseAdapter { readonly name = "dspy"; readonly version = "1.0.0"; private entries; get capabilities(): AdapterCapabilities; registerModule(agentId: string, module: DSPyModule, metadata?: { description?: string; capabilities?: string[]; }): void; registerProgram(agentId: string, program: DSPyProgram, metadata?: { description?: string; capabilities?: string[]; }): void; registerPredictor(agentId: string, predictor: DSPyPredictor, metadata?: { description?: string; capabilities?: string[]; }): void; executeAgent(agentId: string, payload: AgentPayload, context: AgentContext): Promise; private buildInputs; private normalizePrediction; } //# sourceMappingURL=dspy-adapter.d.ts.map