From 74a68c028dca0e4f1471e2dc06ef68f0e6d86e1e Mon Sep 17 00:00:00 2001 From: 0xrohitgarg Date: Wed, 28 Feb 2024 21:43:34 +0530 Subject: [PATCH] fix formatting and linting --- .../retrievers/videodb_retriever.ipynb | 56 ++++++++++--------- .../llama-index-retrievers-videodb/README.md | 23 +++++--- .../pyproject.toml | 18 +++--- .../tests/BUILD | 2 +- 4 files changed, 53 insertions(+), 46 deletions(-) diff --git a/docs/examples/retrievers/videodb_retriever.ipynb b/docs/examples/retrievers/videodb_retriever.ipynb index 3b190b93bd925..5431393f1bc5e 100644 --- a/docs/examples/retrievers/videodb_retriever.ipynb +++ b/docs/examples/retrievers/videodb_retriever.ipynb @@ -47,11 +47,12 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", + "\n", "os.environ[\"OPENAI_API_KEY\"] = \"\"\n", "os.environ[\"VIDEO_DB_API_KEY\"] = \"\"" ] @@ -72,12 +73,10 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": true - }, + "metadata": {}, "outputs": [], "source": [ - "%pip install llama-index \n", + "%pip install llama-index\n", "%pip install videodb" ] }, @@ -101,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -110,7 +109,7 @@ "# connect to VideoDB\n", "conn = connect()\n", "\n", - "# upload videos to default collection in VideoDB \n", + "# upload videos to default collection in VideoDB\n", "print(\"uploading first video\")\n", "video1 = conn.upload(url=\"https://www.youtube.com/watch?v=lsODSDmY4CY\")\n", "print(\"uploading second video\")\n", @@ -141,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -177,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -188,11 +187,11 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# VideoDBRetriever by default uses the default collection in the VideoDB \n", + "# VideoDBRetriever by default uses the default collection in the VideoDB\n", "retriever = VideoDBRetriever()\n", "\n", "# use your llama_index response_synthesizer on search results.\n", @@ -206,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -225,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -256,18 +255,18 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "from videodb import connect, play_stream \n", + "from videodb import connect, play_stream\n", "from videodb.timeline import Timeline\n", "from videodb.asset import VideoAsset" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -276,7 +275,7 @@ "'https://console.videodb.io/player?url=https://stream.videodb.io/v3/published/manifests/9c39c8a9-62a2-4b5e-b15d-8565cc58c8ae.m3u8'" ] }, - "execution_count": 8, + "execution_count": null, "metadata": {}, "output_type": "execute_result" } @@ -291,11 +290,15 @@ "for node_obj in relevant_nodes:\n", " node = node_obj.node\n", " # create a video asset for each node\n", - " node_asset = VideoAsset(asset_id=node.metadata[\"video_id\"], start=node.metadata[\"start\"], end=node.metadata[\"end\"])\n", + " node_asset = VideoAsset(\n", + " asset_id=node.metadata[\"video_id\"],\n", + " start=node.metadata[\"start\"],\n", + " end=node.metadata[\"end\"],\n", + " )\n", " # add the asset to timeline\n", " timeline.add_inline(node_asset)\n", "\n", - "#generate stream for the compiled timeline\n", + "# generate stream for the compiled timeline\n", "stream_url = timeline.generate_stream()\n", "play_stream(stream_url)" ] @@ -345,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -355,7 +358,7 @@ " NodeWithScore(node=TextNode(id_='2244fd64-121e-4699-ba36-f0f6a110750f', embedding=None, metadata={'collection_id': 'c-33978c87-33e6-4259-9e27-a9edc79be9ad', 'video_id': 'm-eae54005-b5ca-44f1-9c31-fcdb2f1db56a', 'length': '1830.498685', 'title': 'AMA #2: Improve Sleep, Reduce Sugar Cravings, Optimal Protein Intake, Stretching Frequency & More', 'start': 899.772, 'end': 977.986}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={}, text=\" Because the study, as far as I know, has not been done. Whether or not doing resistance training or some other type of exercise would have led to the same effect. Although I have to imagine that if it's moderately intense to intense resistance training, provided it's done far enough away from going to sleep right prior to 6 hours before sleep, that one ought to see the same effects, although that was not a condition in this study. But it's a very nice study. They looked at everything from changes in core body temperature to caloric expenditure. They didn't see huge changes in core body temperature changes, so that couldn't explain the effect. It really appears that the major effect of improving slow wave sleep was due to something in changing the fine structure of the brainwaves that occur during slow wave sleep. In fact, and this is an important point. The subjects in this study did not report subjectively feeling that much better from their sleep. So you might say, well then, why would I even want to bother? However, it's well known that getting sufficient slow wave sleep is important not just for repair, excuse me, for repair of bodily tissues, but also for repair of brain tissues and repair and washout of debris in the brain. And that debris is known to lead to things like dementia.\", start_char_idx=None, end_char_idx=None, text_template='{metadata_str}\\n\\n{content}', metadata_template='{key}: {value}', metadata_seperator='\\n'), score=0.282342136)]" ] }, - "execution_count": 10, + "execution_count": null, "metadata": {}, "output_type": "execute_result" } @@ -366,7 +369,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -375,7 +378,7 @@ "'https://console.videodb.io/player?url=https://stream.videodb.io/v3/published/manifests/b7201145-7302-4ec5-b87c-d1a4c6592f69.m3u8'" ] }, - "execution_count": 9, + "execution_count": null, "metadata": {}, "output_type": "execute_result" } @@ -426,9 +429,9 @@ "If you have any questions or feedback. Feel free to reach out to us ๐Ÿ™Œ๐Ÿผ\n", "\n", "- [Discord](https://discord.gg/py9P639jGz) \n", - "- [Github](https://videodb.io) \n", + "- [GitHub](https://github.com/video-db) \n", "- [VideoDB](https://videodb.io) \n", - "- [Email](mailto:contact@videodb.io) " + "- [Email](mailto:ashu@videodb.io) " ] } ], @@ -447,8 +450,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" + "pygments_lexer": "ipython3" } }, "nbformat": 4, diff --git a/llama-index-integrations/retrievers/llama-index-retrievers-videodb/README.md b/llama-index-integrations/retrievers/llama-index-retrievers-videodb/README.md index 22e2a1ba2c168..a24da704669bd 100644 --- a/llama-index-integrations/retrievers/llama-index-retrievers-videodb/README.md +++ b/llama-index-integrations/retrievers/llama-index-retrievers-videodb/README.md @@ -1,29 +1,34 @@ -# VideoDB Retriever +# VideoDB Retriever ## Overview -[VideoDB](https://videodb.io) is a serverless database designed to streamline the storage, search, editing, and streaming of video content. VideoDB offers random access to sequential video data by building indexes and developing interfaces for querying and browsing video content. Learn more at [docs.videodb.io](https://docs.videodb.io). +[VideoDB](https://videodb.io) is a serverless database designed to streamline the storage, search, editing, and streaming of video content. VideoDB offers random access to sequential video data by building indexes and developing interfaces for querying and browsing video content. Learn more at [docs.videodb.io](https://docs.videodb.io). ## Getting Started + ### Prerequisites + - Obtain API keys from [VideoDB dashboard](https://console.videodb.io) ### Installation + Install the necessary packages with the following command: -```python -%pip install llama-index llama-index-retrievers-videodb videodb + +``` +pip install llama-index llama-index-retrievers-videodb videodb ``` ## Building Your Pipeline + 1. **Data Ingestion**: Upload your videos to VideoDB and leverage its managed indexing for efficient data organization, choosing between semantic or scene-based indexing. 2. **Querying**: Utilize `VideoDBRetriever` to retrieve relevant video segments and `llama-index` for constructing your RAG pipeline, enhancing your LLM's context with video-based insights. ## ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Support & Community -If you have any questions or feedback. +If you have any questions or feedback. Please feel free to reach out to us -- [Discord](https://discord.gg/py9P639jGz) -- [Github](https://github.com/video-db) -- [VideoDB](https://videodb.io) -- [Email](mailto:ashu@videodb.io) \ No newline at end of file +- [Discord](https://discord.gg/py9P639jGz) +- [Github](https://github.com/video-db) +- [VideoDB](https://videodb.io) +- [Email](mailto:ashu@videodb.io) diff --git a/llama-index-integrations/retrievers/llama-index-retrievers-videodb/pyproject.toml b/llama-index-integrations/retrievers/llama-index-retrievers-videodb/pyproject.toml index c05fb8adf4a85..b0b5c24878516 100644 --- a/llama-index-integrations/retrievers/llama-index-retrievers-videodb/pyproject.toml +++ b/llama-index-integrations/retrievers/llama-index-retrievers-videodb/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" +requires = ["poetry-core"] [tool.codespell] check-filenames = true @@ -25,14 +25,14 @@ ignore_missing_imports = true python_version = "3.8" [tool.poetry] -name = "llama-index-retrievers-videodb" -version = "0.1.0" -description = "llama-index VideoDB Retriever integration" authors = ["VideoDB "] -maintainers = ["Rohit Garg "] +description = "llama-index VideoDB Retriever integration" license = "MIT" +maintainers = ["Rohit Garg "] +name = "llama-index-retrievers-videodb" +packages = [{include = "llama_index/"}] readme = "README.md" -packages = [{ include = "llama_index/" }] +version = "0.1.0" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" @@ -40,8 +40,8 @@ llama-index-core = "^0.10.0" videodb = "^0.0" [tool.poetry.group.dev.dependencies] -black = { extras = ["jupyter"], version = "<=23.9.1,>=23.7.0" } -codespell = { extras = ["toml"], version = ">=v2.2.6" } +black = {extras = ["jupyter"], version = "<=23.9.1,>=23.7.0"} +codespell = {extras = ["toml"], version = ">=v2.2.6"} ipython = "8.10.0" jupyter = "^1.0.0" mypy = "0.991" @@ -55,5 +55,5 @@ types-Deprecated = ">=0.1.0" types-PyYAML = "^6.0.12.12" types-protobuf = "^4.24.0.4" types-redis = "4.5.5.0" -types-requests = "2.28.11.8" # TODO: unpin when mypy>0.991 +types-requests = "2.28.11.8" # TODO: unpin when mypy>0.991 types-setuptools = "67.1.0.0" diff --git a/llama-index-integrations/retrievers/llama-index-retrievers-videodb/tests/BUILD b/llama-index-integrations/retrievers/llama-index-retrievers-videodb/tests/BUILD index 053fd7535e919..dabf212d7e716 100644 --- a/llama-index-integrations/retrievers/llama-index-retrievers-videodb/tests/BUILD +++ b/llama-index-integrations/retrievers/llama-index-retrievers-videodb/tests/BUILD @@ -1 +1 @@ -python_tests() \ No newline at end of file +python_tests()