Skip to content

Commit a6874ca

Browse files
authored
Merge pull request #12 from ShaneIsley/claude/review-api-key-handling-CaUUv
refactor: leverage model registry for automatic API key handling
2 parents b17c4f7 + e5bd3a4 commit a6874ca

4 files changed

Lines changed: 4 additions & 15 deletions

File tree

‎examples/oolong_example.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Example: An example from the Oolong Benchmark from the RLM paper: https://arxiv.org/abs/2512.24601v1
33
"""
44

5-
import os
65
import random
76
import sys
87

@@ -31,10 +30,6 @@ def load_random_oolong_row() -> dict:
3130

3231

3332
def main():
34-
api_key = os.environ.get("OPENAI_API_KEY")
35-
if not api_key:
36-
raise ValueError("OPENAI_API_KEY environment variable is not set.")
37-
3833
# Load benchmark data
3934
print("Loading random row from dataset using shuffle...")
4035
row = load_random_oolong_row()
@@ -50,11 +45,11 @@ def main():
5045
logger = RLMLogger(log_dir="./logs")
5146

5247
# Create RLM instance
48+
# Note: API key is automatically loaded from OPENAI_API_KEY environment variable
5349
rlm = RLM(
5450
backend="openai",
5551
backend_kwargs={
5652
"model_name": "gpt-5-mini",
57-
"api_key": api_key,
5853
},
5954
environment="subprocess",
6055
max_iterations=30,

‎examples/prime_repl_example.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
31
from dotenv import load_dotenv
42

53
from rlm import RLM
@@ -9,10 +7,10 @@
97

108
logger = RLMLogger(log_dir="./logs")
119

10+
# Note: API key is automatically loaded from OPENAI_API_KEY environment variable
1211
rlm = RLM(
1312
backend="openai",
1413
backend_kwargs={
15-
"api_key": os.getenv("OPENAI_API_KEY"),
1614
"model_name": "gpt-5-nano",
1715
},
1816
environment="prime",

‎examples/quickstart-sandbox-macos.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
OPENAI_API_KEY=... python examples/quickstart-sandbox-macos.py
1717
"""
1818

19-
import os
20-
2119
from dotenv import load_dotenv
2220

2321
from rlm import RLM
@@ -27,11 +25,11 @@
2725

2826
logger = RLMLogger(log_dir="./logs")
2927

28+
# Note: API key is automatically loaded from OPENAI_API_KEY environment variable
3029
rlm = RLM(
3130
backend="openai",
3231
backend_kwargs={
3332
"model_name": "gpt-5-nano",
34-
"api_key": os.getenv("OPENAI_API_KEY"),
3533
},
3634
environment="subprocess", # Use SubprocessREPL instead of local
3735
environment_kwargs={

‎examples/quickstart.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
31
from dotenv import load_dotenv
42

53
from rlm import RLM
@@ -9,11 +7,11 @@
97

108
logger = RLMLogger(log_dir="./logs")
119

10+
# Note: API key is automatically loaded from OPENAI_API_KEY environment variable
1211
rlm = RLM(
1312
backend="openai", # or "portkey", etc.
1413
backend_kwargs={
1514
"model_name": "gpt-5-nano",
16-
"api_key": os.getenv("OPENAI_API_KEY"),
1715
},
1816
environment="local",
1917
environment_kwargs={},

0 commit comments

Comments
 (0)