Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added exception to track complete error #1662

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kairon/events/definitions/model_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ def execute(self, **kwargs):
nlu_result=nlu_results,
event_status=EVENT_STATUS.COMPLETED.value)
except Exception as e:
logger.error(str(e))
logger.exception(str(e))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify logger.exception Usage

When using logger.exception(), you don't need to pass str(e) as it automatically includes the exception information and stack trace. Consider updating the code as follows:

-    logger.exception(str(e))
+    logger.exception("An error occurred during model testing execution")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logger.exception(str(e))
logger.exception("An error occurred during model testing execution")

ModelTestingLogProcessor.log_test_result(self.bot, self.user, exception=str(e),
event_status=EVENT_STATUS.FAIL.value)
6 changes: 5 additions & 1 deletion kairon/nlu/classifiers/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
pass

@DefaultV1Recipe.register(
DefaultV1Recipe.ComponentType.INTENT_CLASSIFIER, is_trainable=True
[
DefaultV1Recipe.ComponentType.INTENT_CLASSIFIER,
DefaultV1Recipe.ComponentType.ENTITY_EXTRACTOR,
],
is_trainable=True
)
class LLMClassifier(IntentClassifier, GraphComponent, EntityExtractorMixin, ABC):
"""Intent and Entity classifiers using the OpenAI Completion framework"""
Expand Down
Loading