learning-assistant


Namelearning-assistant JSON
Version 4.6.2 PyPI version JSON
download
home_pagehttps://github.com/openedx/learning-assistant
SummaryPlugin for a learning assistant backend, intended for use within edx-platform
upload_time2024-12-18 15:34:41
maintainerNone
docs_urlNone
authoredX
requires_python>=3.8
licenseAGPL 3.0
keywords python edx
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            learning-assistant
#############################

|pypi-badge| |ci-badge| |codecov-badge| |doc-badge| |pyversions-badge|
|license-badge| |status-badge|

Purpose
*******

Plugin for a learning assistant backend, intended for use within edx-platform.

This library contains data models and logic for a platform wide learning assistant.

Dependencies
************
In addition to the edx-platform repository in which this library is installed, this plugin also
leverages the `frontend-lib-learning-assistant`_ as a frontend interface for the learning assistant.

Getting Started
***************

Developing
==========

One Time Setup
--------------
.. code-block::

  # Clone the repository (in the ../src relative to devstack repo)
  git clone git@github.com:openedx/learning-assistant.git
  cd learning-assistant

  # Set up a virtualenv with the same name as the repo and activate it
  # Here's how you might do that if you have virtualenvwrapper setup.
  mkvirtualenv -p python3.8 learning-assistant

In your ``requirements/edx/private.txt`` requirements file in edx-platform, add:

.. code-block::

  -e /edx/src/learning-assistant

In your ``lms/envs/private.py`` settings file in edx-platform (create file if necessary), add the below settings. The value of the API key shouldn't matter, because it's not being used at this point, but the setting needs to be there.

.. code-block::

  CHAT_COMPLETION_API = '' # copy url from edx-internal
  CHAT_COMPLETION_API_KEY = '' # add value though value itself does not matter

  LEARNING_ASSISTANT_PROMPT_TEMPLATE = '' # copy value from edx-internal

  LEARNING_ASSISTANT_AVAILABLE = True

In devstack, run ``make lms-shell`` and run the following command: ``paver install_prereqs;exit``. This will install anything included in your ``private.txt`` requirements file.

In your ``env.development`` config file in frontend-app-learning, add the below setting.

.. code-block::

  ENABLE_XPERT_AUDIT='true'

In django admin, add the following waffle flag ``learning_assistant.enable_course_content`` and make sure it is turned on for Everyone. The flag should be checked on for: Superusers, Staff, and Authenticated.

This plugin depends on the lms and discovery - both should be running.

Every time you develop something in this repo
---------------------------------------------
.. code-block::

  # Activate the virtualenv
  # Here's how you might do that if you're using virtualenvwrapper.
  workon learning-assistant

  # Grab the latest code
  git checkout main
  git pull

  # Install/update the dev requirements
  make requirements

  # Run the tests and quality checks (to verify the status before you make any changes)
  make validate

  # Make a new branch for your changes
  git checkout -b <your_github_username>/<short_description>

  # Using your favorite editor, edit the code to make your change.
  vim ...

  # Run your new tests
  pytest ./path/to/new/tests

  # Run all the tests and quality checks
  make validate

  # Commit all your changes
  git commit ...
  git push

  # Open a PR and ask for review.

License
*******

The code in this repository is licensed under the AGPL 3.0 unless
otherwise noted.

Please see `LICENSE.txt <LICENSE.txt>`_ for details.

Contributing
************

This repo is not currently accepting contributions.

The Open edX Code of Conduct
****************************

All community members are expected to follow the `Open edX Code of Conduct`_.

.. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/

Reporting Security Issues
*************************

Please do not report security issues in public. Please email security@edx.org.

.. |pypi-badge| image:: https://img.shields.io/pypi/v/learning-assistant.svg
    :target: https://pypi.python.org/pypi/learning-assistant/
    :alt: PyPI

.. |ci-badge| image:: https://github.com/openedx/learning-assistant/workflows/Python%20CI/badge.svg?branch=main
    :target: https://github.com/openedx/learning-assistant/actions
    :alt: CI

