Skip to content

Commit

Permalink
Merge pull request #39 from video-db/gh-action
Browse files Browse the repository at this point in the history
Add actions for doc deployment and setup, README.md update etc.
  • Loading branch information
ashish-spext authored Oct 29, 2024
2 parents 6902ff0 + 8dbdfea commit 7af09c0
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 62 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Publish Sphinx Docs

on:
push:
branches: [main]

workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.12"

- name: Install dependencies
run: |
cd backend
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Build and Publish HTML
run: |
source backend/venv/bin/activate
mkdocs gh-deploy --force
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ venv
*.egg-info
package-lock.json
*.mjs
site/*
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->

[![NPM version][npm-shield]][npm-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![Website][website-shield]][website-url]
[![Discord][discord-shield]][discord-url]

<!-- PROJECT LOGO -->
![logo](https://github.com/user-attachments/assets/583f9ce3-d972-4706-8251-1a0bcd060099)
<img src="https://github.com/user-attachments/assets/78f5eead-d390-4b0b-a8bc-0017e6827c98" alt="logo">

<p align="center">
<p align="center">
<a href="https://render.com/deploy?repo=https://github.com/video-db/Director" target="_blank" rel="nofollow"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render"></a>
Expand All @@ -25,12 +25,14 @@
<p align="center">
Framework for creating AI agents to manage and interact with your media library.
<br />
<a href="https://stackblitz.com/edit/videodb-player-demo-pxy8k7?file=src%2FApp.vue"><strong>View Demo »</strong></a>
<a href="https://codesandbox.io/p/sandbox/nifty-mendeleev-tnxpnt"><strong>View Demo »</strong></a>
<br />
<br />
<a href="https://github.com/video-db/Director/issues">Report Bug</a>
<a href="https://github.com/video-db/Director/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Report Bug</a>
·
<a href="https://github.com/video-db/Director/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Request Feature</a>
·
<a href="https://github.com/video-db/Director/issues">Request Feature</a>
<a href="https://github.com/video-db/Director/issues/new?assignees=&labels=enhancement&projects=&template=agent_request.yml">New Agent Request</a>
</p>
</p>

Expand Down Expand Up @@ -59,7 +61,8 @@ https://github.com/user-attachments/assets/8b97a9bf-5c81-4a0d-8863-9415552eba57
- **🎨 Innovative User Experience:** Complete framework for interacting with your media library with chat based UI, Video player and next-gen interactions that can help you create the experience you need.
- **🔍 Media Analysis:** Your video infra is taken care by [VideoDB](https://videodb.io). Connect with popular LLMs, Databases, and GenAI APIs seamlessly.
- **🧩 Extensible Architecture:** Easily add new capabilities through tools and modules. Run locally or deploy on your own cloud.
![director_architecture](https://github.com/user-attachments/assets/075509bb-baaf-45f5-8dc8-06577a12cd94)
![Director architecture](https://github.com/user-attachments/assets/9afb2783-66db-4899-9308-03cbd12e74d7)




Expand Down Expand Up @@ -181,8 +184,6 @@ Contributions are what make the open source community such an amazing place to b
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[npm-shield]: https://img.shields.io/npm/v/@videodb/player-vue?style=for-the-badge
[npm-url]: https://www.npmjs.com/package/@videodb/player-vue
[discord-shield]: https://img.shields.io/badge/dynamic/json?style=for-the-badge&url=https://discord.com/api/invites/py9P639jGz?with_counts=true&query=$.approximate_member_count&logo=discord&logoColor=blue&color=green&label=discord
[discord-url]: https://discord.com/invite/py9P639jGz
[stars-shield]: https://img.shields.io/github/stars/video-db/Director.svg?style=for-the-badge
Expand Down
1 change: 1 addition & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ VIDEO_DB_API_KEY=

# LLM Integrations
OPENAI_API_KEY=
ANTHROPIC_API_KEY=

# Tools
REPLICATE_API_TOKEN=
Expand Down
16 changes: 8 additions & 8 deletions backend/director/agents/slack_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
class SlackAgent(BaseAgent):
def __init__(self, session: Session, **kwargs):
self.agent_name = "slack"
self.description = "Messages to a Slack channel"
self.description = "Messages to a slack channel"
self.parameters = self.get_parameters()
self.llm = OpenAI()
super().__init__(session=session, **kwargs)

def run(self, message: str, *args, **kwargs) -> AgentResponse:
"""
Send a message to a Slack channel.
:param str message: The message to send to the Slack channel_name.
Send a message to a slack channel.
:param str message: The message to send to the slack channel_name.
:param args: Additional positional arguments.
:param kwargs: Additional keyword arguments.
:return: The response containing information about the Slack message operation.
:return: The response containing information about the slack message operation.
:rtype: AgentResponse
"""
channel_name = os.getenv("SLACK_CHANNEL_NAME")
Expand All @@ -50,7 +50,7 @@ def run(self, message: str, *args, **kwargs) -> AgentResponse:
text_content = TextContent(
agent_name=self.agent_name,
status=MsgStatus.progress,
status_message="Sending message to Slack...",
status_message="Sending message to slack..",
)
self.output_message.content.append(text_content)
self.output_message.push_update()
Expand All @@ -69,7 +69,7 @@ def run(self, message: str, *args, **kwargs) -> AgentResponse:
if llm_response.status == LLMResponseStatus.ERROR:
raise Exception(f"LLM Failed with error {llm_response.content}")
formatted_message = llm_response.content
self.output_message.actions.append("Sending message to Slack...")
self.output_message.actions.append("Sending message to slack..")
response = send_message_to_channel(formatted_message, channel_name)
text_content.text = formatted_message
text_content.status = MsgStatus.success
Expand All @@ -79,7 +79,7 @@ def run(self, message: str, *args, **kwargs) -> AgentResponse:
self.output_message.publish()
return AgentResponse(
status=AgentStatus.SUCCESS,
message=f"Message sent to Slack channel: {channel_name}",
message=f"Message sent to slack channel: {channel_name}",
data={
"channel_name": channel_name,
"message": formatted_message,
Expand All @@ -89,7 +89,7 @@ def run(self, message: str, *args, **kwargs) -> AgentResponse:
except Exception as e:
logger.exception(f"Error in {self.agent_name}")
text_content.status = MsgStatus.error
text_content.status_message = f"Error sending message to Slack: {str(e)}"
text_content.status_message = f"Error sending message to slack: {str(e)}"
self.output_message.publish()
error_message = f"Agent failed with error: {str(e)}"
return AgentResponse(status=AgentStatus.ERROR, message=error_message)
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
director.videodb.io
Binary file modified docs/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions docs/hooks/copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from datetime import datetime


def on_config(config, **kwargs):
config.copyright = f"Copyright © {datetime.now().year} VideoDB"
9 changes: 5 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
site_name: ""


repo_url: https://github.com/video-db/videodb-python
repo_name: videodb-db/videodb-python
copyright: © videodb.io. 2024
repo_url: https://github.com/video-db/Director
repo_name: videodb-db/Director
extra:
generator: True

Expand Down Expand Up @@ -93,7 +92,6 @@ nav:
plugins:
- search
- offline
# - git-authors
- autorefs
- mkdocstrings:
handlers:
Expand Down Expand Up @@ -123,6 +121,9 @@ plugins:
enable_creation_date: true
fallback_to_build_date: true

hooks:
- docs/hooks/copyright.py

markdown_extensions:
- abbr
- admonition
Expand Down
93 changes: 51 additions & 42 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,46 +153,57 @@ install_dependency() {

install_python_and_pip() {
if command -v python3 &> /dev/null; then
echo "✅ Python 3 is already installed."
else
package_manager=$(detect_package_manager)
if [ $? -eq 0 ]; then
case $package_manager in
apt)
# For Debian/Ubuntu
sudo apt update
sudo apt install -y python3 python3-pip python3-venv
;;
yum)
# For CentOS/RHEL
sudo yum install -y python3 python3-pip python3-virtualenv
;;
dnf)
# For Fedora
sudo dnf install -y python3 python3-pip python3-virtualenv
;;
pacman)
# For Arch Linux
sudo pacman -Sy --noconfirm python python-pip python-virtualenv
;;
zypper)
# For OpenSUSE
sudo zypper install -y python3 python3-pip python3-virtualenv
;;
brew)
# For macOS using Homebrew
export HOMEBREW_NO_AUTO_UPDATE=1
brew install python
;;
*)
echo "❌ Unsupported package manager: $package_manager"
return 1
;;
esac
echo "✅ Python 3, pip, and virtual environment packages have been successfully installed!"
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')
REQUIRED_VERSION="3.9"

# Check if Python version is at least 3.9
if [[ $(echo -e "$PYTHON_VERSION\n$REQUIRED_VERSION" | sort -V | head -n1) == "$REQUIRED_VERSION" ]]; then
echo "✅ Python 3 (version $PYTHON_VERSION) is already installed and meets the required version."
return 0
else
echo "Package manager detection failed: $package_manager"
echo "Current Python version ($PYTHON_VERSION) is less than the required 3.9, trying to upgrade it.."
fi
else
echo "❌ Python 3 is not installed."
fi
echo "⚙️ Attempting to install Python 3.9 or higher..."
package_manager=$(detect_package_manager)
if [ $? -eq 0 ]; then
case $package_manager in
apt)
# For Debian/Ubuntu
sudo apt update
sudo apt install -y python3 python3-pip python3-venv
;;
yum)
# For CentOS/RHEL
sudo yum install -y python3 python3-pip python3-virtualenv
;;
dnf)
# For Fedora
sudo dnf install -y python3 python3-pip python3-virtualenv
;;
pacman)
# For Arch Linux
sudo pacman -Sy --noconfirm python python-pip python-virtualenv
;;
zypper)
# For OpenSUSE
sudo zypper install -y python3 python3-pip python3-virtualenv
;;
brew)
# For macOS using Homebrew
export HOMEBREW_NO_AUTO_UPDATE=1
brew install python
;;
*)
echo "❌ Unsupported package manager: $package_manager"
return 1
;;
esac
echo "✅ Python 3, pip, and virtual environment packages have been successfully installed!"
else
echo "❌ Package manager detection failed: $package_manager"
fi

# Check for pip and venv separately as they might not be included with Python
Expand Down Expand Up @@ -239,8 +250,6 @@ read VIDEO_DB_API_KEY
echo "📝 Creating .env file with provided API keys..."
cat <<EOT > .env
VIDEO_DB_API_KEY=$VIDEO_DB_API_KEY
VIDEO_DB_BASE_URL=https://api.videodb.io
FLASK_APP=director/entrypoint/api/server.py
EOT
cd ..

Expand Down Expand Up @@ -271,9 +280,9 @@ make update-fe
echo "
*******************************************
* *
* 🎉 Setup Completed Successfully! 🎉 *
* 🎉 Setup Completed Successfully! 🎉 *
* *
* 🚀 IMPORTANT: Next Steps 🚀 *
* 🚀 IMPORTANT: Next Steps 🚀 *
* *
* 1. Review and Update .env File: *
* - Check the newly created .env file *
Expand Down

0 comments on commit 7af09c0

Please sign in to comment.