Skip to content

Commit bdccee3

Browse files
committed
feat: add ajv as a dependency and enhance CompletionAdapter with tools support
1 parent 376b904 commit bdccee3

3 files changed

Lines changed: 40 additions & 19 deletions

File tree

adminforth/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"@inquirer/prompts": "^7.4.1",
7474
"@qdrant/js-client-rest": "^1.17.0",
7575
"@types/express": "^4.17.21",
76+
"ajv": "^8.18.0",
7677
"arg": "^5.0.2",
7778
"ast-types": "^0.14.2",
7879
"better-sqlite3": "^11.10.0",

adminforth/pnpm-lock.yaml

Lines changed: 29 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adminforth/types/adapters/CompletionAdapter.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
import type { JSONSchemaType } from "ajv";
2+
13
export type CompletionStreamEvent = {
24
type: "output" | "reasoning";
35
delta: string;
46
text: string;
57
source?: "summary" | "text";
68
};
9+
10+
export type CompletionTool<Input = Record<string, any>, Output = any> = {
11+
name: string;
12+
input_schema: JSONSchemaType<Input>;
13+
description?: string;
14+
handler: (input: Input) => Promise<Output> | Output;
15+
};
716
export interface CompletionAdapter {
817

918
/**
@@ -26,6 +35,7 @@ export interface CompletionAdapter {
2635
maxTokens: number,
2736
outputSchema?: any,
2837
reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh',
38+
tools?: CompletionTool[],
2939
onChunk?: (
3040
chunk: string,
3141
event?: CompletionStreamEvent,

0 commit comments

Comments
 (0)