Spaces:
Sleeping
Sleeping
Commit Β·
c5a9938
1
Parent(s): 6bb2baa
code has been reformated as per the openenv validation
Browse files- Dockerfile +1 -1
- pyproject.toml +4 -0
- server/__init__.py +0 -0
- app.py β server/app.py +13 -4
- config.py β server/config.py +0 -0
- data.py β server/data.py +0 -0
- environment.py β server/environment.py +2 -3
- uv.lock +0 -0
Dockerfile
CHANGED
|
@@ -8,5 +8,5 @@ RUN python -c "import nltk; nltk.download('vader_lexicon', quiet=True); nltk.dow
|
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
EXPOSE 7860
|
| 11 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 12 |
|
|
|
|
| 8 |
|
| 9 |
COPY . .
|
| 10 |
EXPOSE 7860
|
| 11 |
+
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 12 |
|
pyproject.toml
CHANGED
|
@@ -14,8 +14,12 @@ dependencies = [
|
|
| 14 |
"python-multipart>=0.0.22",
|
| 15 |
"pyyaml>=6.0.3",
|
| 16 |
"starlette>=1.0.0",
|
|
|
|
| 17 |
]
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
[build-system]
|
| 20 |
requires = ["hatchling"]
|
| 21 |
build-backend = "hatchling.build"
|
|
|
|
| 14 |
"python-multipart>=0.0.22",
|
| 15 |
"pyyaml>=6.0.3",
|
| 16 |
"starlette>=1.0.0",
|
| 17 |
+
"openenv-core>=0.2.0",
|
| 18 |
]
|
| 19 |
|
| 20 |
+
[project.scripts]
|
| 21 |
+
server = "server.app:main"
|
| 22 |
+
|
| 23 |
[build-system]
|
| 24 |
requires = ["hatchling"]
|
| 25 |
build-backend = "hatchling.build"
|
server/__init__.py
ADDED
|
File without changes
|
app.py β server/app.py
RENAMED
|
@@ -3,12 +3,12 @@ from dotenv import load_dotenv
|
|
| 3 |
load_dotenv()
|
| 4 |
|
| 5 |
from fastapi import FastAPI, HTTPException
|
| 6 |
-
from models import Action, Observation, StepResult
|
| 7 |
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
-
from
|
|
|
|
| 12 |
|
| 13 |
app = FastAPI(title="Sieve")
|
| 14 |
app.add_middleware(
|
|
@@ -77,3 +77,12 @@ def grader():
|
|
| 77 |
for action in env.episode_actions
|
| 78 |
],
|
| 79 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
load_dotenv()
|
| 4 |
|
| 5 |
from fastapi import FastAPI, HTTPException
|
|
|
|
| 6 |
from fastapi.middleware.cors import CORSMiddleware
|
| 7 |
|
| 8 |
+
from models import Action, Observation, StepResult
|
| 9 |
+
from .config import ACTION_SCHEMA
|
| 10 |
+
from .data import TASK_CONFIGS
|
| 11 |
+
from .environment import EmailSortingEnvironment
|
| 12 |
|
| 13 |
app = FastAPI(title="Sieve")
|
| 14 |
app.add_middleware(
|
|
|
|
| 77 |
for action in env.episode_actions
|
| 78 |
],
|
| 79 |
}
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def main():
|
| 83 |
+
import uvicorn
|
| 84 |
+
uvicorn.run("server.app:app", host="0.0.0.0", port=7860)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if __name__ == "__main__":
|
| 88 |
+
main()
|
config.py β server/config.py
RENAMED
|
File without changes
|
data.py β server/data.py
RENAMED
|
File without changes
|
environment.py β server/environment.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from typing import Dict, Any, List, Optional, Tuple
|
| 2 |
|
| 3 |
from models import Action, ActionType, Email, Observation, Reward
|
| 4 |
-
from data import TASK_CONFIGS
|
| 5 |
|
| 6 |
import nltk
|
| 7 |
|
|
@@ -146,7 +146,7 @@ class EmailSortingEnvironment:
|
|
| 146 |
return (
|
| 147 |
Reward(
|
| 148 |
value=-0.05,
|
| 149 |
-
|
| 150 |
reason="Must use respond action",
|
| 151 |
),
|
| 152 |
{},
|
|
@@ -344,7 +344,6 @@ class EmailSortingEnvironment:
|
|
| 344 |
order = [a["email_id"] for a in self.episode_actions]
|
| 345 |
total_emails = len(TASK_CONFIGS["support_session"]["emails"])
|
| 346 |
|
| 347 |
-
# Prioritization: VIP emails handled early score higher than high-urgency ones
|
| 348 |
vip_weight = 0.20 / max(len(vip_ids), 1)
|
| 349 |
high_weight = 0.10 / max(len(high_ids), 1)
|
| 350 |
priority = 0.0
|
|
|
|
| 1 |
from typing import Dict, Any, List, Optional, Tuple
|
| 2 |
|
| 3 |
from models import Action, ActionType, Email, Observation, Reward
|
| 4 |
+
from .data import TASK_CONFIGS
|
| 5 |
|
| 6 |
import nltk
|
| 7 |
|
|
|
|
| 146 |
return (
|
| 147 |
Reward(
|
| 148 |
value=-0.05,
|
| 149 |
+
components={"wrong_action": -0.05},
|
| 150 |
reason="Must use respond action",
|
| 151 |
),
|
| 152 |
{},
|
|
|
|
| 344 |
order = [a["email_id"] for a in self.episode_actions]
|
| 345 |
total_emails = len(TASK_CONFIGS["support_session"]["emails"])
|
| 346 |
|
|
|
|
| 347 |
vip_weight = 0.20 / max(len(vip_ids), 1)
|
| 348 |
high_weight = 0.10 / max(len(high_ids), 1)
|
| 349 |
priority = 0.0
|
uv.lock
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|