IDKHowToCodeFr commited on
Commit
b1b706a
·
1 Parent(s): bd72f20

fix(security): mask Gemini API key in logs, downgrade NIM/Groq model strings, add challenge license

Browse files
Files changed (2) hide show
  1. LICENSE +7 -0
  2. scripts/llm.py +4 -4
LICENSE ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2026 IDKHowToCodeFR. All rights reserved.
2
+
3
+ This software and associated documentation files (the "Software") are the proprietary property of the author.
4
+
5
+ This Software is provided strictly and solely for evaluation and scoring purposes by the organizers and judges of the magicpin AI Challenge.
6
+
7
+ Any other use, copying, reproduction, modification, distribution, or public performance of this Software, in whole or in part, without the prior written consent of the copyright owner is strictly prohibited.
scripts/llm.py CHANGED
@@ -59,7 +59,7 @@ async def call_nvidia(prompt: str, system: str, timeout: float) -> Optional[dict
59
  key = os.getenv("NVIDIA_API_KEY")
60
  if not key: return None
61
  payload = {
62
- "model": "meta/llama-3.3-70b-instruct",
63
  "messages": [{"role": "system", "content": system + "\n\nRETURN JSON ONLY."}, {"role": "user", "content": prompt}],
64
  "temperature": 0.3,
65
  "response_format": {"type": "json_object"}
@@ -73,7 +73,7 @@ async def call_groq(prompt: str, system: str, timeout: float) -> Optional[dict]:
73
  key = os.getenv("GROQ_API_KEY")
74
  if not key: return None
75
  payload = {
76
- "model": "llama-3.3-70b-versatile",
77
  "messages": [{"role": "system", "content": system + "\n\nRETURN JSON ONLY."}, {"role": "user", "content": prompt}],
78
  "temperature": 0.3,
79
  "response_format": {"type": "json_object"}
@@ -92,8 +92,8 @@ async def call_gemini(prompt: str, system: str, timeout: float) -> Optional[dict
92
  "generationConfig": {"temperature": 0.3, "responseMimeType": "application/json"}
93
  }
94
  async with httpx.AsyncClient() as client:
95
- url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key={key}"
96
- res = await client.post(url, json=payload, timeout=timeout)
97
  res.raise_for_status()
98
  return clean_json(res.json()["candidates"][0]["content"]["parts"][0]["text"])
99
 
 
59
  key = os.getenv("NVIDIA_API_KEY")
60
  if not key: return None
61
  payload = {
62
+ "model": "meta/llama-3.1-70b-instruct",
63
  "messages": [{"role": "system", "content": system + "\n\nRETURN JSON ONLY."}, {"role": "user", "content": prompt}],
64
  "temperature": 0.3,
65
  "response_format": {"type": "json_object"}
 
73
  key = os.getenv("GROQ_API_KEY")
74
  if not key: return None
75
  payload = {
76
+ "model": "llama-3.1-70b-versatile",
77
  "messages": [{"role": "system", "content": system + "\n\nRETURN JSON ONLY."}, {"role": "user", "content": prompt}],
78
  "temperature": 0.3,
79
  "response_format": {"type": "json_object"}
 
92
  "generationConfig": {"temperature": 0.3, "responseMimeType": "application/json"}
93
  }
94
  async with httpx.AsyncClient() as client:
95
+ url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent"
96
+ res = await client.post(url, headers={"x-goog-api-key": key}, json=payload, timeout=timeout)
97
  res.raise_for_status()
98
  return clean_json(res.json()["candidates"][0]["content"]["parts"][0]["text"])
99