Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c9142be
chore(docs): replace pip install with uv sync instructions
palaniappan-r Aug 26, 2025
0b88125
refactor(Makefile): rewrite setup and checks to use uv
palaniappan-r Aug 26, 2025
2b41125
refactor: use uv in dockerfiles
palaniappan-r Aug 26, 2025
badbfca
chore: update readme
palaniappan-r Aug 26, 2025
013e8b4
chore: install uv in Dockerfiles
palaniappan-r Aug 26, 2025
8f2f200
refactor(ci): install uv in CI workflow
palaniappan-r Aug 26, 2025
00d20a3
fix: update mypy version to >=1.17.1 in pyproject.toml and uv.lock
palaniappan-r Aug 26, 2025
06ec42d
chore: update pytest ini_options
palaniappan-r Aug 26, 2025
4029c3b
chore: update base image to python:3.13.5-slim in Dockerfiles
palaniappan-r Aug 26, 2025
6d059b3
refactor: update Dockerfiles to use pre-built uv images
palaniappan-r Aug 28, 2025
6d09264
refactor(ci): simplify uv installation in CI workflow
palaniappan-r Aug 28, 2025
f8f7b5f
fix: update command to run chatbot script in README
palaniappan-r Aug 28, 2025
e796c39
fix: use uv run in post_install script execution
palaniappan-r Aug 28, 2025
f07e5bd
Merge branch 'master' into uv-deps
palaniappan-r Sep 7, 2025
2c1a021
chore: update dependencies for mcp functionality
palaniappan-r Sep 7, 2025
331e5d0
fix: update type hint for ORFS_DIR environment variable to Optional[str]
palaniappan-r Sep 7, 2025
44d1ddf
fix: update graph type hint to use Optional
palaniappan-r Sep 7, 2025
8995d07
ruff: fix formatting
palaniappan-r Sep 7, 2025
19e1fa6
feat: use uv in all make targets
palaniappan-r Sep 7, 2025
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
10 changes: 9 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,29 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Checkout code
uses: actions/checkout@v4

- name: Setup prereqs
run: |
make init-dev

- name: Run formatting checks
run: |
make check

- name: Run unit tests
working-directory: backend
run: |
pip install huggingface_hub[cli]
uv pip install huggingface_hub[cli]
huggingface-cli download --repo-type dataset The-OpenROAD-Project/ORAssistant_RAG_Dataset --include source_list.json --local-dir data/
export GOOGLE_API_KEY="dummy-unit-test-key"
make test

- name: Build Docker images
run: |
docker compose build
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ The current architecture uses certain retrieval techniques on OpenROAD documenta

## Components

We have divided our app into three components, each of which can be hosted on a separate machine for scalability.
We have divided our app into three components, each of which can be hosted on a separate machine for scalability.

- Backend: Generates the necessary chat endpoints for users to communicate with.
- Frontend: We use Streamlit to communicate with a chat endpoint, providing a user-friendly chat interface.
- Evaluation: Besides the vanilla chat interface, we also have a human evaluation interface for research and development.

## Setup

This setup involves the setting of both the frontend and backend components. We shall begin with backend:
This setup involves the setting of both the frontend and backend components. We shall begin with backend:

### Backend Setup

Expand All @@ -40,7 +41,7 @@ git clone https://github.com/The-OpenROAD-Project/ORAssistant.git

