Skip to content

Commit

Permalink
feat: add README.md and requirements.txt to guide developers
Browse files Browse the repository at this point in the history
  • Loading branch information
AMK9978 committed Oct 30, 2024
1 parent 5af289d commit 7eaafa7
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: CI
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
lint:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort pytest
pip install -r requirements.txt
- name: Run black
run: black --check --line-length 120 .
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Basic Judge
A simple plugin that asks a local Llama to judge a prompt.

## Get Started
Run the app:

```
git clone [email protected]:LLMGuardian/BasicJudge.git
pip install -r requirements.txt
python src/app.py
```

Run the tests:

```PYTHONPATH=src pytest tests -v```


## Contribution
Don't forget to add tests to cover your code and format them first!

20 changes: 20 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
black==24.10.0
blinker==1.8.2
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
Flask==3.0.3
idna==3.10
isort==5.13.2
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==3.0.2
mypy-extensions==1.0.0
packaging==24.1
pathspec==0.12.1
platformdirs==4.3.6
requests==2.32.3
tomli==2.0.2
typing_extensions==4.12.2
urllib3==2.2.3
Werkzeug==3.0.6
10 changes: 5 additions & 5 deletions src/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import requests
from flask import Flask, jsonify, request

from src.postprocess import *
from src.preprocess import *
import postprocess
import preprocess

app = Flask(__name__)

Expand All @@ -16,7 +16,7 @@ def process_request():
400,
)

enriched_prompt = add_template(prompt=data["prompt"], chat=data["chat"])
enriched_prompt = preprocess.add_template(prompt=data["prompt"], chat=data["chat"])
# TODO: model name not be fixated and must be fetched from the DB
model_name = "llama3.1"
outgoing_payload = {"model": model_name, "prompt": enriched_prompt, "stream": False}
Expand All @@ -41,9 +41,9 @@ def process_request():
response_text = response_data.get("response", "")
# TODO: Log other parameters in the response
try:
result = process_response(result=response_text)
result = postprocess.process_response(result=response_text)
return jsonify({"status": result}), 200
except NumberNotFoundException:
except postprocess.NumberNotFoundException:
# TODO: Send the crude response back to the caller
return (
jsonify({"error": "Internal server error. No number in the range [0, 100] found in response"}),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from flask import json

from src.app import app
from app import app


class ProcessRequestTest(unittest.TestCase):
Expand Down

0 comments on commit 7eaafa7

Please sign in to comment.