.. |codecov-badge| image:: https://codecov.io/github/openedx/learning-assistant/coverage.svg?branch=main
    :target: https://codecov.io/github/openedx/learning-assistant?branch=main
    :alt: Codecov

.. |doc-badge| image:: https://readthedocs.org/projects/learning-assistant/badge/?version=latest
    :target: https://docs.openedx.org/projects/learning-assistant
    :alt: Documentation

.. |pyversions-badge| image:: https://img.shields.io/pypi/pyversions/learning-assistant.svg
    :target: https://pypi.python.org/pypi/learning-assistant/
    :alt: Supported Python versions

.. |license-badge| image:: https://img.shields.io/github/license/openedx/learning-assistant.svg
    :target: https://github.com/openedx/learning-assistant/blob/main/LICENSE.txt
    :alt: License

.. TODO: Choose one of the statuses below and remove the other status-badge lines.
.. |status-badge| image:: https://img.shields.io/badge/Status-Experimental-yellow
.. .. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
.. .. |status-badge| image:: https://img.shields.io/badge/Status-Deprecated-orange
.. .. |status-badge| image:: https://img.shields.io/badge/Status-Unsupported-red

.. _frontend-lib-learning-assistant: https://github.com/edx/frontend-lib-learning-assistant


Change Log
##########

