Spaces:
Running
Running
Update app/providers.py
Browse files- app/providers.py +4 -1
app/providers.py
CHANGED
|
@@ -64,6 +64,8 @@ class BaseProvider:
|
|
| 64 |
Shared HTTP POST — used by all providers.
|
| 65 |
Raises httpx.HTTPStatusError on non-2xx responses.
|
| 66 |
"""
|
|
|
|
|
|
|
| 67 |
async with httpx.AsyncClient() as client:
|
| 68 |
r = await client.post(
|
| 69 |
url,
|
|
@@ -75,6 +77,7 @@ class BaseProvider:
|
|
| 75 |
return r.json()
|
| 76 |
|
| 77 |
|
|
|
|
| 78 |
# =============================================================================
|
| 79 |
# SECTION 2 — LLM Provider Implementations
|
| 80 |
# Only the API-specific parsing logic differs per provider.
|
|
@@ -241,7 +244,7 @@ async def llm_complete(
|
|
| 241 |
try:
|
| 242 |
result = await provider.complete(prompt, model, max_tokens)
|
| 243 |
logger.info(f"Response from provider: '{current}'")
|
| 244 |
-
return result
|
| 245 |
except Exception as e:
|
| 246 |
logger.warning(f"Provider '{current}' failed: {e} — trying fallback.")
|
| 247 |
|
|
|
|
| 64 |
Shared HTTP POST — used by all providers.
|
| 65 |
Raises httpx.HTTPStatusError on non-2xx responses.
|
| 66 |
"""
|
| 67 |
+
safe_url = url.split("?")[0] # strip query params from logs
|
| 68 |
+
logger.debug(f"POST → {safe_url}")
|
| 69 |
async with httpx.AsyncClient() as client:
|
| 70 |
r = await client.post(
|
| 71 |
url,
|
|
|
|
| 77 |
return r.json()
|
| 78 |
|
| 79 |
|
| 80 |
+
|
| 81 |
# =============================================================================
|
| 82 |
# SECTION 2 — LLM Provider Implementations
|
| 83 |
# Only the API-specific parsing logic differs per provider.
|
|
|
|
| 244 |
try:
|
| 245 |
result = await provider.complete(prompt, model, max_tokens)
|
| 246 |
logger.info(f"Response from provider: '{current}'")
|
| 247 |
+
return f"[{current}] {result}"
|
| 248 |
except Exception as e:
|
| 249 |
logger.warning(f"Provider '{current}' failed: {e} — trying fallback.")
|
| 250 |
|