Skip to content

Fix: Replace AIML with Gen-AI chatbot integration #49

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Avijain15
Copy link

Summary

Refactors the chatbot in Speak Activity to use Gen-AI for more natural conversations.

Motivation

The AIML-based chatbot was limited. Gen-AI enables dynamic, context-aware responses and improves user experience.

Key Changes

  • Removed AIML kernel and integrated OpenAI GPT-3.5-turbo API
  • Added new ai_services.py for modular Gen-AI logic
  • Updated requirements and documentation
  • Improved error handling for API connectivity

How to Test

  1. Set OPENAI_API_KEY in your environment.
  2. Launch Speak Activity and interact with the chatbot.
  3. Check for graceful error messages if the API key is missing or invalid.

Feedback Requested

  • Are there edge cases in the chatbot flow I might have missed?
  • Suggestions for improving error handling or user messaging?

Thanks for taking the time to review this PR!

# License along with HablarConSara.activity. If not, see
# <http://www.gnu.org/licenses/>.

import time
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason in changing the license agreement statements at the start of the code

Copy link
Member

@amannaik247 amannaik247 left a comment

Choose a reason for hiding this comment

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

from gettext import gettext as _

from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Gio

from sugar3 import profile

from aiml.Kernel import Kernel
import voice

You have removed all the existing imports?
How do you think you will get profile information from about the user?

@Avijain15
Copy link
Author

Copy to BlackBox

from gettext import gettext as _

from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Gio

from sugar3 import profile

from aiml.Kernel import Kernel
import voice

You have removed all the existing imports? How do you think you will get profile information from about the user?

Can you please mention the specific files you are talking about?

@amannaik247
Copy link
Member

Can you please mention the specific files you are talking about?

This particular file is brain.py

@Avijain15
Copy link
Author

Can you please mention the specific files you are talking about?

This particular file is brain.py

I removed those imports inorder to reduce the complexcity of the code because shifting to a API based approach allow us to leverage the external services. I hope this resolves your issue.If not please let me know

@quozl
Copy link
Contributor

quozl commented Apr 21, 2025

  • the activity must continue to work without internet,
  • do not add copyright statements by any other person other than yourself,
  • do not change license for a copyright by others,
  • use a separate source file in order to add functionality under a new copyright and license,
  • provide any API key with the application source code; it is not possible to distribute the application without an API key, because then it would not work,
  • use our guidance for writing commit messages, see sugar-docs contributing.

@Avijain15
Copy link
Author

  • the activity must continue to work without internet,
  • do not add copyright statements by any other person other than yourself,
  • do not change license for a copyright by others,
  • use a separate source file in order to add functionality under a new copyright and license,
  • provide any API key with the application source code; it is not possible to distribute the application without an API key, because then it would not work,
  • use our guidance for writing commit messages, see sugar-docs contributing.

Thanks James for bringing into my consideration. I am going to work on your suggestion and do the following amends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants