prithic07 commited on
Commit
69faf95
·
1 Parent(s): 10cf1e5

Docs: Simplify README to core technical specifications

Browse files
Files changed (1) hide show
  1. README.md +52 -67
README.md CHANGED
@@ -1,85 +1,70 @@
1
- # 🚀 RAG Context Optimizer: Enterprise Incident Operations
2
 
3
- **Context Optimizer** is an advanced Reinforcement Learning (RL) environment designed for enterprise-grade context management in RAG pipelines. It simulates the high-stakes decisions made during live operational incidents like outages, security escalations, and cross-functional briefings.
4
 
5
- ---
6
 
7
- ## 💡 Motivation: Operational Intelligence
8
- Standard RAG often fails in complex scenarios where picking the right context isn't just about semantic similarity. Incident commanders and support leads must:
9
- - **Inspect** artifacts across multiple domains (Support, Engineering, Billing).
10
- - **Prioritize** evidence within strict token budgets.
11
- - **Summarize** heavy technical documents without losing grounding.
12
- - **Plan** resolutions before submitting final grounded memos.
 
13
 
14
- This environment models these behaviors to benchmark and train agents that are accurate, efficient, and operationally safe.
15
 
16
- ---
17
 
18
- ## 🎮 Action & Observation Spaces
19
 
20
- ### Action Space (RagAction)
21
- | Action Type | Parameters | Effect |
22
- | --- | --- | --- |
23
- | `inspect_artifact` | `artifact_id` | Review an artifact without committing it to the working set |
24
- | `prioritize_artifact` | `artifact_id` | Add a reviewed artifact to the working set |
25
- | `summarize_artifact` | `artifact_id`, `ratio` | Compress an artifact to reduce token cost |
26
- | `set_resolution_plan` | `plan` | Draft the operational plan before submission |
27
- | `submit_report` | `answer` | Submit the final grounded memo and end the episode |
28
 
29
- ### Observation Space (RagObservation)
30
- - **case_summary**: Real-world case context and background.
31
- - **objective**: The specific deliverable the agent must produce.
32
- - **workflow_stage**: Current phase (`triage`, `analysis`, `resolution`).
33
- - **available_artifacts**: Summaries of all artifacts available for review.
34
- - **token_budget**: Strict limit on the total tokens allowed in the working set.
35
- - **progress_signals**: Partial performance metrics throughout the trajectory.
36
 
37
- ---
 
 
 
 
38
 
39
- ## 🏆 Task Definitions
40
 
41
- | Task Name | Difficulty | Max Steps | Token Budget | Objective |
42
- | :--- | :--- | :--- | :--- | :--- |
43
- | `refund_triage_easy` | **Easy** | 7 | 850 | Triage refund requests after an outage. |
44
- | `cross_function_brief_medium` | **Medium** | 8 | 620 | Sync support, IR, and release controls. |
45
- | `executive_escalation_hard` | **Hard** | 10 | 360 | Draft a terse, high-stakes compromise note. |
46
 
47
- ---
48
 
49
- ## 🛠️ API Endpoints
 
 
 
50
 
51
- The environment exposes a robust FastAPI interface:
52
- - `POST /reset`: Initialize a new episode with a specific task.
53
- - `POST /step`: Execute an action and receive reward/observation.
54
- - `GET /state`: Retrieve the full current state of the environment.
55
- - `POST /optimize-step`: **[AI Helper]** Get a suggested action from a baseline policy.
56
- - `POST /optimize-prompt`: **[AI Helper]** Rewrite prompts to fit budgets while preserving grounding.
57
 
58
- ---
 
 
 
59
 
60
- ## 🚀 Getting Started
 
 
 
61
 
62
- ### Installation
63
- ```bash
64
- pip install -r requirements.txt
65
- ```
66
 
67
- ### Execution
68
- Start the environment server:
69
- ```bash
70
- python app.py
71
- ```
72
-
73
- Launch the Streamlit dashboard for manual optimization:
74
- ```bash
75
- streamlit run optimizer_ui.py
76
- ```
77
-
78
- ### Validation
79
- Ensure full compliance with the benchmark specifications:
80
- ```bash
81
- python validate.py
82
- ```
83
-
84
- ---
85
- *Built for the Meta x Scaler Hackathon 2026*
 
1
+ # RAG Context Optimizer
2
 
3
+ A reinforcement learning environment for context optimization tasks including artifact inspection, prioritization, and summarization. This project simulates an operational workflow for handling structured data artifacts within token budgets.
4
 
5
+ ## Project Structure
6
 
7
+ - `rag_optimizer_env/`: Core environment logic and task definitions.
8
+ - `rag_gc_env/`: (Legacy) Context pruning environment for Round 1.
9
+ - `app.py`: FastAPI implementation of the environment server.
10
+ - `inference.py`: Baseline inference script using an OpenAI-compatible interface.
11
+ - `optimizer_ui.py`: Streamlit-based dashboard for manual task execution.
12
+ - `validate.py`: Local validation script for environment compliance.
13
+ - `data/`: Corpus and task dataset files.
14
 
15
+ ## Environment Interface
16
 
17
+ ### Action Space
18
 
19
+ The agent interacts with the environment using the following actions:
20
 
21
+ - `inspect_artifact`: Review metadata for a chunk without committing to the context.
22
+ - `prioritize_artifact`: Add an artifact to the current context (working set).
23
+ - `summarize_artifact`: Compress a prioritized artifact according to a specified ratio.
24
+ - `set_resolution_plan`: Define an operational plan.
25
+ - `submit_report`: Submit the final grounded answer.
 
 
 
26
 
27
+ ### API Endpoints
 
 
 
 
 
 
28
 
29
+ - `POST /reset`: Initialize an episode for a given task.
30
+ - `POST /step`: Execute an action and return the observation, reward, and terminal state.
31
+ - `GET /state`: View the current episode state.
32
+ - `POST /optimize-step`: Request a suggested action from the baseline policy.
33
+ - `POST /optimize-prompt`: Optimize input prompts for grounding and length.
34
 
35
+ ## Tasks
36
 
37
+ | Name | Difficulty | Steps | Token Budget |
38
+ | :--- | :--- | :--- | :--- |
39
+ | `refund_triage_easy` | Easy | 7 | 850 |
40
+ | `cross_function_brief_medium` | Medium | 8 | 620 |
41
+ | `executive_escalation_hard` | Hard | 10 | 360 |
42
 
43
+ ## Setup and Execution
44
 
45
+ 1. **Install dependencies**:
46
+ ```bash
47
+ pip install -r requirements.txt
48
+ ```
49
 
50
+ 2. **Run server**:
51
+ ```bash
52
+ python app.py
53
+ ```
 
 
54
 
55
+ 3. **Inference**:
56
+ ```bash
57
+ python inference.py
58
+ ```
59
 
60
+ 4. **UI Dashboard**:
61
+ ```bash
62
+ streamlit run optimizer_ui.py
63
+ ```
64
 
65
+ 5. **Validation**:
66
+ ```bash
67
+ python validate.py
68
+ ```
69
 
70
+ Built for the Meta x Scaler Hackathon 2026.