Skip to content

Commit 05f265e

Browse files
authored
Merge pull request #56 from thedadams/fw-compat
fix: make constructors forward-compatible
2 parents ac6b6a5 + 48bb1ab commit 05f265e

File tree

6 files changed

+21
-0
lines changed

6 files changed

+21
-0
lines changed

gptscript/confirm.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ def __init__(self,
33
id: str = "",
44
accept: bool = "",
55
message: str = "",
6+
**kwargs,
67
):
78
self.id = id
89
self.accept = accept

gptscript/credentials.py

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self,
2222
ephemeral: bool = False,
2323
expiresAt: datetime = None,
2424
refreshToken: str = "",
25+
**kwargs,
2526
):
2627
self.context = context
2728
self.toolName = toolName
@@ -62,6 +63,7 @@ def to_json(self):
6263

6364
return json.dumps(req)
6465

66+
6567
class CredentialRequest:
6668
def __init__(self,
6769
content: str = "",
@@ -77,6 +79,7 @@ def __init__(self,
7779
self.contexts = contexts
7880
self.name = name
7981

82+
8083
def to_credential(c) -> Credential:
8184
expiresAt = c["expiresAt"]
8285
if expiresAt is not None:

gptscript/frame.py

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self,
4343
name: str = "",
4444
entryToolId: str = "",
4545
toolSet: dict[str, Tool] = None,
46+
**kwargs,
4647
):
4748
self.name = name
4849
self.entryToolId = entryToolId
@@ -67,6 +68,7 @@ def __init__(self,
6768
end: str = "",
6869
state: RunState = RunState.Creating,
6970
chatState: str = "",
71+
**kwargs,
7072
):
7173
self.id = id
7274
self.type = type
@@ -88,6 +90,7 @@ class Call:
8890
def __init__(self,
8991
toolID: str = "",
9092
input: str = "",
93+
**kwargs,
9194
):
9295
self.toolID = toolID
9396
self.input = input
@@ -97,6 +100,7 @@ class Output:
97100
def __init__(self,
98101
content: str = "",
99102
subCalls: dict[str, Call] = None,
103+
**kwargs,
100104
):
101105
self.content = content
102106
self.subCalls = subCalls
@@ -106,6 +110,7 @@ class InputContext:
106110
def __init__(self,
107111
toolID: str = "",
108112
content: str = "",
113+
**kwargs,
109114
):
110115
self.toolID = toolID
111116
self.content = content
@@ -116,6 +121,7 @@ def __init__(self,
116121
promptTokens: int = 0,
117122
completionTokens: int = 0,
118123
totalTokens: int = 0,
124+
**kwargs,
119125
):
120126
self.promptTokens = promptTokens
121127
self.completionTokens = completionTokens
@@ -144,6 +150,7 @@ def __init__(self,
144150
toolResults: int = 0,
145151
llmRequest: Any = None,
146152
llmResponse: Any = None,
153+
**kwargs,
147154
):
148155
self.id = id
149156
self.tool = tool
@@ -196,6 +203,7 @@ def __init__(self,
196203
fields: list[str] = None,
197204
metadata: dict[str, str] = None,
198205
sensitive: bool = False,
206+
**kwargs,
199207
):
200208
self.id = id
201209
self.time = time

gptscript/prompt.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ class PromptResponse:
22
def __init__(self,
33
id: str = "",
44
responses: dict[str, str] = None,
5+
**kwargs,
56
):
67
self.id = id
78
self.responses = responses

gptscript/text.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class Text:
55
def __init__(self,
66
fmt: str = "",
77
text: str = "",
8+
**kwargs,
89
):
910
if fmt == "" and text.startswith("!"):
1011
fmt = text[1:text.index("\n")]

gptscript/tool.py

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ def __init__(self,
66
type: str = "string",
77
description: str = "",
88
default: str = "",
9+
**kwargs,
910
):
1011
self.type = type
1112
self.description = description
@@ -20,6 +21,7 @@ def __init__(self,
2021
type: str = "object",
2122
properties: dict[str, Property] = None,
2223
required: list[str] = None,
24+
**kwargs,
2325
):
2426
self.type = type
2527
self.properties = properties
@@ -66,6 +68,7 @@ def __init__(self,
6668
instructions: str = "",
6769
type: str = "",
6870
metaData: dict[str, str] = None,
71+
**kwargs,
6972
):
7073
self.name = name
7174
self.description = description
@@ -111,6 +114,7 @@ def __init__(self,
111114
reference: str = "",
112115
arg: str = "",
113116
toolID: str = "",
117+
**kwargs,
114118
):
115119
self.named = named
116120
self.reference = reference
@@ -128,6 +132,7 @@ def __init__(self,
128132
Path: str = "",
129133
Name: str = "",
130134
Revision: str = "",
135+
**kwargs,
131136
):
132137
self.VCS = VCS
133138
self.Root = Root
@@ -141,6 +146,7 @@ def __init__(self,
141146
location: str = "",
142147
lineNo: int = 0,
143148
repo: Repo = None,
149+
**kwargs,
144150
):
145151
self.location = location
146152
self.lineNo = lineNo
@@ -186,6 +192,7 @@ def __init__(self,
186192
localTools: dict[str, str] = None,
187193
source: SourceRef = None,
188194
workingDir: str = "",
195+
**kwargs,
189196
):
190197
super().__init__(name, description, maxTokens, modelName, modelProvider, jsonResponse, temperature, cache, chat,
191198
internalPrompt, arguments, tools, globalTools, globalModelName, context, exportContext, export,

0 commit comments

Comments
 (0)