Fosowl/agenticSeek · error · Exception
Together AI response is empty.
Error message
Together AI response is empty.
What it means
together_fn() raises this when the Together client's chat.completions.create returns None, guarding the subsequent response.choices[0].message.content access. Like the Google variant, the raise is re-wrapped by the outer except as 'Together AI API error: Together AI response is empty.'
Source
Thrown at sources/llm_provider.py:321
except Exception as e:
raise Exception(f"GOOGLE API error: {str(e)}") from e
def together_fn(self, history, verbose=False):
"""
Use together AI for completion
"""
from together import Together
client = Together(api_key=self.api_key)
if self.is_local:
raise Exception("Together AI is not available for local use. Change config.ini")
try:
response = client.chat.completions.create(
model=self.model,
messages=history,
)
if response is None:
raise Exception("Together AI response is empty.")
thought = response.choices[0].message.content
if verbose:
print(thought)
return thought
except Exception as e:
raise Exception(f"Together AI API error: {str(e)}") from e
def deepseek_fn(self, history, verbose=False):
"""
Use deepseek api to generate text.
"""
client = OpenAI(api_key=self.api_key, base_url="https://api.deepseek.com")
if self.is_local:
raise Exception("Deepseek (API) is not available for local use. Change config.ini")
try:
response = client.chat.completions.create(
model=self.model,
messages=history,View on GitHub (pinned to ae57a23577)
Solutions
- Check network connectivity/proxy settings toward api.together.xyz
- Verify the model name in config.ini is a valid Together model
- Upgrade the together SDK and retry
- Log the raw HTTP response to identify rate limits or service errors
Example fix
// before
response = client.chat.completions.create(model=self.model, messages=history)
thought = response.choices[0].message.content
// after
response = client.chat.completions.create(model=self.model, messages=history)
if not response or not response.choices:
raise Exception("Together AI response is empty or malformed.")
thought = response.choices[0].message.content or "" Defensive patterns
Strategy: retry
Validate before calling
if not cfg.get("together", {}).get("model"):
raise ValueError("together model missing in config.ini")
if not reachable("https://api.together.xyz"):
raise ConnectionError("cannot reach Together API") Type guard
def is_valid_completion(response) -> bool:
return (
response is not None
and getattr(response, "choices", None)
and response.choices[0].message is not None
and response.choices[0].message.content is not None
) Try / catch
try:
thought = provider.together_fn(history)
except Exception as e:
if "response is empty" in str(e):
thought = retry_with_backoff(lambda: provider.together_fn(history), retries=3)
else:
raise Prevention
- Retry with exponential backoff on empty responses
- Keep the together SDK up to date
- Check Together API status/queue limits before large batches
When it happens
Trigger: client.chat.completions.create(...) against Together's API returns None instead of a completion object — silent SDK/transport failure or an empty response body.
Common situations: Network/proxy interruptions, Together API returning an empty body (rate limiting or service incidents), invalid model name in config.ini, or an outdated together SDK.
Related errors
- Google response is empty.
- OpenAI response is empty.
- Anthropic response is empty.
- Together AI is not available for local use. Change config.in
- Together AI API error: {str(e)}
AI-assisted analysis of Fosowl/agenticSeek@ae57a23577 (2026-08-30).
Data as JSON: /api/errors/0da44211313220d1.
Report an issue: GitHub.