Skip to content

Commit

Permalink
reformat code and detailed instruction for the agent
Browse files Browse the repository at this point in the history
  • Loading branch information
codeAshu committed Jan 21, 2024
1 parent 063ac78 commit cf2125f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 19 deletions.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<img src="https://codaio.imgix.net/docs/_s5lUnUCIU/blobs/bl-RgjcFrrJjj/d3cbc44f8584ecd42f2a97d981a144dce6a66d83ddd5864f723b7808c7d1dfbc25034f2f25e1b2188e78f78f37bcb79d3c34ca937cbb08ca8b3da1526c29da9a897ab38eb39d084fd715028b7cc60eb595c68ecfa6fa0bb125ec2b09da65664a4f172c2f" alt="Logo" width="300" height="">
</a>

<h3 align="center">StreamRAG 🎥</h3>
<h3 align="center">StreamRAG 🎥</h3>

<p align="center">
Your Go-To Video Search Agent 🕵️‍♂️
Expand All @@ -33,50 +33,63 @@
</p>

<!-- ABOUT THE PROJECT -->

# StreamRAG: GPT-Powered Video Retrieval & Streaming 🚀

## What does it do? 🤔

It enables developers to:

* 📚 Upload multiple videos to create a library or collection.
* 🔍 Search across these videos and get real-time video responses or compilations.
* 🛒 Publish your searchable collection on the ChatGPT store.
* 📝 Receive summarized text answers (RAG).
* 🌟 Gain key insights from specific videos (like e31).

## How do I use it? 🛠️
- **Get your API key:** Sign up on [VideoDB console](https://console.videodb.io) (Free for the first 50 uploads, no credit card required). 🆓

- **Get your API key:** Sign up on [VideoDB console](https://console.videodb.io) (Free for the first 50 uploads, no
credit card required). 🆓
- **Set `VIDEO_DB_API_KEY`:** Enter your key in the `env` file.
- **Install dependencies:** Run `pip install -r requirements.txt` in your terminal.
- **Upload your collection to VideoDB:** Add your links in `upload.py`.
- **Run locally:** Start the flask server with `python app.py`.

## Publishing on ChatGPT Store 🏪
1. Deploy your flask server and note your server's `url`. For instance, you can use our public MoZ podcast server (replace with your Spext server details).

1. Deploy your flask server and note your server's `url`. For instance, you can use our public MoZ podcast server (
replace with your Spext server details).
2. In `openapi.yaml`, update the `url` field under `server`.
3. Visit the GPT builder at https://chat.openai.com/gpts/editor
4. In the configure tab, add your GPT's `Name` and `Description`.
5. Copy the prompt from `prompts.txt` into the `Instructions` field. Feel free to modify it as needed. ✏️
6. Click on `Create new Action`
7. Copy the openapi details from `openapi.yaml` Don't miss to update the `url` field.
7. Copy the openapi details from `openapi.yaml` Don't miss to update the `url` field.
8. Save your GPT for personal use and give it a test run! 🧪

---
<!-- ROADMAP -->

## Roadmap 🛣️
1. Add support for popular backend deployment CD pipelines like `Heroku`, `Replit`, etc.
2. Integrate with other data sources like `Dropbox`, `Google Drive`.

1. Add support for popular backend deployment CD pipelines like `Heroku`, `Replit`, etc.
2. Integrate with other data sources like `Dropbox`, `Google Drive`.
3. Connect with meeting recorder APIs such as `Zoom`, `Teams`, and `Recall.ai`.

---
<!-- CONTRIBUTING -->

## Contributing 🤝
Your contributions make the open-source community an incredible place for learning, inspiration, and creativity. We welcome and appreciate your input! Here's how you can contribute:

Your contributions make the open-source community an incredible place for learning, inspiration, and creativity. We
welcome and appreciate your input! Here's how you can contribute:

- Open issues to share your use cases.
- Participate in brainstorming solutions for our roadmap.
- Suggest improvements to the codebase.

### Contribution Steps

1. Fork the Project 🍴
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
Expand All @@ -87,13 +100,22 @@ Your contributions make the open-source community an incredible place for learni

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[pypi-shield]: https://img.shields.io/pypi/v/videodb?style=for-the-badge

[pypi-url]: https://pypi.org/project/videodb/

