Skip to content

Commit 6f56d79

Browse files
committed
make test configurable
1 parent bccf636 commit 6f56d79

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

tests/lmcache/1-mmlu-dynamo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Reference: https://github.com/LMCache/LMCache/blob/dev/.buildkite/correctness/1-mmlu.py
33

44
# ASSUMPTIONS:
5-
# 1. dynamo is running on port 8080 without LMCache
5+
# 1. dynamo is running (default: localhost:8080) without LMCache
66
# 2. the mmlu dataset is in a "data" directory
77
# 3. all invocations of this script should be run in the same directory
88
# (for later consolidation)
@@ -41,7 +41,8 @@ def get_llm_response(args, prompt):
4141
"stream": False,
4242
"seed": 42, # Add explicit seed for determinism
4343
}
44-
res = requests.post("http://localhost:8080/v1/chat/completions", json=data, timeout=30)
44+
url = f"http://{args.host}:{args.port}/v1/chat/completions"
45+
res = requests.post(url, json=data, timeout=30)
4546
if res.status_code != 200:
4647
raise Exception(f"Error: {res.status_code} {res.text}")
4748
response_json = res.json()
@@ -159,6 +160,8 @@ def main(args):
159160
parser.add_argument("--model", type=str, required=True)
160161
parser.add_argument("--result-file", type=str, required=False)
161162
parser.add_argument("--number-of-subjects", type=int, required=True)
163+
parser.add_argument("--host", type=str, default="localhost", help="Dynamo host")
164+
parser.add_argument("--port", type=int, default=8080, help="Dynamo port")
162165

163166
args = parser.parse_args()
164167
if args.result_file is None:

tests/lmcache/2-mmlu-dynamo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Reference: https://github.com/LMCache/LMCache/blob/dev/.buildkite/correctness/2-mmlu.py
33

44
# ASSUMPTIONS:
5-
# 1. dynamo is running on port 8080 with LMCache enabled
5+
# 1. dynamo is running (default: localhost:8080) with LMCache enabled
66
# 2. the mmlu dataset is in a "data" directory
77
# 3. all invocations of this script should be run in the same directory
88
# (for later consolidation)
@@ -41,7 +41,8 @@ def get_llm_response(args, prompt):
4141
"stream": False,
4242
"seed": 42, # Add explicit seed for determinism
4343
}
44-
res = requests.post("http://localhost:8080/v1/chat/completions", json=data, timeout=30)
44+
url = f"http://{args.host}:{args.port}/v1/chat/completions"
45+
res = requests.post(url, json=data, timeout=30)
4546
if res.status_code != 200:
4647
raise Exception(f"Error: {res.status_code} {res.text}")
4748
response_json = res.json()
@@ -159,6 +160,8 @@ def main(args):
159160
parser.add_argument("--model", type=str, required=True)
160161
parser.add_argument("--result-file", type=str, required=False)
161162
parser.add_argument("--number-of-subjects", type=int, required=True)
163+
parser.add_argument("--host", type=str, default="localhost", help="Dynamo host")
164+
parser.add_argument("--port", type=int, default=8080, help="Dynamo port")
162165

163166
args = parser.parse_args()
164167
if args.result_file is None:

0 commit comments

Comments
 (0)