Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
60 changes: 48 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Kubeflow users often struggle to find relevant information across the extensive

## Prerequisites

- [uv](https://docs.astral.sh/uv/) (Python package manager)
- Python 3.9+
- Kubernetes cluster (1.20+)
- Helm 3.x
- Kubeflow Pipelines
Expand Down Expand Up @@ -405,25 +407,47 @@ data: {"type": "done"}

**Critical**: Both APIs require SSL certificates from a trusted Certificate Authority. Without proper SSL certificates, browsers will block WebSocket connections and HTTPS requests.

#### Dependency Management (uv Workspaces)

The API servers (`server` and `server-https`) and pipelines are managed as members of a `uv` workspace defined in the root `pyproject.toml`.

- **To add a dependency to the WebSocket Server**:
```bash
uv add --package docs-agent-server <package-name>
```
- **To add a dependency to the HTTPS Server**:
```bash
uv add --package docs-agent-server-https <package-name>
```
- **Local Development**: Because they are workspace members, running `uv sync --all-packages` at the root will install dependencies for all APIs into a shared `.venv`.
- **Building Docker Images**: The Dockerfiles use `uv` internally for blazing-fast installs. You build them from the root directory by passing the member folder as the build context:
```bash
docker build -t docs-agent-server:latest server/
docker build -t docs-agent-server-https:latest server-https/
```

## Usage

### Starting the Services

1. **Deploy Milvus and KServe** (as described above)

2. **Run the Pipeline**:
2. **Install dependencies and activate the virtual environment**:
```bash
python pipelines/kubeflow-pipeline.py
uv sync --all-packages
source .venv/bin/activate
```

3. **Start the API Server**:
3. **Run the Pipeline and API Servers**:
```bash
# WebSocket API
python server/app.py
python pipelines/kubeflow-pipeline.py

# HTTPS API
python server-https/app.py
# API Servers
python server/app.py # WebSocket API
python server-https/app.py # HTTPS API
```

*(Note: You can also use `uv run python <script>` if you prefer not to activate the environment.)*

### API Usage Examples

Expand Down Expand Up @@ -681,11 +705,23 @@ We welcome contributions! Please see our [contributing guidelines](CONTRIBUTING.

### Development Setup

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
2. Fork and clone the repository
3. Install all dependencies and activate the virtual environment:
```bash
uv sync --all-packages
source .venv/bin/activate
```
4. Run any script normally:
```bash
python server/app.py
```
*(Alternatively, use `uv run python <script>`)*
5. To add a dependency to a specific component:
```bash
uv add --package docs-agent-server some-package
```
6. Create a feature branch, make your changes, and submit a pull request

## License

Expand Down
6 changes: 5 additions & 1 deletion pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ The pipelines download documentation from GitHub repositories, process the conte

### Usage

First, ensure your workspace virtual environment is activated (`source .venv/bin/activate`), then run:

```bash
python kubeflow-pipeline.py
python pipelines/kubeflow-pipeline.py
```
*(Alternatively, use `uv run python pipelines/kubeflow-pipeline.py`)*

### Parameters

Expand Down Expand Up @@ -369,6 +372,7 @@ print(f"Debug: Processing {len(file_paths_list)} files")

## Requirements

- [uv](https://docs.astral.sh/uv/) for dependency management (dependencies defined in `pyproject.toml`)
- Kubeflow Pipelines
- Milvus vector database
- GPU nodes (for embedding generation)
Expand Down
16 changes: 16 additions & 0 deletions pipelines/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "docs-agent-pipelines"
version = "0.1.0"
description = "Kubeflow Pipelines for RAG document indexing and embedding"
requires-python = ">=3.11"
dependencies = [
"kfp",
"requests",
"beautifulsoup4",
"sentence-transformers",
"langchain-text-splitters",
"torch",
"feast[milvus]",
"pandas",
"numpy",
]
9 changes: 0 additions & 9 deletions pipelines/requirements.txt

This file was deleted.

25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[project]
name = "docs-agent"
version = "0.1.0"
description = "Kubeflow Documentation AI Agent to power the Kubeflow Website"
readme = "README.md"
requires-python = ">=3.11"
dependencies = []

[tool.uv.workspace]
members = [
"server",
"server-https",
"pipelines",
]

# PyTorch CPU-only index — avoids downloading the ~2 GB CUDA wheel
[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[tool.uv.sources]
torch = { index = "pytorch-cpu" }
torchvision = { index = "pytorch-cpu" }
torchaudio = { index = "pytorch-cpu" }
12 changes: 8 additions & 4 deletions server-https/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM python:3.11-slim
FROM python:3.11-slim

COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Create non-root user
RUN useradd -m -u 1000 appuser
WORKDIR /app

# Install deps
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy dependency definition and install with uv
COPY pyproject.toml ./
RUN uv pip install --system --no-cache \
--extra-index-url https://download.pytorch.org/whl/cpu \
-r pyproject.toml

# Environment variables
ENV PORT=8000
Expand Down
15 changes: 15 additions & 0 deletions server-https/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "docs-agent-server-https"
version = "0.1.0"
description = "FastAPI HTTPS server for the Kubeflow Documentation Agent"
requires-python = ">=3.11"
dependencies = [
"fastapi",
"uvicorn[standard]",
"pydantic",
"httpx",
"pymilvus",
"sentence-transformers",
"torch",
"numpy",
]
8 changes: 0 additions & 8 deletions server-https/requirements.txt

This file was deleted.

10 changes: 7 additions & 3 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM python:3.11-slim

COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# Create non-root user
RUN useradd -m -u 1000 appuser
WORKDIR /app

# Install deps
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy dependency definition and install with uv
COPY pyproject.toml ./
RUN uv pip install --system --no-cache \
--extra-index-url https://download.pytorch.org/whl/cpu \
-r pyproject.toml

# Writable caches for HF/Transformers/Sentence-Transformers
ENV HF_HOME=/home/appuser/.cache/huggingface \
Expand Down
13 changes: 13 additions & 0 deletions server/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[project]
name = "docs-agent-server"
version = "0.1.0"
description = "WebSocket server for the Kubeflow Documentation Agent"
requires-python = ">=3.11"
dependencies = [
"websockets",
"httpx",
"pymilvus",
"sentence-transformers",
"torch",
"numpy",
]
13 changes: 0 additions & 13 deletions server/requirements.txt

This file was deleted.

Loading