youtube-qa


Nameyoutube-qa JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/jakecyr/youtube-qa
SummaryQuestion answering over YouTube videos with embeddings and LLMs.
upload_time2024-07-23 02:38:38
maintainerNone
docs_urlNone
authorJake Cyr
requires_python<3.13,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # YouTube Question Answer

Simple experiment for question answering on YouTube videos using embeddings and
the top n YouTube search result transcripts.

The function will take a question and optionally a YouTube search query (otherwise an LLM will auto-generate one),
will compile transcripts for each video result, generate an embedding index using the transcripts and then answer the
question using the relevant embeddings.

The function will return both a string response and a list of sources that were used for the answer.

## Installation

The package can be installed from PyPI with `pip install youtube-qa`. Make sure to set your `OPENAI_API_KEY`
environment variable before using.

## Example

```python
from youtube_qa.youtube_video_index import VideoIndexQueryResponse, YouTubeVideoIndex

video_index = YouTubeVideoIndex()
video_index.build_index(
    search_term="huberman motivation",
    video_results=3,
)
response: VideoIndexQueryResponse = video_index.answer_question(
    question="what are the best researched supplements to help with exercise motivation",
)

print(response.answer) # The answer to the question.
print(response.sources) # Video links and other metadata.
```

You can also generate the search query given the question:

```python
from youtube_qa.youtube_video_index import VideoIndexQueryResponse, YouTubeVideoIndex

question = "what are the best researched supplements to help with exercise motivation"
video_index = YouTubeVideoIndex(
    # Can optionally pass in custom embedding model and LLM here.
)
search_term = video_index.generate_search_query(question)

video_index.build_index(
    search_term=search_term,
    video_results=3,
)
response: VideoIndexQueryResponse = video_index.answer_question(
    question=question,
)

print(response.answer) # The answer to the question.
print(response.sources) # Video links and other metadata.
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jakecyr/youtube-qa",
    "name": "youtube-qa",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Jake Cyr",
    "author_email": "cyrjake@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1f/49/967bba775442ac8584ef1827b0372e47c89817ca897e100e53ed032c0339/youtube_qa-1.0.4.tar.gz",
    "platform": null,
    "description": "# YouTube Question Answer\n\nSimple experiment for question answering on YouTube videos using embeddings and\nthe top n YouTube search result transcripts.\n\nThe function will take a question and optionally a YouTube search query (otherwise an LLM will auto-generate one),\nwill compile transcripts for each video result, generate an embedding index using the transcripts and then answer the\nquestion using the relevant embeddings.\n\nThe function will return both a string response and a list of sources that were used for the answer.\n\n## Installation\n\nThe package can be installed from PyPI with `pip install youtube-qa`. Make sure to set your `OPENAI_API_KEY`\nenvironment variable before using.\n\n## Example\n\n```python\nfrom youtube_qa.youtube_video_index import VideoIndexQueryResponse, YouTubeVideoIndex\n\nvideo_index = YouTubeVideoIndex()\nvideo_index.build_index(\n    search_term=\"huberman motivation\",\n    video_results=3,\n)\nresponse: VideoIndexQueryResponse = video_index.answer_question(\n    question=\"what are the best researched supplements to help with exercise motivation\",\n)\n\nprint(response.answer) # The answer to the question.\nprint(response.sources) # Video links and other metadata.\n```\n\nYou can also generate the search query given the question:\n\n```python\nfrom youtube_qa.youtube_video_index import VideoIndexQueryResponse, YouTubeVideoIndex\n\nquestion = \"what are the best researched supplements to help with exercise motivation\"\nvideo_index = YouTubeVideoIndex(\n    # Can optionally pass in custom embedding model and LLM here.\n)\nsearch_term = video_index.generate_search_query(question)\n\nvideo_index.build_index(\n    search_term=search_term,\n    video_results=3,\n)\nresponse: VideoIndexQueryResponse = video_index.answer_question(\n    question=question,\n)\n\nprint(response.answer) # The answer to the question.\nprint(response.sources) # Video links and other metadata.\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Question answering over YouTube videos with embeddings and LLMs.",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/jakecyr/youtube-qa",
        "Repository": "https://github.com/jakecyr/youtube-qa"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce2684bc14628dab9f1cdc9b82b949961ece6ff14ae9c4f7baefe1fc0b3ca3fa",
                "md5": "b8f70b27f40d2b624b44de931a71487c",
                "sha256": "b8f5063a41c2cde7be56053fddf03a8f84f55ade4895c7a6ff9fe42bcba6a543"
            },
            "downloads": -1,
            "filename": "youtube_qa-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b8f70b27f40d2b624b44de931a71487c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 5172,
            "upload_time": "2024-07-23T02:38:37",
            "upload_time_iso_8601": "2024-07-23T02:38:37.821445Z",
            "url": "https://files.pythonhosted.org/packages/ce/26/84bc14628dab9f1cdc9b82b949961ece6ff14ae9c4f7baefe1fc0b3ca3fa/youtube_qa-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f49967bba775442ac8584ef1827b0372e47c89817ca897e100e53ed032c0339",
                "md5": "17579d341f0cd789978ecdba9b71369b",
                "sha256": "f88b2c911d28a29d68247aa0fa417ccffcaab2faa02d4ae79ce5a934df8cd4f7"
            },
            "downloads": -1,
            "filename": "youtube_qa-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "17579d341f0cd789978ecdba9b71369b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 3937,
            "upload_time": "2024-07-23T02:38:38",
            "upload_time_iso_8601": "2024-07-23T02:38:38.987254Z",
            "url": "https://files.pythonhosted.org/packages/1f/49/967bba775442ac8584ef1827b0372e47c89817ca897e100e53ed032c0339/youtube_qa-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-23 02:38:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jakecyr",
    "github_project": "youtube-qa",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "youtube-qa"
}
        
Elapsed time: 0.44790s