Skip to content

Commit 7e26ea2

Browse files
authored
update the vllm oai client script to accept/detect modal environments (#1072)
1 parent 5f42066 commit 7e26ea2

File tree

1 file changed

+13
-1
lines changed
  • 06_gpu_and_ml/llm-serving/openai_compatible

1 file changed

+13
-1
lines changed

06_gpu_and_ml/llm-serving/openai_compatible/client.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def main():
5959
default=None,
6060
help="The workspace where the LLM server app is hosted, defaults to your current Modal workspace",
6161
)
62+
parser.add_argument(
63+
"--environment",
64+
type=str,
65+
default=None,
66+
help="The environment in your Modal workspace where the LLM server app is hosted, defaults to your current environment",
67+
)
6268
parser.add_argument(
6369
"--app-name",
6470
type=str,
@@ -125,7 +131,13 @@ def main():
125131

126132
workspace = args.workspace or modal.config._profile
127133

128-
client.base_url = f"https://{workspace}--{args.app_name}-{args.function_name}.modal.run/v1"
134+
environment = args.environment or modal.config.config["environment"]
135+
136+
prefix = workspace + (f"-{environment}" if environment else "")
137+
138+
client.base_url = (
139+
f"https://{prefix}--{args.app_name}-{args.function_name}.modal.run/v1"
140+
)
129141

130142
if args.model:
131143
model_id = args.model

0 commit comments

Comments
 (0)