MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / main

Function main

examples/local-inference/inference.py:115–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113
114
115def main() -> None:
116 # --- inference.local tests (router injects auth + model) ---
117 local_client = OpenAI(api_key="dummy", base_url="https://inference.local/v1")
118
119 run_non_streaming(local_client, "inference.local", model="router")
120 run_streaming(local_client, "inference.local", model="router")
121
122 # --- Direct endpoint tests (L7 TLS intercept path) ---
123 # The API key is available when the sandbox is started with --provider nvidia.
124 api_key = os.environ.get("NVIDIA_API_KEY")
125 if api_key:
126 direct_client = OpenAI(api_key=api_key, base_url=DIRECT_URL)
127
128 run_non_streaming(direct_client, f"direct ({DIRECT_URL})", model=DIRECT_MODEL)
129 run_streaming(direct_client, f"direct ({DIRECT_URL})", model=DIRECT_MODEL)
130 else:
131 print("=" * 60)
132 print("SKIPPED — direct endpoint tests (NVIDIA_API_KEY not set)")
133 print("=" * 60)
134 print(" Attach the nvidia provider to enable: --provider nvidia")
135 print()
136
137
138if __name__ == "__main__":

Callers 1

inference.pyFile · 0.70

Calls 3

run_non_streamingFunction · 0.85
run_streamingFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected