brainworm2024 commited on
Commit
fbc77a0
·
1 Parent(s): e08aa80

Pass API key via query string, fix cardiac scenario

Browse files
Files changed (2) hide show
  1. src/inference/qwen.rs +5 -3
  2. static/index.html +1 -1
src/inference/qwen.rs CHANGED
@@ -1,7 +1,7 @@
1
  use anyhow::Result;
2
  use serde_json::Value;
3
 
4
- /// Call the real vLLM endpoint on AMD MI300X.
5
  /// Falls back to mock if the GPU is unreachable.
6
  pub async fn generate(redacted_prompt: &str) -> Result<(String, String, String)> {
7
  let vllm_url = std::env::var("VLLM_URL")
@@ -9,11 +9,13 @@ pub async fn generate(redacted_prompt: &str) -> Result<(String, String, String)>
9
  let api_key = std::env::var("VLLM_API_KEY")
10
  .unwrap_or_else(|_| "abc-123".to_string());
11
 
 
 
 
12
  let client = reqwest::Client::new();
13
  let resp = client
14
- .post(&vllm_url)
15
  .header("ngrok-skip-browser-warning", "true")
16
- .header("Authorization", format!("Bearer {}", api_key))
17
  .json(&serde_json::json!({
18
  "model": "Qwen/Qwen2.5-7B-Instruct",
19
  "prompt": redacted_prompt,
 
1
  use anyhow::Result;
2
  use serde_json::Value;
3
 
4
+ /// Call the real vLLM endpoint on AMD MI300X via ngrok tunnel.
5
  /// Falls back to mock if the GPU is unreachable.
6
  pub async fn generate(redacted_prompt: &str) -> Result<(String, String, String)> {
7
  let vllm_url = std::env::var("VLLM_URL")
 
9
  let api_key = std::env::var("VLLM_API_KEY")
10
  .unwrap_or_else(|_| "abc-123".to_string());
11
 
12
+ // Append API key as query parameter (ngrok-friendly)
13
+ let url_with_key = format!("{}?api_key={}", vllm_url, api_key);
14
+
15
  let client = reqwest::Client::new();
16
  let resp = client
17
+ .post(&url_with_key)
18
  .header("ngrok-skip-browser-warning", "true")
 
19
  .json(&serde_json::json!({
20
  "model": "Qwen/Qwen2.5-7B-Instruct",
21
  "prompt": redacted_prompt,
static/index.html CHANGED
@@ -90,7 +90,7 @@
90
 
91
  <script>
92
  const scenarios = {
93
- cardiac: "Patient John Morrison, DOB 05/12/1957, MRN 847291-A, SSN 123-45-6789, Insurance Aetna #Z829-443. Presents with acute substernal chest pain radiating to left arm, diaphoresis, nausea. History of HTN, DM2. ECG shows ST elevation in leads II, III, aVF. Troponin pending.",
94
  pediatric: "Patient Jane Doe, 7yo female, MRN 293-B, Parents: Michael & Sarah Doe, Phone 555-123-4567. Fell from tree, complaining of left upper quadrant pain. CT shows grade III splenic laceration. Vitals: HR 120, BP 90/60."
95
  };
96
 
 
90
 
91
  <script>
92
  const scenarios = {
93
+ cardiac: "Patient John Morrison, 67 yo, MRN 847291A, SSN 123-45-6789. Presents with acute substernal chest pain radiating to left arm. History of HTN, DM2. ECG shows ST elevation in leads II, III, aVF. Troponin pending.",
94
  pediatric: "Patient Jane Doe, 7yo female, MRN 293-B, Parents: Michael & Sarah Doe, Phone 555-123-4567. Fell from tree, complaining of left upper quadrant pain. CT shows grade III splenic laceration. Vitals: HR 120, BP 90/60."
95
  };
96