11import { IBaseMessage } from "../contract/BaseMessage.contract" ;
22import { IBaseCompletionArgs } from "../contract/BaseCompletion.contract" ;
33import { addCompletion } from "../functions/setup/addCompletion" ;
4- import { ISwarmCompletionArgs } from "../contract/SwarmCompletion.contract" ;
54import { ISwarmMessage } from "../contract/SwarmMessage.contract" ;
65import { IOutlineCompletionArgs } from "../contract/OutlineCompletion.contract" ;
6+ import { ISwarmCompletionArgs } from "src/contract/SwarmCompletion.contract" ;
77
88/**
99 * Interface representing a completion mechanism.
@@ -29,8 +29,12 @@ export interface ICompletionCallbacks<Message extends IBaseMessage<any> = IBaseM
2929 * Interface representing the schema for configuring a completion mechanism.
3030 * Defines how completions are generated within the swarm.
3131 * @template Message - The type of message, extending IBaseMessage with any role type. Defaults to IBaseMessage for maximum flexibility.
32+ * @template Args - The type of completion arguments, defaults to any completion args type.
3233*/
33- export interface ICompletionSchema < Message extends IBaseMessage < string > = IBaseMessage < any > > {
34+ export interface ICompletionSchema <
35+ Message extends IBaseMessage < string > = IBaseMessage < any > ,
36+ Args extends IBaseCompletionArgs < IBaseMessage < string > > = IBaseCompletionArgs < IBaseMessage < string > >
37+ > {
3438 /** The unique name of the completion mechanism within the swarm.*/
3539 completionName : CompletionName ;
3640
@@ -39,12 +43,7 @@ export interface ICompletionSchema<Message extends IBaseMessage<string> = IBaseM
3943 * Generates a model response using the given context and tools.
4044 * @throws {Error } If completion generation fails (e.g., due to invalid arguments, model errors, or tool issues).
4145 */
42- getCompletion (
43- args :
44- | IBaseCompletionArgs < IBaseMessage < string > >
45- | IOutlineCompletionArgs < IBaseMessage < string > >
46- | ISwarmCompletionArgs < IBaseMessage < string > >
47- ) : Promise < Message > ;
46+ getCompletion ( args : Args ) : Promise < Message > ;
4847
4948 /*
5049 * Flag if the completion is a JSON completion.
@@ -65,3 +64,12 @@ export interface ICompletionSchema<Message extends IBaseMessage<string> = IBaseM
6564 * Used to identify and reference specific completion implementations.
6665*/
6766export type CompletionName = string ;
67+
68+
69+ addCompletion ( {
70+ completionName : "test" ,
71+ getCompletion : async ( params : ISwarmCompletionArgs ) : Promise < ISwarmMessage > => {
72+ params . messages [ 0 ] . role === "assistant"
73+ return null as never ;
74+ }
75+ } )
0 commit comments