tutorfile


Nametutorfile JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/cdbyers/tutorfile
SummaryA vimtutor-inspired library for generating interactive tutorials using AI
upload_time2025-02-09 04:31:52
maintainerNone
docs_urlNone
authorCarl Byers
requires_python<4.0,>=3.11
licenseMIT
keywords tutorial education ai interactive-learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tutorfile

Inspired by vimtutor, tutorfile lets you build text-based interactive tutorials using AI. It generates step-by-step lessons that emphasize learning by doing, with each concept building on previous ones through hands-on practice.

Like any LLM output, tutorfile's lessons can contain inaccuracies. Exercise particular caution with unfamiliar topics or subjects that may be outside LLMs' reliable knowledge base. To improve accuracy, you can provide source material and enable strict adherence mode.

## Quickstart

```python
import openai
from tutorfile import generate_lessons, write_lessons_to_folder

client = openai.OpenAI()

# Create an interactive regex tutorial
lessons = generate_lessons(
    client=client,
    model="gpt-4o",
    topic="Regular Expressions",
    topic_description="""
    Lessons on regular expressions using Python's re module and interactivity through IPython
    """,
    num_lessons=10
)

write_lessons_to_folder(lessons, "regex")
```

![XKCD Comic about Regular Expressions](https://imgs.xkcd.com/comics/regular_expressions.png)

*From [XKCD](https://xkcd.com/208/), also you after regextutor*

## Using Source Material

You can provide source material to ensure accuracy:

```python
with open('source_document.txt', 'r') as f:
    source_text = f.read()

lessons = generate_lessons(
    client=client,
    model="gpt-4o",
    topic="Topic",
    topic_description="Description",
    source_text=source_text,
    strict_source_text_adherence=True 
)
```
Extensive source material can cause the prompt for the LLM to exceed the available context, leading to potential errors. 

The strict_source_text_adherence argument defaults to False. True means the LLM will be asked to exclusively use the text from source_text to inform lessons.

## Building on Existing Lessons

Load existing lessons and generate more:

```python
from tutorfile import read_lessons_from_folder, generate_lessons, write_lessons_to_folder

# Read existing lessons
existing_lessons = read_lessons_from_folder("regextutor")

# Generate additional lessons
new_lessons = generate_lessons(
    client=client,
    model="gpt-4o",
    topic="Regular Expressions",
    topic_description="Advanced concepts",
    num_lessons=15,  # Will generate lessons 11-15
    existing_lessons=existing_lessons
)

# Write all lessons to folder
write_lessons_to_folder(new_lessons, "regex")
```
## Installation

```bash
pip install tutorfile
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cdbyers/tutorfile",
    "name": "tutorfile",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "tutorial, education, AI, interactive-learning",
    "author": "Carl Byers",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d6/bb/11b2b007aba591e3f6cccd1707b82cd345b16fe8ed96dc71176d52d32bf5/tutorfile-0.1.3.tar.gz",
    "platform": null,
    "description": "# tutorfile\n\nInspired by vimtutor, tutorfile lets you build text-based interactive tutorials using AI. It generates step-by-step lessons that emphasize learning by doing, with each concept building on previous ones through hands-on practice.\n\nLike any LLM output, tutorfile's lessons can contain inaccuracies. Exercise particular caution with unfamiliar topics or subjects that may be outside LLMs' reliable knowledge base. To improve accuracy, you can provide source material and enable strict adherence mode.\n\n## Quickstart\n\n```python\nimport openai\nfrom tutorfile import generate_lessons, write_lessons_to_folder\n\nclient = openai.OpenAI()\n\n# Create an interactive regex tutorial\nlessons = generate_lessons(\n    client=client,\n    model=\"gpt-4o\",\n    topic=\"Regular Expressions\",\n    topic_description=\"\"\"\n    Lessons on regular expressions using Python's re module and interactivity through IPython\n    \"\"\",\n    num_lessons=10\n)\n\nwrite_lessons_to_folder(lessons, \"regex\")\n```\n\n![XKCD Comic about Regular Expressions](https://imgs.xkcd.com/comics/regular_expressions.png)\n\n*From [XKCD](https://xkcd.com/208/), also you after regextutor*\n\n## Using Source Material\n\nYou can provide source material to ensure accuracy:\n\n```python\nwith open('source_document.txt', 'r') as f:\n    source_text = f.read()\n\nlessons = generate_lessons(\n    client=client,\n    model=\"gpt-4o\",\n    topic=\"Topic\",\n    topic_description=\"Description\",\n    source_text=source_text,\n    strict_source_text_adherence=True \n)\n```\nExtensive source material can cause the prompt for the LLM to exceed the available context, leading to potential errors. \n\nThe strict_source_text_adherence argument defaults to False. True means the LLM will be asked to exclusively use the text from source_text to inform lessons.\n\n## Building on Existing Lessons\n\nLoad existing lessons and generate more:\n\n```python\nfrom tutorfile import read_lessons_from_folder, generate_lessons, write_lessons_to_folder\n\n# Read existing lessons\nexisting_lessons = read_lessons_from_folder(\"regextutor\")\n\n# Generate additional lessons\nnew_lessons = generate_lessons(\n    client=client,\n    model=\"gpt-4o\",\n    topic=\"Regular Expressions\",\n    topic_description=\"Advanced concepts\",\n    num_lessons=15,  # Will generate lessons 11-15\n    existing_lessons=existing_lessons\n)\n\n# Write all lessons to folder\nwrite_lessons_to_folder(new_lessons, \"regex\")\n```\n## Installation\n\n```bash\npip install tutorfile\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A vimtutor-inspired library for generating interactive tutorials using AI",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/cdbyers/tutorfile",
        "Repository": "https://github.com/cdbyers/tutorfile"
    },
    "split_keywords": [
        "tutorial",
        " education",
        " ai",
        " interactive-learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea4c2b0a5b689ea08348f1658ef7ff7ef4aa29f4265dfe954015cf35faed58bc",
                "md5": "04e4d717b63c167c1d8bf6e36c4f268a",
                "sha256": "629863be00e43cf3dc7821b0502db5b1ea08dcd0d71da3631d8c17fe48555a5f"
            },
            "downloads": -1,
            "filename": "tutorfile-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "04e4d717b63c167c1d8bf6e36c4f268a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 7048,
            "upload_time": "2025-02-09T04:31:50",
            "upload_time_iso_8601": "2025-02-09T04:31:50.394170Z",
            "url": "https://files.pythonhosted.org/packages/ea/4c/2b0a5b689ea08348f1658ef7ff7ef4aa29f4265dfe954015cf35faed58bc/tutorfile-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6bb11b2b007aba591e3f6cccd1707b82cd345b16fe8ed96dc71176d52d32bf5",
                "md5": "5ad80806cbb18dbfb295261edb053299",
                "sha256": "e2d8fb80f7522aa44935300dfc2c62f93dddef724ac2de27661d8734e21497a5"
            },
            "downloads": -1,
            "filename": "tutorfile-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5ad80806cbb18dbfb295261edb053299",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 6056,
            "upload_time": "2025-02-09T04:31:52",
            "upload_time_iso_8601": "2025-02-09T04:31:52.059237Z",
            "url": "https://files.pythonhosted.org/packages/d6/bb/11b2b007aba591e3f6cccd1707b82cd345b16fe8ed96dc71176d52d32bf5/tutorfile-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-09 04:31:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cdbyers",
    "github_project": "tutorfile",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tutorfile"
}
        
Elapsed time: 0.83009s