akhaliq HF Staff commited on
Commit
dbc622e
·
1 Parent(s): 02c4bc2

remove grok and magistral

Browse files
Files changed (1) hide show
  1. app.py +3 -24
app.py CHANGED
@@ -2236,11 +2236,6 @@ CRITICAL: For imported spaces that lack anycoder attribution, you MUST add it as
2236
 
2237
  # Available models
2238
  AVAILABLE_MODELS = [
2239
- {
2240
- "name": "Grok 4 Fast (Free)",
2241
- "id": "x-ai/grok-4-fast:free",
2242
- "description": "X.AI Grok 4 Fast model via OpenRouter - free tier with vision capabilities for code generation"
2243
- },
2244
  {
2245
  "name": "Moonshot Kimi-K2",
2246
  "id": "moonshotai/Kimi-K2-Instruct",
@@ -2318,12 +2313,6 @@ AVAILABLE_MODELS = [
2318
  "description": "Mistral Medium 2508 model via Mistral API for general tasks and coding",
2319
  "type": "mistral"
2320
  },
2321
- {
2322
- "name": "Magistral Medium 2509",
2323
- "id": "magistral-medium-2509",
2324
- "description": "Magistral Medium 2509 model via Mistral API for advanced code generation and reasoning",
2325
- "type": "mistral"
2326
- },
2327
  {
2328
  "name": "Gemini 2.5 Flash",
2329
  "id": "gemini-2.5-flash",
@@ -2471,23 +2460,13 @@ def get_inference_client(model_id, provider="auto"):
2471
  api_key=os.getenv("OPENROUTER_API_KEY"),
2472
  base_url="https://openrouter.ai/api/v1",
2473
  )
2474
- elif model_id == "x-ai/grok-4-fast:free":
2475
- # Use OpenRouter client for Grok 4 Fast (Free) model
2476
- return OpenAI(
2477
- api_key=os.getenv("OPENROUTER_API_KEY"),
2478
- base_url="https://openrouter.ai/api/v1",
2479
- default_headers={
2480
- "HTTP-Referer": "https://huggingface.co/spaces/akhaliq/anycoder",
2481
- "X-Title": "anycoder"
2482
- }
2483
- )
2484
  elif model_id == "step-3":
2485
  # Use StepFun API client for Step-3 model
2486
  return OpenAI(
2487
  api_key=os.getenv("STEP_API_KEY"),
2488
  base_url="https://api.stepfun.com/v1"
2489
  )
2490
- elif model_id == "codestral-2508" or model_id == "mistral-medium-2508" or model_id == "magistral-medium-2509":
2491
  # Use Mistral client for Mistral models
2492
  return Mistral(api_key=os.getenv("MISTRAL_API_KEY"))
2493
  elif model_id == "gemini-2.5-flash":
@@ -6562,7 +6541,7 @@ Generate the exact search/replace blocks needed to make these changes."""
6562
  messages.append({'role': 'user', 'content': enhanced_query})
6563
  try:
6564
  # Handle Mistral API method difference
6565
- if _current_model["id"] in ("codestral-2508", "mistral-medium-2508", "magistral-medium-2509"):
6566
  completion = client.chat.stream(
6567
  model=get_real_model_id(_current_model["id"]),
6568
  messages=messages,
@@ -6620,7 +6599,7 @@ Generate the exact search/replace blocks needed to make these changes."""
6620
  for chunk in completion:
6621
  # Handle different response formats for Mistral vs others
6622
  chunk_content = None
6623
- if _current_model["id"] in ("codestral-2508", "mistral-medium-2508", "magistral-medium-2509"):
6624
  # Mistral format: chunk.data.choices[0].delta.content
6625
  if (
6626
  hasattr(chunk, "data") and chunk.data and
 
2236
 
2237
  # Available models
2238
  AVAILABLE_MODELS = [
 
 
 
 
 
2239
  {
2240
  "name": "Moonshot Kimi-K2",
2241
  "id": "moonshotai/Kimi-K2-Instruct",
 
2313
  "description": "Mistral Medium 2508 model via Mistral API for general tasks and coding",
2314
  "type": "mistral"
2315
  },
 
 
 
 
 
 
2316
  {
2317
  "name": "Gemini 2.5 Flash",
2318
  "id": "gemini-2.5-flash",
 
2460
  api_key=os.getenv("OPENROUTER_API_KEY"),
2461
  base_url="https://openrouter.ai/api/v1",
2462
  )
 
 
 
 
 
 
 
 
 
 
2463
  elif model_id == "step-3":
2464
  # Use StepFun API client for Step-3 model
2465
  return OpenAI(
2466
  api_key=os.getenv("STEP_API_KEY"),
2467
  base_url="https://api.stepfun.com/v1"
2468
  )
2469
+ elif model_id == "codestral-2508" or model_id == "mistral-medium-2508":
2470
  # Use Mistral client for Mistral models
2471
  return Mistral(api_key=os.getenv("MISTRAL_API_KEY"))
2472
  elif model_id == "gemini-2.5-flash":
 
6541
  messages.append({'role': 'user', 'content': enhanced_query})
6542
  try:
6543
  # Handle Mistral API method difference
6544
+ if _current_model["id"] in ("codestral-2508", "mistral-medium-2508"):
6545
  completion = client.chat.stream(
6546
  model=get_real_model_id(_current_model["id"]),
6547
  messages=messages,
 
6599
  for chunk in completion:
6600
  # Handle different response formats for Mistral vs others
6601
  chunk_content = None
6602
+ if _current_model["id"] in ("codestral-2508", "mistral-medium-2508"):
6603
  # Mistral format: chunk.data.choices[0].delta.content
6604
  if (
6605
  hasattr(chunk, "data") and chunk.data and