@wavequery/conductor
Version:
Modular LLM orchestration framework
43 lines • 1.37 kB
JavaScript
import { Chain } from "../chain";
describe("Chain", () => {
let mockTool;
let mockLLM;
let chain;
beforeEach(() => {
mockTool = {
name: "test-tool",
description: "Test tool",
execute: jest.fn(),
};
mockLLM = {
complete: jest.fn(),
completeWithFunctions: jest.fn(),
};
const config = {
name: "test-chain",
llmProvider: mockLLM,
tools: [mockTool],
steps: [
{
name: "step1",
tool: "test-tool",
input: { test: true },
},
{
name: "step2",
prompt: "Process {input}",
},
],
};
chain = new Chain(config);
});
it("should execute chain steps in order", async () => {
mockTool.execute.mockResolvedValueOnce({ result: "step1" });
mockLLM.complete.mockResolvedValueOnce({ content: "step2 result" });
const result = await chain.execute({ initial: "input" });
expect(result.steps).toHaveLength(2);
expect(result.steps[0].output).toEqual({ result: "step1" });
expect(result.steps[1].output.content).toEqual("step2 result");
});
});
//# sourceMappingURL=chain.test.js.map