[python-shield]:https://img.shields.io/pypi/pyversions/videodb?style=for-the-badge

[stars-shield]: https://img.shields.io/github/stars/video-db/videodb-python.svg?style=for-the-badge

[stars-url]: https://github.com/video-db/streamRAG/stargazers

[issues-shield]: https://img.shields.io/github/issues/video-db/videodb-python.svg?style=for-the-badge

[issues-url]: https://github.com/video-db/streamRAG/issues

[website-shield]: https://img.shields.io/website?url=https%3A%2F%2Fvideodb.io%2F&style=for-the-badge&label=videodb.io

[website-url]: https://videodb.io/

7 changes: 4 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os

from dotenv import load_dotenv
from flask import Flask, request
from flask_cors import CORS
from videodb import connect, SearchError
import os

from dotenv import load_dotenv
load_dotenv()

# Flask config
Expand Down Expand Up @@ -94,4 +95,4 @@ def search_videos():


if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080, debug=True)
app.run(host='0.0.0.0', port=8080, debug=True)
25 changes: 20 additions & 5 deletions prompts.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
You are video search assistant, adept at handling video-related tasks with a casual tone. This step-by-step approach ensures
a comprehensive and user-friendly response to video search requests, combining visual and textual information effectively.
- When a user asks you to search, your first step is to identify if the request has a search query. If you can identify

When a user asks you to search or find information, your first step is to identify if the request has a search query. If you can identify
the search query, call the action `search` with the provided query. The action will return a compilation video and a
list of related videos segments from the library. Each video has fields `title`, `id`, `link`, `text`.
You would show compilation video directly to the user. You can use the video list from response if needed.
You would analyze the user's query and use the related `text` chunks to summarize the results in a concise, informative manner,
tailored to the user's need and preference.
Analyse the `text` for answering according to this logic:
1. If the user would be satisfied using a very short & direct response, include just the text response. Leave the rest of the response out.
2. If the user query is about a topic, then include a text response, follow-up questions and reference videos list. Leave the rest of the response out.
3. If the user query is broad in nature, or involves multiple questions, then include the full response- including text response, follow-up questions, AI-Assisted Actions and Suggested Next Steps.
4. If the user query is strictly action-oriented, then return just the text response and AI-Assisted Actions. Leave the rest of the response out.
5. If not much relevant information is found across the videos, then return a message stating that no relevant information was found in the content,
along with some general follow-up questions related to content.

If the results are relevent,You would show compilation video directly to the user. You can use the video list from response if needed.You would analyze the user's query and use the related `text` chunks to summarize the results in following fashion:
1.Return a concise, bullet-pointed response.
2.The response should include relevant information about the topic based on media.
3.If the response includes a lot of details, return only a short text answer.
4.If there are enough and accurate reference videos, include them as links in a separate bullet-pointed list titled 'Reference Videos:'.
Limit these to the top 5 reference videos.
5.In addition, provide follow-up actions that the AI can assist with, such as researching more about the topic or drafting related content.
These should be presented as a short bullet-pointed list titled 'AI-Assisted Actions:'.

To complete other tasks:
- You can get list of all videos by calling action videos and show videos which user needs. user can pick one of the video.
- You can get data of individual video by calling action video/{id} to fetch more details about a video for example transcript,
thumbnail etc.
If you don’t know what id of the video user referring to, get all videos first and confirm the video
from user and follow instruction.
from user and follow instructions.
8 changes: 4 additions & 4 deletions upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@


def bulk_upload():
#Read VideoDB API key from env and create a connection
# Read VideoDB API key from env and create a connection
conn = connect()
# Get a collection
coll = conn.get_collection()
# Upload Videos to a collection
# Upload Videos to a collection checkout https://docs.videodb.io for more upload functions
coll.upload(url="https://www.youtube.com/watch?v=lsODSDmY4CY")
coll.upload(url="https://www.youtube.com/watch?v=vZ4kOr38JhY")
coll.upload(url="https://www.youtube.com/watch?v=uak_dXHh6s4")
#ADD more to index for StreamRAG agent
# ADD more to index for StreamRAG agent

for video in coll.get_videos():
video.index_spoken_words()
print(f"Indexed {video.name}")

#run bulk upload.
# run bulk upload fn.

0 comments on commit cf2125f

Please sign in to comment.