adityagirishh commited on
Commit
f49f4d9
·
unverified ·
1 Parent(s): 94c7912

Add files via upload

Browse files
Files changed (6) hide show
  1. Dockerfile +20 -0
  2. README.md +0 -1
  3. app.py +90 -0
  4. openenv.yaml +11 -0
  5. requirements.txt +4 -0
  6. run.py +18 -0
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1
4
+ ENV PYTHONUNBUFFERED=1
5
+
6
+ WORKDIR /app
7
+
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ build-essential \
10
+ curl \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ COPY requirements.txt /app/requirements.txt
14
+ RUN pip install --no-cache-dir -r requirements.txt
15
+
16
+ COPY . /app
17
+
18
+ EXPOSE 7860
19
+
20
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
README.md CHANGED
@@ -1 +0,0 @@
1
- # E.L.A.R.A
 
 
app.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, HTTPException
2
+ from pydantic import BaseModel
3
+
4
+ from environment import ElaraEnv
5
+ from models import Action
6
+
7
+ app = FastAPI(title="E.L.A.R.A.", version="0.1.0")
8
+ env = ElaraEnv()
9
+
10
+
11
+ class StepRequest(BaseModel):
12
+ action: Action
13
+
14
+
15
+ @app.get("/health")
16
+ def health():
17
+ return {"status": "ok", "project": "E.L.A.R.A."}
18
+
19
+
20
+ @app.post("/reset")
21
+ def reset():
22
+ obs = env.reset()
23
+ return {"observation": obs.model_dump()}
24
+
25
+
26
+ @app.post("/step")
27
+ def step(payload: StepRequest):
28
+ try:
29
+ observation, reward, done, info = env.step(payload.action)
30
+ return {
31
+ "observation": observation.model_dump(),
32
+ "reward": reward,
33
+ "done": done,
34
+ "info": info,
35
+ }
36
+ except RuntimeError as e:
37
+ raise HTTPException(status_code=400, detail=str(e))
38
+
39
+
40
+ @app.get("/state")
41
+ def state():
42
+ try:
43
+ return env.state()
44
+ except RuntimeError as e:
45
+ raise HTTPException(status_code=400, detail=str(e))
46
+
47
+
48
+ @app.get("/tasks")
49
+ def tasks():
50
+ return {
51
+ "tasks": [
52
+ {
53
+ "task_id": "easy",
54
+ "name": "First-touch outreach",
55
+ "difficulty": "easy",
56
+ "goal": "Choose the right channel and send a relevant first contact.",
57
+ },
58
+ {
59
+ "task_id": "medium",
60
+ "name": "Follow-up handling",
61
+ "difficulty": "medium",
62
+ "goal": "Respond correctly to lead context and request missing docs.",
63
+ },
64
+ {
65
+ "task_id": "hard",
66
+ "name": "Multi-channel orchestration",
67
+ "difficulty": "hard",
68
+ "goal": "Sequence call/email/message actions with timing and compliance.",
69
+ },
70
+ ],
71
+ "action_schema": {
72
+ "action_type": ["email", "call", "message"],
73
+ "target_lead_id": "string",
74
+ "content": "string",
75
+ "subject": "optional string",
76
+ "metadata": "optional object",
77
+ },
78
+ }
79
+
80
+
81
+ @app.get("/grader")
82
+ def grader():
83
+ if env.state_obj is None:
84
+ raise HTTPException(status_code=400, detail="Environment not reset.")
85
+ return {
86
+ "status": "ready",
87
+ "step_count": env.state_obj.step_count,
88
+ "done": env.state_obj.done,
89
+ "note": "Day 1 grader stub. Full task scoring comes next.",
90
+ }
openenv.yaml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: elara
2
+ version: "0.1.0"
3
+ display_name: E.L.A.R.A.
4
+ description: Sandboxed multi-channel sales operations environment for OpenEnv.
5
+ tags:
6
+ - openenv
7
+ - sales
8
+ - crm
9
+ - multi-channel
10
+ - hackathon
11
+ entrypoint: app:app
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ fastapi>=0.104.0
2
+ uvicorn[standard]>=0.24.0
3
+ pydantic>=2.7.0
4
+ requests>=2.25.0
run.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from environment import ElaraEnv
2
+ from models import Action
3
+
4
+ env = ElaraEnv()
5
+ obs = env.reset()
6
+ print(obs.model_dump())
7
+
8
+ obs, reward, done, info = env.step(
9
+ Action(
10
+ action_type="email",
11
+ target_lead_id="L-001",
12
+ subject="Requesting your documents",
13
+ content="Hi Arun, sharing the documents request as discussed.",
14
+ )
15
+ )
16
+
17
+ print(obs.model_dump())
18
+ print(reward, done, info)