Spaces:
Paused

sasa commited on
Commit
c2db67f
·
1 Parent(s): 53de733

llm7: auto-truncate long prompts to 8000-char anonymous cap (no token); drop pro GLM model; keeps fast llm7 path for all prompt sizes

Browse files
Files changed (1) hide show
  1. agentflow/engine/auto_fast.py +6 -2
agentflow/engine/auto_fast.py CHANGED
@@ -31,7 +31,7 @@ DEFAULT_LLM7_MODELS = [
31
  # models return HTTP 402 "pro — upgrade required"). mistral-small-3.2 is
32
  # the fastest reliable instruction-follower, so it leads the pool.
33
  "LLM7_MODELS",
34
- "mistral-small-3.2,codestral-latest,GLM-4.6V-Flash,qwen3-235b",
35
  ).split(",")
36
  if model.strip()
37
  ]
@@ -107,6 +107,10 @@ def _default_endpoints() -> list[dict[str, Any]]:
107
  llm7_headers["Authorization"] = f"Bearer {llm7_key}"
108
  # With a token llm7 lifts the 1/sec cap; stay polite either way.
109
  llm7_interval = float(os.getenv("LLM7_MIN_INTERVAL", "0.4" if llm7_key else "1.2"))
 
 
 
 
110
 
111
  # --- pollinations.ai (fallback) ---------------------------------------
112
  poll_headers: dict[str, str] = {}
@@ -130,7 +134,7 @@ def _default_endpoints() -> list[dict[str, Any]]:
130
  "timeout": 45,
131
  "path_mode": "direct",
132
  "body_mode": "json",
133
- "max_chars": int(os.getenv("LLM7_MAX_CHARS", "0")),
134
  "min_interval": llm7_interval,
135
  },
136
  {
 
31
  # models return HTTP 402 "pro — upgrade required"). mistral-small-3.2 is
32
  # the fastest reliable instruction-follower, so it leads the pool.
33
  "LLM7_MODELS",
34
+ "mistral-small-3.2,codestral-latest,qwen3-235b",
35
  ).split(",")
36
  if model.strip()
37
  ]
 
107
  llm7_headers["Authorization"] = f"Bearer {llm7_key}"
108
  # With a token llm7 lifts the 1/sec cap; stay polite either way.
109
  llm7_interval = float(os.getenv("LLM7_MIN_INTERVAL", "0.4" if llm7_key else "1.2"))
110
+ # Anonymous tier caps prompts at 8000 chars; a token lifts that. Truncate to
111
+ # fit when anonymous so long planning prompts still go to the fast llm7 pool
112
+ # instead of cascading through failed attempts to the slower fallback proxy.
113
+ llm7_max_chars = int(os.getenv("LLM7_MAX_CHARS", "0" if llm7_key else "7600"))
114
 
115
  # --- pollinations.ai (fallback) ---------------------------------------
116
  poll_headers: dict[str, str] = {}
 
134
  "timeout": 45,
135
  "path_mode": "direct",
136
  "body_mode": "json",
137
+ "max_chars": llm7_max_chars,
138
  "min_interval": llm7_interval,
139
  },
140
  {