Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lightllm/server/build_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ async def build_prompt(request, tools) -> str:

try:
input_str = tokenizer.apply_chat_template(**kwargs, tokenize=False, add_generation_prompt=True, tools=tools)
except BaseException as e:
logger.error(f"Failed to build prompt: {e}")
raise e
except Exception as e:
raise ValueError(f"Failed to build prompt: {e}") from None
Comment on lines +162 to +163

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Suppressing the exception context with from None makes it difficult to debug chat template rendering issues on the server side, as the original traceback (e.g., from Jinja2) is lost. Consider preserving the exception chain by raising the ValueError without from None so that the underlying cause is visible in server logs.

Suggested change
except Exception as e:
raise ValueError(f"Failed to build prompt: {e}") from None
except Exception as e:
raise ValueError(f"Failed to build prompt: {e}")

return input_str
Loading