-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathChatGPT.Functions.External.pas
59 lines (46 loc) · 1.22 KB
/
ChatGPT.Functions.External.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
unit ChatGPT.Functions.external;
interface
uses
System.Classes, OpenAI.Chat.Functions, ChatGPT.Functions.external.Intf;
type
TChatFunctionExternal = class(TChatFunction, IChatFunction)
private
FFuncRef: IChatFunctionExternal;
protected
function GetDescription: string; override;
function GetName: string; override;
function GetParameters: string; override;
public
constructor Create(const Func: IChatFunctionExternal); reintroduce;
destructor Destroy; override;
function Execute(const Args: string): string; override;
end;
implementation
{ TChatFunctionExternal }
constructor TChatFunctionExternal.Create(const Func: IChatFunctionExternal);
begin
inherited Create;
FFuncRef := Func;
end;
destructor TChatFunctionExternal.Destroy;
begin
FFuncRef := nil;
inherited;
end;
function TChatFunctionExternal.Execute(const Args: string): string;
begin
Result := FFuncRef.Execute(Args);
end;
function TChatFunctionExternal.GetDescription: string;
begin
Result := FFuncRef.GetDescription;
end;
function TChatFunctionExternal.GetName: string;
begin
Result := FFuncRef.GetName;
end;
function TChatFunctionExternal.GetParameters: string;
begin
Result := FFuncRef.GetParameters;
end;
end.