Skip to content

Commit 956b37b

Browse files
committed
categorization fix
1 parent 2a376a2 commit 956b37b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flat_ai/flat_ai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@ def classify(self, options: Dict[str, str], **kwargs) -> str:
137137
"""Get a key from provided options based on context"""
138138

139139
class Classification(BaseModel):
140-
choice: str = Field(
140+
category: str = Field(
141141
description="The selected classification key", enum=list(options.keys())
142142
)
143143

144144
def _execute():
145145
if not options:
146146
raise ValueError("Options dictionary cannot be empty")
147147

148-
result = self.generate_object(Classification, options=options)
149-
return result.choice
148+
result = self.generate_object(Classification, instructions='choose the category that best matches the context from the _category_options, make sure you take into account the options descriptions in the context.', _category_options=options, **kwargs)
149+
return result.category
150150

151151
return self._retry_on_error(_execute)
152152

0 commit comments

Comments
 (0)