Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel build
pip install -e ".[dev]"
pip install -e ".[dev,api]"

- name: Run test suite
run: |
Expand Down
69 changes: 69 additions & 0 deletions docs/STATIC_PLAYGROUND_DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# RepoNeedle V1.1.0 public demo deployment

This document describes the public demo deployment. It does not change the installation path for the core Python package.

## Components

| Component | Location | Purpose |
|---|---|---|
| Core engine | `reponeedle/` | CPU-first retrieval library and CLI |
| Static frontend | `hf_artifacts/static_space/` | Browser UI hosted by Hugging Face Static Spaces |
| Demo API | `api.py` | FastAPI wrapper exposing retrieval for the embedded demo corpora |
| Demo snapshots and bundled UI engine | `hf_artifacts/space/` | Small Flask and Requests snapshots and synchronized RepoNeedle package used by the API |
| Dataset | `hf_artifacts/dataset/` | Lightweight synthetic demonstration benchmark |

## Deploy the API on Render

Create a Web Service connected to this repository and use:

- Runtime: Python 3
- Branch: `main`
- Root directory: repository root (blank)
- Build command: `pip install -r requirements-api.txt`
- Start command: `uvicorn api:app --host 0.0.0.0 --port $PORT`
- Health check path: `/health`
- Instance: Free (optional; subject to provider limits)

The API imports the embedded corpora and engine from `hf_artifacts/space/`. Do not remove that directory while deploying this backend.

Verify `https://YOUR-SERVICE.onrender.com/health`. A healthy response is:

```json
{"status":"ok","service":"reponeedle-demo-api","version":"1.1.0"}
```

## Deploy the frontend on Hugging Face

Create a public Static Space. Upload the contents of `hf_artifacts/static_space/` to the Space root. The `README.md` front matter must retain `sdk: static`.

The UI defaults to `https://reponeedle.onrender.com`. Users can change the Backend API URL field and click **Connect API** to use another deployment.

## API contract

- `GET /` returns service metadata and a scope disclosure.
- `GET /health` is the health check.
- `POST /api/retrieve` accepts `repo_name`, `ranker`, `task_mode`, `budget_tokens`, `seed_files`, and `query`.
- Supported demo repositories: `pallets/flask`, `psf/requests`.
- Supported rankers: `legacy` (default), `change_impact`.
- The API validates query length, budget limits, repository choice, and seed count using Pydantic.

## Limitations and security boundaries

- This is a public, unauthenticated demonstration API. Do not send secrets, proprietary source code, or personal data.
- CORS is open so the public Hugging Face frontend can call the API. This is not an authentication or abuse-prevention control.
- The API only retrieves from the two embedded demonstration snapshots. It does not index arbitrary repositories or expose a general upload endpoint.
- The API does not persist visitor queries. Its in-memory caches reset when the service restarts.
- Free hosting may sleep after inactivity and has limited CPU/RAM. Cold starts and request latency can vary.
- The dataset is a small synthetic demo dataset, not the complete Agent Retrieval Bench v2 corpus.
- Selective abstention is experimental and should not be presented as reliable; see `KNOWN_LIMITATIONS.md`.

## Local development and tests

Install the package and development/API test extras:

```bash
pip install -e ".[dev,api]"
pytest -q
```

The API tests use FastAPI's `TestClient` and the public-demo corpus shipped with the repository.
6 changes: 5 additions & 1 deletion hf_artifacts/space/reponeedle/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ def retrieve(
workflow_boosts = np.zeros(num_docs, dtype=np.float32)

elif effective_ranker == "change_impact":
inferred_task = query_obj.task_type or TaskType.COMMENT2CONTEXT
if query_obj.task_type == TaskType.AUTO:
inferred_task, _ = self.router.classify_intent(query_obj)
else:
inferred_task = query_obj.task_type

ci_cfg = change_impact_config or getattr(self, "change_impact_config", None) or ChangeImpactConfig()
ranked_indices, fused_scores, impact_exps = self.change_impact_ranker.rank_with_scores(
self.docs, lex_scores, sem_scores, query_obj, config_override=ci_cfg
Expand Down
29 changes: 29 additions & 0 deletions hf_artifacts/static_space/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: RepoNeedle Playground
emoji: 🪡
colorFrom: blue
colorTo: indigo
sdk: static
pinned: false
license: mit
---

# RepoNeedle Playground (V1.1.0)

This is the static browser interface for the RepoNeedle V1.1.0 public demonstration. It calls a separately hosted FastAPI service; the static Space does not execute the Python retrieval engine itself.

**Live backend:** `https://reponeedle.onrender.com`
**Source repository:** https://github.com/krishika08/RepoNeedle
**Dataset:** https://huggingface.co/datasets/RepoNeedle/RepoNeedle-Bench

## Demonstration scope

The public Playground uses small embedded demonstration snapshots for `pallets/flask` and `psf/requests`. It does not clone arbitrary GitHub repositories, accept repository uploads, or reproduce the complete ARB v2 evaluation. Benchmark results described in the source repository were obtained in separate documented evaluations; this web demo is not itself a benchmark reproduction.

The browser sends retrieval requests to the public API. Queries are processed in memory and are not persisted by the demo API. The API is unauthenticated and intended for demonstration use, not production workloads. The free backend may sleep after inactivity, causing a cold-start delay.

## Reproducing the Space

Upload `README.md` and `index.html` from this directory to a Hugging Face Space with the **Static** SDK. The interface is preconfigured with the public demo API URL; users can change the URL to point to their own deployment.

See [deployment guide](https://github.com/krishika08/RepoNeedle/blob/main/docs/STATIC_PLAYGROUND_DEPLOYMENT.md) in the GitHub repository for backend deployment and configuration instructions.
Loading
Loading