Modify the Docker `HEALTHCHECK_` variables based on the hardware requirements.
If you have a resource-constrained PC, try increasing `HEALTHCHECK_START_PERIOD` to a value large
enough before healthcheck begins.
enough before healthcheck begins.
For more information, please refer to this [link](https://docs.docker.com/reference/compose-file/services/#healthcheck)

```bash
Expand All @@ -57,16 +58,17 @@ make docker-down

#### Option 2 - Local Install

Prerequisites:
- `Python 3.12`, recommended using a virtual environment like `conda`.
- `wget`
- `pandoc`
### Prerequisites

- [`uv`](https://docs.astral.sh/uv/) (for managing Python, virtual environments, and dependencies)
- `wget`
- `pandoc`
- `git`

**Step 1**: Install the required dependencies.

```bash
pip install -r backend/requirements.txt
```bash
uv sync
```

**Step 2**: Copy the `.env.example` file, and update your `.env` file with the appropriate API keys.
Expand Down Expand Up @@ -98,7 +100,7 @@ python main.py
python chatbot.py
```

The backend will then be hosted at [http://0.0.0.0:8000](http://0.0.0.0:8000).
The backend will then be hosted at [http://0.0.0.0:8000](http://0.0.0.0:8000).

Open [http://0.0.0.0:8000/docs](http://0.0.0.0:8000/docs) for the API docs.

Expand Down Expand Up @@ -127,7 +129,7 @@ streamlit run streamlit_app.py

## Architecture Overview

OpenROAD documentation, OpenROAD-flow-scripts documentation, manpages and OpenSTA documentation is chunked and embedded into FAISS Vector Databases.
OpenROAD documentation, OpenROAD-flow-scripts documentation, manpages and OpenSTA documentation is chunked and embedded into FAISS Vector Databases.

Documents are first retrieved from the vectorstore using a hybrid retriever, combining vector and semantic search methods. These retrieved documents undergo re-ranking using a cross-encoder re-ranker model.

Expand All @@ -145,9 +147,10 @@ flowchart LR

id5([Reranking]) ---> id6(top-n docs)

```
```

Depending on the input query, each query can be forwarded to any one of the following retrievers,

1. General OR/ORFS information
2. OR tools and commands
3. OR/ORFS installation
Expand Down Expand Up @@ -195,7 +198,7 @@ make check

## Acknowledgements

This work is completed as part of the Google Summer of Code 2024 project under the
This work is completed as part of the Google Summer of Code 2024 project under the
[UCSC Open-Source Program Office](https://ucsc-ospo.github.io/osre24/).
Please see their contributions at this [link](https://github.com/The-OpenROAD-Project/ORAssistant/wiki/Google-Summer-of-Code-2024).

Expand Down
1 change: 1 addition & 0 deletions backend/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
22 changes: 6 additions & 16 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
FROM python:3.12.3-slim
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

WORKDIR /ORAssistant-backend

RUN apt-get update && apt-get install -y \
pandoc git wget curl \
git-lfs
RUN apt-get update && apt-get install -y pandoc git wget curl git-lfs && git lfs install

RUN git lfs install
RUN pip install uv

COPY ./requirements.txt /ORAssistant-backend/requirements.txt
COPY ./requirements-test.txt /ORAssistant-backend/requirements-test.txt
COPY ./pyproject.toml /ORAssistant-backend/pyproject.toml
COPY . .

RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir -r requirements-test.txt && \
pip install --no-cache-dir -e .
RUN uv venv .venv && uv sync --dev && uv run /ORAssistant-backend/src/post_install.py

RUN git clone https://huggingface.co/datasets/The-OpenROAD-Project/ORAssistant_RAG_Dataset && \
mkdir -p data && \
mv ORAssistant_RAG_Dataset/* data/ && \
rm -rf ORAssistant_RAG_Dataset

COPY . .

RUN python /ORAssistant-backend/src/post_install.py

EXPOSE 8000

CMD ["uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
CMD ["uv", "run", "uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
16 changes: 8 additions & 8 deletions backend/Dockerfile_slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12.3-slim
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

WORKDIR /ORAssistant-backend

Expand All @@ -7,20 +7,20 @@ RUN apt-get update && apt-get install -y \
git-lfs

RUN git lfs install
RUN pip install uv

COPY ./requirements.txt /ORAssistant-backend/requirements.txt
COPY ./pyproject.toml /ORAssistant-backend/pyproject.toml
COPY . .

RUN pip install --upgrade -r /ORAssistant-backend/requirements.txt
RUN uv venv .venv && \
uv sync --dev && \
uv run /ORAssistant-backend/src/post_install.py

RUN git clone https://huggingface.co/datasets/The-OpenROAD-Project/ORAssistant_RAG_Dataset && \
mkdir -p data && \
mv ORAssistant_RAG_Dataset/* data/ && \
rm -rf ORAssistant_RAG_Dataset

COPY . .

RUN python /ORAssistant-backend/src/post_install.py

EXPOSE 8000

CMD ["uvicorn", "src.api.dummy:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["uv", "run", "uvicorn", "src.api.dummy:app", "--host", "0.0.0.0", "--port", "8000"]
35 changes: 13 additions & 22 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
.PHONY: init
init:
@python3 -m venv .venv && \
. .venv/bin/activate && \
pip install -r requirements.txt && \
pip install -e .
@uv venv .venv && \
uv sync

.PHONY: init-dev
init-dev: init
@. .venv/bin/activate && \
pip install -r requirements-test.txt
init-dev:
@uv venv .venv && \
uv sync --dev

.PHONY: format
format:
@. .venv/bin/activate && \
ruff format && \
ruff check --fix
@uv run ruff format && \
uv run ruff check --fix

.PHONY: check
check:
@. .venv/bin/activate && \
mypy . && \
ruff check
@uv run mypy . && \
uv run ruff check

.PHONY: build-docs
build-docs:
@. .venv/bin/activate && \
python build_docs.py
@uv run python build_docs.py

.PHONY: test
test:
@. .venv/bin/activate && \
pytest
@uv run pytest

# For MCP Development
.PHONY: mcp
mcp:
@. .venv/bin/activate && \
python -m src.openroad_mcp.server.orfs.orfs_server
@uv run python -m src.openroad_mcp.server.orfs.orfs_server

.PHONY: chat
chat:
@. .venv/bin/activate && \
python -m chatbot
@uv run python -m chatbot
10 changes: 8 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,19 @@ Provide the value for `HF_TOKEN` with the token that is generated

## Running the Application

To use that chatbot in a text-based in your terminal, use the `chatbot.py` script:
```python
uv run chatbot.py
```

### Install Required Packages

Ensure you have the necessary dependencies installed by running:
Install dependencies defined in `pyproject.toml` with:

```bash
pip install -r requirements.txt
uv sync
```

### Docker Command

If you want to run an isolated container for backend, you can use the following command
Expand Down
Loading