mirror of
https://github.com/FJurmanovic/sugarr.git
synced 2026-11-11 15:51:09 +00:00
Add SchemaLlmTool and TextLlmTool
This commit is contained in:
21
test/core/llm/TextLlmTool.test.ts
Normal file
21
test/core/llm/TextLlmTool.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { TextLlmTool } from '../../../src/core/llm/TextLlmTool';
|
||||
import type { RunContext } from '../../../src/core/llm/RunContext';
|
||||
|
||||
class EchoTool extends TextLlmTool<Record<string, never>> {
|
||||
protected readonly promptName = 'echo';
|
||||
protected buildVariables(): Record<string, unknown> {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
describe('TextLlmTool.parseOutput (via subclass)', () => {
|
||||
it('trims the raw LLM text and returns it as-is', () => {
|
||||
const tool = new EchoTool(
|
||||
{} as unknown as ConstructorParameters<typeof EchoTool>[0],
|
||||
{} as unknown as ConstructorParameters<typeof EchoTool>[1]
|
||||
) as unknown as { parseOutput(raw: string, ctx: RunContext): string };
|
||||
|
||||
expect(tool.parseOutput(' hello world \n', {} as RunContext)).toBe('hello world');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user