You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseException(f"The guidance function `{self.f.__name__}` did not return a model object! You need to return an updated model object at the end of your guidance function.")
66
-
ifisinstance(other, StatelessFunction):
66
+
ifisinstance(other, GrammarFunction):
67
67
returnmodel+other
68
68
else:
69
69
returnother(model)
70
-
returnStatefulFunction(__add__, [], {})
70
+
returnRawFunction(__add__, [], {})
71
71
72
72
def__radd__(self, other):
73
73
@@ -76,14 +76,14 @@ def __radd__(self, other):
76
76
returnother+str(self)
77
77
78
78
def__radd__(model):
79
-
ifisinstance(other, StatelessFunction):
79
+
ifisinstance(other, GrammarFunction):
80
80
model+=other
81
81
else:
82
82
model=other(model)
83
83
returnself(model)
84
-
returnStatefulFunction(__radd__, [], {})
84
+
returnRawFunction(__radd__, [], {})
85
85
86
-
classStatelessFunction(Function):
86
+
classGrammarFunction(Function):
87
87
num_used_names=0
88
88
89
89
def__add__(self, value):
@@ -96,7 +96,7 @@ def __add__(self, value):
96
96
value=string(value)
97
97
98
98
# see if we can keep building a stateless grammar
99
-
ifisinstance(value, StatelessFunction):
99
+
ifisinstance(value, GrammarFunction):
100
100
returnJoin([self, value])
101
101
102
102
# otherwise we let the stateful object handle things
@@ -113,19 +113,19 @@ def __radd__(self, value):
113
113
value=string(value)
114
114
115
115
# see if we can keep building a stateless grammar
116
-
ifisinstance(value, StatelessFunction):
116
+
ifisinstance(value, GrammarFunction):
117
117
returnJoin([value, self])
118
118
119
119
# otherwise we let the stateful object handle things
# TODO: also the full probabilites distribution over all items. We can implement this using the prob of the selected item by repeating the call, removing the selected item each time
682
682
ifnotskip_checks:
683
683
fori, valueinenumerate(options):
684
-
assertnotisinstance(value, StatefulFunction), "You cannot select between stateful functions in the current guidance implementation!"
684
+
assertnotisinstance(value, RawFunction), "You cannot select between stateful functions in the current guidance implementation!"
685
685
assertnotisinstance(value, types.FunctionType), "Did you pass a function without calling it to select? You need to pass the results of a called guidance function to select."
0 commit comments