Skip to content

Conversation

@Henrrypg
Copy link
Contributor

This pull request introduces several important updates to both the backend and frontend of the openedx_ai_extensions project, focusing on improved configuration management, plugin integration with Tutor, and enhancements to build and packaging processes. The most significant changes include the migration to a centralized configuration object for AI model settings, the addition of Tutor plugin hooks and patch management, and updates to frontend package naming and build scripts.

Configuration and Backend Updates:

  • Migrated AI model and API key settings to a centralized OPENEDX_AI_EXTENSIONS configuration object, which is now read from environment variables and used throughout the backend, replacing individual settings like AI_MODEL and OPENAI_API_KEY. [1] [2] [3]
  • Updated backend setup to use pathlib.Path for more robust file handling when reading README.md and CHANGELOG.rst files. [1] [2]

Tutor Plugin Integration:

  • Added a new Tutor plugin definition in plugin.py, including default configuration values, build context management, patch file integration, and UI slot configuration for the learning experience. [1] [2]
  • Introduced multiple patch files to automate backend and frontend installation within Tutor Docker images, ensuring the plugin is correctly integrated into Open edX environments. [1] [2] [3] [4] [5]

Frontend and Build Process Improvements:

  • Renamed the frontend package to @openedx/openedx-ai-extensions-ui for consistency with backend naming conventions.
  • Improved the frontend Makefile to handle the absence of the LICENSE file gracefully during the build process.

Versioning:

  • Set the backend package version to 20.0.0 in __about__.py.

These changes collectively improve the maintainability, deployment, and extensibility of the openedx_ai_extensions plugin within the Open edX ecosystem.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 23, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @Henrrypg!

This repository is currently maintained by @felipemontoya.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions Oct 23, 2025
@felipemontoya felipemontoya added the FC Relates to an Axim Funded Contribution project label Oct 23, 2025
@felipemontoya felipemontoya changed the base branch from main to hpg/add-tutor-plugin October 23, 2025 19:06
@felipemontoya
Copy link
Member

I changed the base so that this PR only reflects the changes meant to use tutor configs as a way of passing the secret key for openai or other llm providers

@felipemontoya felipemontoya changed the title feat: use tutor configs feat: use tutor configs to select model, key and options in litellm Oct 23, 2025
# Each new setting is a pair: (setting_name, default_value).
("OPENEDX_AI_EXTENSIONS", [{
"default": {
"API_KEY": "",
Copy link
Member

Choose a reason for hiding this comment

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

we can write the default as put_your_api_key_here

settings.AI_MODEL = 'gpt-4.1-mini'
settings.OPENAI_API_KEY = "make_it_read_from_tutor"
if not hasattr(settings, "OPENEDX_AI_EXTENSIONS"):
settings.OPENEDX_AI_EXTENSIONS = os.getenv("OPENEDX_AI_EXTENSIONS", default={
Copy link
Member

Choose a reason for hiding this comment

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

you can use a deep update of dict here so that incomplete dicts update the default

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions Oct 27, 2025
@mphilbrick211 mphilbrick211 moved this from Ready for Review to In Eng Review in Contributions Oct 27, 2025
@felipemontoya felipemontoya deleted the branch openedx:main October 28, 2025 20:20
@github-project-automation github-project-automation bot moved this from In Eng Review to Done in Contributions Oct 28, 2025
@felipemontoya
Copy link
Member

By deleting the branch that was target here I inadvertedly deleted the PR. I'm opening again and moving to track main since the tutor PR was merged

@felipemontoya felipemontoya reopened this Oct 31, 2025
@felipemontoya felipemontoya changed the base branch from hpg/add-tutor-plugin to main October 31, 2025 20:15
@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.90%. Comparing base (363eff3) to head (d82be77).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #19       +/-   ##
===========================================
+ Coverage   46.62%   67.90%   +21.28%     
===========================================
  Files          17       16        -1     
  Lines         311      349       +38     
  Branches       20       23        +3     
===========================================
+ Hits          145      237       +92     
+ Misses        166      108       -58     
- Partials        0        4        +4     
Flag Coverage Δ
unittests 67.90% <ø> (+21.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@felipemontoya
Copy link
Member

@Henrrypg I rebased and updated this PR according to our call.

Now the tutor config accepts either one variable with the key or the complete dict for AI_EXTENSIONS.

you can use any of this examples. If you use them all at once, AI_EXTENSIONS will override AI_EXTENSIONS_OPENAI_API_KEY or anthropic.

# simple version
AI_EXTENSIONS_OPENAI_API_KEY: sk-...
AI_EXTENSIONS_ANTHROPIC_API_KEY: sk-...

# advanced
AI_EXTENSIONS:
  anthropic:
    API_KEY: sk-....
    LITELLM_MODEL: claude-3-haiku-20240307
    MAX_TOKENS: 8400
    TEMPERATURE: 1
    TIMEOUT: 600

---
adding simple configuration with key only for openai and anthropic and override capacity
@Henrrypg Henrrypg force-pushed the hpg/use-tutor-configs branch from 863263b to f9eed65 Compare November 4, 2025 14:22
@Henrrypg Henrrypg force-pushed the hpg/use-tutor-configs branch from f9eed65 to d82be77 Compare November 4, 2025 14:28
@Henrrypg
Copy link
Contributor Author

Henrrypg commented Nov 4, 2025

@felipemontoya It's working fine for me, i just add some tests to pass checks

Copy link
Member

@felipemontoya felipemontoya left a comment

Choose a reason for hiding this comment

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

This has been tested by me and Henrry and we also used this code to deploy to the sandbox at:

https://takoradi.edunext.cloud/

@felipemontoya felipemontoya merged commit 1dd99d4 into openedx:main Nov 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants