update frozenlake readme

This commit is contained in:
dengjiaji 2025-09-04 16:08:54 +08:00
parent 10fef4e426
commit 5302b1b69c
2 changed files with 8 additions and 15 deletions

View file

@ -68,10 +68,7 @@ class FrozenLakeReactAgent:
return yaml.safe_load(f)
except FileNotFoundError:
logger.warning("Prompt file not found, using default prompts")
return {
"frozenlake_sys_prompt_no_slippery": "You are playing FrozenLake. Navigate from S to G avoiding H.",
"frozenlake_sys_prompt_slippery": "You are playing FrozenLake. Navigate from S to G avoiding H. Ice is slippery!"
}
raise FileNotFoundError("Prompt file not found. Please check your current path (should be ./cook/frozenlake) and try again.")
def call_llm(self, messages: List[Dict]) -> str:
"""Call LLM with retry logic"""
@ -158,8 +155,7 @@ class FrozenLakeReactAgent:
r'["\']action["\']\s*:\s*["\']([0-3])["\']',
r'"action"\s*:\s*"([0-3])"',
r"'action'\s*:\s*'([0-3])'",
r'\baction["\']?\s*[:=]\s*["\']?([0-3])',
r'\b([0-3])\b(?=\s*$)', # Single digit at end
r'\baction["\']?\s*[:=]\s*["\']?([0-3])'
]
for pattern in patterns:
@ -223,6 +219,7 @@ class FrozenLakeReactAgent:
for step in range(self.max_steps):
# Get action from LLM
response = self.call_llm(messages)
logger.info(response)
action = self.action_parser(response)
messages.append({"role": "assistant", "content": response})

View file

@ -51,10 +51,13 @@ reme \
vector_store.default.backend=local
```
Load default memory library for FrozenLake:
Add your api key for agent:
```bash
export OPENAI_API_KEY="xxx"
export OPENAI_BASE_URL="xxx"
```
## Run Experiments
### 1. Quick Test: Performance Evaluation Only (Default)
@ -62,6 +65,7 @@ Load default memory library for FrozenLake:
Run the main experiment script to test agent performance using existing memory:
```bash
cd cookbook/frozenlake
python run_frozenlake.py
```
@ -131,14 +135,6 @@ python run_exp_statistic.py
- Calculates performance metrics
- Generates comparative analysis
## Understanding Results
The experiment evaluates agent performance on FrozenLake maps:
- **Success Rate**: Percentage of episodes where the agent reaches the goal
- **With vs. Without Memory**: Compares performance with and without task memory
- **Slippery vs. Non-slippery**: Compares performance in different environment dynamics
### Output Files
- `./exp_result/*_training.jsonl`: Results from training phase