log error when llama-server request exceeds context size (#7263)

This commit is contained in:
mamei16 2025-10-13 04:00:11 +02:00 committed by GitHub
parent 611399e089
commit 308e726e11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,7 +200,10 @@ class LlamaServer:
# Make the generation request # Make the generation request
response = self.session.post(url, json=payload, stream=True) response = self.session.post(url, json=payload, stream=True)
try: try:
response.raise_for_status() # Raise an exception for HTTP errors if response.status_code == 400 and response.json()["error"]["type"] == "exceed_context_size_error":
logger.error("The request exceeds the available context size, try increasing it")
else:
response.raise_for_status() # Raise an exception for HTTP errors
full_text = "" full_text = ""