..
   All enhancements and patches to learning_assistant will be documented
   in this file.  It adheres to the structure of https://keepachangelog.com/ ,
   but in reStructuredText instead of Markdown (for ease of incorporation into
   Sphinx documentation and the PyPI description).

   This project adheres to Semantic Versioning (https://semver.org/).

.. There should always be an "Unreleased" section for changes pending release.

Unreleased
**********

4.6.2 - 2025-12-18
******************
* Fixed the params for expiration_date in the admin table for audit trial.
* Add ENABLE_XPERT_AUDIT instructions.

4.6.1 - 2025-12-17
******************
* Added an admin table for the LearningAssistantAuditTrial model. This table includes an expiration_date valued that is
  calculated based on the start_date.

4.6.0 - 2025-12-10
******************
* Add an audit_trial_length_days attribute to the response returned by the ChatSummaryView, representing the
  number of days in an audit trial as currently configured. It does not necessarily represent the number of days in the
  learner's current trial.

4.5.0 - 2024-12-04
******************
* Add local setup to readme
* Add a BFFE chat summary endpoint for Learning Assistant, including information about whether the Learning Assistant is
  enabled, Learning Assistant message history, and Learning Assistant audit trial data.

4.4.7 - 2024-11-25
******************
* Fixes the Course Chat View CourseMode concatenation issue

4.4.6 - 2024-11-22
******************
* Gates the chat history endpoint behind a waffle flag
* Add LearningAssistantAuditTrial model

4.4.5 - 2024-11-12
******************
* Updated Learning Assistant History payload to return in ascending order

4.4.4 - 2024-11-06
******************
* Fixed Learning Assistant History endpoint
* Added timestamp to the Learning Assistant History payload

4.4.3 - 2024-11-06
******************
* Fixed package version

4.4.2 - 2024-11-04
******************
* Added chat messages to the DB

4.4.1 - 2024-10-31
******************
* Add management command to remove expired messages

4.4.0 - 2024-10-30
******************
* Add LearningAssistantMessage model
* Add new GET endpoint to retrieve a user's message history in a given course.

4.4.0 - 2024-10-25
******************
* Upgraded to use ``Python 3.12``

4.3.3 - 2024-10-15
******************
* Use `LEARNING_ASSISTANT_PROMPT_TEMPLATE` for prompt

4.3.2 - 2024-09-19
******************
* Add error handling for invalid unit usage keys

4.3.1 - 2024-09-10
******************
* Remove GPT model field as part of POST request to Xpert backend

4.3.0 - 2024-07-01
******************
* Adds optional parameter to use updated prompt and model for the chat response.

4.2.0 - 2024-02-28
******************
* Modify call to Xpert backend to prevent use of course index.

4.1.0 - 2024-02-26
******************
* Use course cache to inject course title and course skill names into prompt template.

4.0.0 - 2024-02-21
******************
* Remove use of course waffle flag. Use the django setting LEARNING_ASSISTANT_AVAILABLE
  to enable the learning assistant feature.

3.6.0 - 2024-02-13
******************
* Enable backend access by course waffle flag or django setting.

3.4.0 - 2024-01-30
******************
* Add new GET endpoint to retrieve whether Learning Assistant is enabled in a given course.

3.3.0 - 2024-01-30
******************
* Fix release version

3.2.0 - 2024-01-30
******************
* Remove audit access to chat view.

3.0.1 - 2024-01-29
******************
* Modify gating of learning assistant based on waffle flag and enabled value.

3.0.0 - 2024-01-23
******************
* Remove and drop the course prompt model.

2.0.3 - 2024-01-22
******************
* Remove references to the course prompt model.

2.0.1 - 2024-01-08
******************
* Gate content integration with waffle flag

2.0.0 - 2024-01-03
******************
* Add content cache
* Integrate system prompt setting

1.5.0 - 2023-10-18
******************
* Add management command to generate course prompts

1.4.0 - 2023-09-11
******************
* Send reduced message list if needed to avoid going over token limit

1.3.3 - 2023-09-07
******************
* Allow any enrolled learner to access API.

1.3.2 - 2023-08-25
******************
* Remove deserialization of prompt field, as it is represented in the python
  native format

1.3.1 - 2023-08-24
******************
* Remove prompt field

1.3.0 - 2023-08-24
******************
* Remove references to prompt field
* Create json_prompt field to allow for more flexible prompts

1.2.1 - 2023-08-24
******************
* make prompt field nullable

1.2.0 - 2023-08-22
******************
* add endpoint authentication
* fix request structure required for endpoint integration

1.1.0 - 2023-08-09
******************
* fix for course id to course key conversion

1.0.0 - 2023-08-08
******************

* Add endpoint to retrieve chat response
* Created model to associate course ideas with a specific prompt text

Unreleased
**********


0.1.0 – 2023-07-26
**********************************************

Added
=====

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/openedx/learning-assistant",
    "name": "learning-assistant",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "Python edx",
    "author": "edX",
    "author_email": "team-cosmonauts@edx.org",
    "download_url": "https://files.pythonhosted.org/packages/36/3c/e1c266bfea353fcba8a744a5e1263339d1d73e433a7f7bcec0cbe45f55f6/learning_assistant-4.6.2.tar.gz",
    "platform": null,
    "description": "learning-assistant\n#############################\n\n|pypi-badge| |ci-badge| |codecov-badge| |doc-badge| |pyversions-badge|\n|license-badge| |status-badge|\n\nPurpose\n*******\n\nPlugin for a learning assistant backend, intended for use within edx-platform.\n\nThis library contains data models and logic for a platform wide learning assistant.\n\nDependencies\n************\nIn addition to the edx-platform repository in which this library is installed, this plugin also\nleverages the `frontend-lib-learning-assistant`_ as a frontend interface for the learning assistant.\n\nGetting Started\n***************\n\nDeveloping\n==========\n\nOne Time Setup\n--------------\n.. code-block::\n\n  # Clone the repository (in the ../src relative to devstack repo)\n  git clone git@github.com:openedx/learning-assistant.git\n  cd learning-assistant\n\n  # Set up a virtualenv with the same name as the repo and activate it\n  # Here's how you might do that if you have virtualenvwrapper setup.\n  mkvirtualenv -p python3.8 learning-assistant\n\nIn your ``requirements/edx/private.txt`` requirements file in edx-platform, add:\n\n.. code-block::\n\n  -e /edx/src/learning-assistant\n\nIn your ``lms/envs/private.py`` settings file in edx-platform (create file if necessary), add the below settings. The value of the API key shouldn't matter, because it's not being used at this point, but the setting needs to be there.\n\n.. code-block::\n\n  CHAT_COMPLETION_API = '' # copy url from edx-internal\n  CHAT_COMPLETION_API_KEY = '' # add value though value itself does not matter\n\n  LEARNING_ASSISTANT_PROMPT_TEMPLATE = '' # copy value from edx-internal\n\n  LEARNING_ASSISTANT_AVAILABLE = True\n\nIn devstack, run ``make lms-shell`` and run the following command: ``paver install_prereqs;exit``. This will install anything included in your ``private.txt`` requirements file.\n\nIn your ``env.development`` config file in frontend-app-learning, add the below setting.\n\n.. code-block::\n\n  ENABLE_XPERT_AUDIT='true'\n\nIn django admin, add the following waffle flag ``learning_assistant.enable_course_content`` and make sure it is turned on for Everyone. The flag should be checked on for: Superusers, Staff, and Authenticated.\n\nThis plugin depends on the lms and discovery - both should be running.\n\nEvery time you develop something in this repo\n---------------------------------------------\n.. code-block::\n\n  # Activate the virtualenv\n  # Here's how you might do that if you're using virtualenvwrapper.\n  workon learning-assistant\n\n  # Grab the latest code\n  git checkout main\n  git pull\n\n  # Install/update the dev requirements\n  make requirements\n\n  # Run the tests and quality checks (to verify the status before you make any changes)\n  make validate\n\n  # Make a new branch for your changes\n  git checkout -b <your_github_username>/<short_description>\n\n  # Using your favorite editor, edit the code to make your change.\n  vim ...\n\n  # Run your new tests\n  pytest ./path/to/new/tests\n\n  # Run all the tests and quality checks\n  make validate\n\n  # Commit all your changes\n  git commit ...\n  git push\n\n  # Open a PR and ask for review.\n\nLicense\n*******\n\nThe code in this repository is licensed under the AGPL 3.0 unless\notherwise noted.\n\nPlease see `LICENSE.txt <LICENSE.txt>`_ for details.\n\nContributing\n************\n\nThis repo is not currently accepting contributions.\n\nThe Open edX Code of Conduct\n****************************\n\nAll community members are expected to follow the `Open edX Code of Conduct`_.\n\n.. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/\n\nReporting Security Issues\n*************************\n\nPlease do not report security issues in public. Please email security@edx.org.\n\n.. |pypi-badge| image:: https://img.shields.io/pypi/v/learning-assistant.svg\n    :target: https://pypi.python.org/pypi/learning-assistant/\n    :alt: PyPI\n\n.. |ci-badge| image:: https://github.com/openedx/learning-assistant/workflows/Python%20CI/badge.svg?branch=main\n    :target: https://github.com/openedx/learning-assistant/actions\n    :alt: CI\n\n.. |codecov-badge| image:: https://codecov.io/github/openedx/learning-assistant/coverage.svg?branch=main\n    :target: https://codecov.io/github/openedx/learning-assistant?branch=main\n    :alt: Codecov\n\n.. |doc-badge| image:: https://readthedocs.org/projects/learning-assistant/badge/?version=latest\n    :target: https://docs.openedx.org/projects/learning-assistant\n    :alt: Documentation\n\n.. |pyversions-badge| image:: https://img.shields.io/pypi/pyversions/learning-assistant.svg\n    :target: https://pypi.python.org/pypi/learning-assistant/\n    :alt: Supported Python versions\n\n.. |license-badge| image:: https://img.shields.io/github/license/openedx/learning-assistant.svg\n    :target: https://github.com/openedx/learning-assistant/blob/main/LICENSE.txt\n    :alt: License\n\n.. TODO: Choose one of the statuses below and remove the other status-badge lines.\n.. |status-badge| image:: https://img.shields.io/badge/Status-Experimental-yellow\n.. .. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen\n.. .. |status-badge| image:: https://img.shields.io/badge/Status-Deprecated-orange\n.. .. |status-badge| image:: https://img.shields.io/badge/Status-Unsupported-red\n\n.. _frontend-lib-learning-assistant: https://github.com/edx/frontend-lib-learning-assistant\n\n\nChange Log\n##########\n\n..\n   All enhancements and patches to learning_assistant will be documented\n   in this file.  It adheres to the structure of https://keepachangelog.com/ ,\n   but in reStructuredText instead of Markdown (for ease of incorporation into\n   Sphinx documentation and the PyPI description).\n\n   This project adheres to Semantic Versioning (https://semver.org/).\n\n.. There should always be an \"Unreleased\" section for changes pending release.\n\nUnreleased\n**********\n\n4.6.2 - 2025-12-18\n******************\n* Fixed the params for expiration_date in the admin table for audit trial.\n* Add ENABLE_XPERT_AUDIT instructions.\n\n4.6.1 - 2025-12-17\n******************\n* Added an admin table for the LearningAssistantAuditTrial model. This table includes an expiration_date valued that is\n  calculated based on the start_date.\n\n4.6.0 - 2025-12-10\n******************\n* Add an audit_trial_length_days attribute to the response returned by the ChatSummaryView, representing the\n  number of days in an audit trial as currently configured. It does not necessarily represent the number of days in the\n  learner's current trial.\n\n4.5.0 - 2024-12-04\n******************\n* Add local setup to readme\n* Add a BFFE chat summary endpoint for Learning Assistant, including information about whether the Learning Assistant is\n  enabled, Learning Assistant message history, and Learning Assistant audit trial data.\n\n4.4.7 - 2024-11-25\n******************\n* Fixes the Course Chat View CourseMode concatenation issue\n\n4.4.6 - 2024-11-22\n******************\n* Gates the chat history endpoint behind a waffle flag\n* Add LearningAssistantAuditTrial model\n\n4.4.5 - 2024-11-12\n******************\n* Updated Learning Assistant History payload to return in ascending order\n\n4.4.4 - 2024-11-06\n******************\n* Fixed Learning Assistant History endpoint\n* Added timestamp to the Learning Assistant History payload\n\n4.4.3 - 2024-11-06\n******************\n* Fixed package version\n\n4.4.2 - 2024-11-04\n******************\n* Added chat messages to the DB\n\n4.4.1 - 2024-10-31\n******************\n* Add management command to remove expired messages\n\n4.4.0 - 2024-10-30\n******************\n* Add LearningAssistantMessage model\n* Add new GET endpoint to retrieve a user's message history in a given course.\n\n4.4.0 - 2024-10-25\n******************\n* Upgraded to use ``Python 3.12``\n\n4.3.3 - 2024-10-15\n******************\n* Use `LEARNING_ASSISTANT_PROMPT_TEMPLATE` for prompt\n\n4.3.2 - 2024-09-19\n******************\n* Add error handling for invalid unit usage keys\n\n4.3.1 - 2024-09-10\n******************\n* Remove GPT model field as part of POST request to Xpert backend\n\n4.3.0 - 2024-07-01\n******************\n* Adds optional parameter to use updated prompt and model for the chat response.\n\n4.2.0 - 2024-02-28\n******************\n* Modify call to Xpert backend to prevent use of course index.\n\n4.1.0 - 2024-02-26\n******************\n* Use course cache to inject course title and course skill names into prompt template.\n\n4.0.0 - 2024-02-21\n******************\n* Remove use of course waffle flag. Use the django setting LEARNING_ASSISTANT_AVAILABLE\n  to enable the learning assistant feature.\n\n3.6.0 - 2024-02-13\n******************\n* Enable backend access by course waffle flag or django setting.\n\n3.4.0 - 2024-01-30\n******************\n* Add new GET endpoint to retrieve whether Learning Assistant is enabled in a given course.\n\n3.3.0 - 2024-01-30\n******************\n* Fix release version\n\n3.2.0 - 2024-01-30\n******************\n* Remove audit access to chat view.\n\n3.0.1 - 2024-01-29\n******************\n* Modify gating of learning assistant based on waffle flag and enabled value.\n\n3.0.0 - 2024-01-23\n******************\n* Remove and drop the course prompt model.\n\n2.0.3 - 2024-01-22\n******************\n* Remove references to the course prompt model.\n\n2.0.1 - 2024-01-08\n******************\n* Gate content integration with waffle flag\n\n2.0.0 - 2024-01-03\n******************\n* Add content cache\n* Integrate system prompt setting\n\n1.5.0 - 2023-10-18\n******************\n* Add management command to generate course prompts\n\n1.4.0 - 2023-09-11\n******************\n* Send reduced message list if needed to avoid going over token limit\n\n1.3.3 - 2023-09-07\n******************\n* Allow any enrolled learner to access API.\n\n1.3.2 - 2023-08-25\n******************\n* Remove deserialization of prompt field, as it is represented in the python\n  native format\n\n1.3.1 - 2023-08-24\n******************\n* Remove prompt field\n\n1.3.0 - 2023-08-24\n******************\n* Remove references to prompt field\n* Create json_prompt field to allow for more flexible prompts\n\n1.2.1 - 2023-08-24\n******************\n* make prompt field nullable\n\n1.2.0 - 2023-08-22\n******************\n* add endpoint authentication\n* fix request structure required for endpoint integration\n\n1.1.0 - 2023-08-09\n******************\n* fix for course id to course key conversion\n\n1.0.0 - 2023-08-08\n******************\n\n* Add endpoint to retrieve chat response\n* Created model to associate course ideas with a specific prompt text\n\nUnreleased\n**********\n\n\n0.1.0 \u2013 2023-07-26\n**********************************************\n\nAdded\n=====\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "AGPL 3.0",
    "summary": "Plugin for a learning assistant backend, intended for use within edx-platform",
    "version": "4.6.2",
    "project_urls": {
        "Homepage": "https://github.com/openedx/learning-assistant"
    },
    "split_keywords": [
        "python",
        "edx"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5226d1aa79468d39a04e3eabc6424ebb3c2609302c6a9e6b62ddcd45ac6595a8",
                "md5": "35844607f17a0d537357361c34dc7e61",
                "sha256": "e2cdb13106f8a5fef76ff735674a58ddf56a7367e30966100e85f7040be2cee3"
            },
            "downloads": -1,
            "filename": "learning_assistant-4.6.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "35844607f17a0d537357361c34dc7e61",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 42761,
            "upload_time": "2024-12-18T15:34:38",
            "upload_time_iso_8601": "2024-12-18T15:34:38.860430Z",
            "url": "https://files.pythonhosted.org/packages/52/26/d1aa79468d39a04e3eabc6424ebb3c2609302c6a9e6b62ddcd45ac6595a8/learning_assistant-4.6.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "363ce1c266bfea353fcba8a744a5e1263339d1d73e433a7f7bcec0cbe45f55f6",
                "md5": "ff84563d6675c6df1ed5cac9b9115e2a",
                "sha256": "3d100079b3c813b8ac52a84c9d7fa53013018a8a7ada849ea8de68e2bef1087c"
            },
            "downloads": -1,
            "filename": "learning_assistant-4.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ff84563d6675c6df1ed5cac9b9115e2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 49990,
            "upload_time": "2024-12-18T15:34:41",
            "upload_time_iso_8601": "2024-12-18T15:34:41.411383Z",
            "url": "https://files.pythonhosted.org/packages/36/3c/e1c266bfea353fcba8a744a5e1263339d1d73e433a7f7bcec0cbe45f55f6/learning_assistant-4.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 15:34:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "openedx",
    "github_project": "learning-assistant",
    "github_not_found": true,
    "lcname": "learning-assistant"
}
        
edX
Elapsed time: 0.44340s