Skip to content

create : Added Sunbird AI Assistant integration with Sunbird Ed APIs #686

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: main
Choose a base branch
from

Conversation

techySPHINX
Copy link

@techySPHINX techySPHINX commented May 5, 2025

📥 Pull Request: Sunbird AI Assistant Integration ( #515 )

Description

This PR integrates the Sunbird AI Assistant into the repository. The AI assistant is built using the Model Context Protocol (MCP) and is capable of interacting contextually with the Sunbird Ed APIs. The assistant is designed to:

  • Fetch course metadata.
  • Retrieve user enrollment information.
  • Retrieve the user's profile details.
  • Enable installation-specific context handling for personalized responses.

Key Changes:

  • Integration with Sunbird Ed APIs: Built tools for fetching course metadata, enrollment details, and user profile information.
  • MCP-based AI Assistant: Created an agent that utilizes the OpenAI MCP SDK to handle conversational queries.
  • Environment Configuration: Added a .env file for configuring the Sunbird API base URL, authentication token, and other settings.
  • CLI Interface: Implemented a simple command-line interface (CLI) for testing and interacting with the assistant.
  • Unit Tests: Added tests for verifying the functionality of the tools (course metadata, enrollment, and user profile).

Motivation:

This integration adds a powerful conversational agent to the project, allowing users to interact with Sunbird Ed in a more intuitive way. By utilizing the Model Context Protocol (MCP), the assistant is flexible, context-aware, and ready to be extended for future use cases, such as personalized learning journeys.

Changes in Detail:

  • Tools: The assistant is equipped with tools that connect to the following Sunbird Ed API endpoints:

    • /course/v1/search: Fetches metadata about available courses.
    • /user/enrollment/list: Retrieves the enrollment details for the user.
    • /user/v1/profile: Retrieves the profile information of the user.
  • Config Settings: The assistant requires a .env file to store configuration like the Sunbird API base URL and Bearer token for secure API calls.

  • CLI Interface: The command-line interface (CLI) allows users to query the assistant and get real-time responses.

Testing:

  1. Unit Tests: The test_agent.py file contains tests to verify if the AI assistant interacts correctly with Sunbird Ed APIs.
  2. CLI Testing: You can interact with the assistant using the CLI, asking for course metadata, user enrollments, and profile details.

Future Work:

  • Extend the assistant to handle more complex queries and provide personalized learning recommendations.
  • Consider adding a web-based interface for more advanced user interactions.
  • Implement a logging mechanism for better traceability and debugging.

How to Test Locally

  1. Clone the repository:

    git clone https://github.com/Code4GovTech/C4GT.git
    cd C4GT/sunbird-ai-assistant
    
  2. Install the dependencies:

    pip install -r requirements.txt
  3. Set up environment variables in the .env file:

    SUNBIRD_BASE_URL=https://dev.sunbird.org/api
    SUNBIRD_AUTH_TOKEN=your_bearer_token_here
    DEFAULT_USER_ID=your_test_user_id
    LOG_LEVEL=DEBUG
    DEFAULT_COURSE_LIMIT=10
  4. Run the unit tests:

    python -m unittest tests/test_agent.py
  5. Start the CLI loop:

    python main.py

Adding connected and modified pull request for your reference and consideration Add context-aware conversational AI assistant for Sunbird Ed


Looking forward to feedback and suggestions! 🚀

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.

1 participant