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
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:
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.
Metadata
Release files for youtube-qa 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| youtube_qa-1.0.4.tar.gz | 3.9 kB | Without provenance | Details for youtube_qa-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| youtube_qa-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for youtube_qa-1.0.4-py3-none-any.whl |
Total release size: 9.1 kB
Release files / youtube_qa-1.0.4.tar.gz
| Download URL | youtube_qa-1.0.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f88b2c911d28a29d68247aa0fa417ccffcaab2faa02d4ae79ce5a934df8cd4f7
|
|
BLAKE2b-256 checksum How to use checksums |
1f49967bba775442ac8584ef1827b0372e47c89817ca897e100e53ed032c0339
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / youtube_qa-1.0.4-py3-none-any.whl
| Download URL | youtube_qa-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8f5063a41c2cde7be56053fddf03a8f84f55ade4895c7a6ff9fe42bcba6a543
|
|
BLAKE2b-256 checksum How to use checksums |
ce2684bc14628dab9f1cdc9b82b949961ece6ff14ae9c4f7baefe1fc0b3ca3fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Security for youtube-qa 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.