-
Notifications
You must be signed in to change notification settings - Fork 563
fix: Propagate model and base URL in LLMCallException; improve error handling #1502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Greptile OverviewGreptile SummaryThis PR improves error handling in NeMo Guardrails by adding context to error messages and introducing custom exception types. Key Changes:
Impact: Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant LLMRails
participant ActionDispatcher
participant LLMUtils
participant LLMProvider
participant ExceptionHandler
User->>LLMRails: generate_async(messages)
LLMRails->>ActionDispatcher: execute_action()
ActionDispatcher->>LLMUtils: llm_call(llm, prompt)
LLMUtils->>LLMUtils: _invoke_with_string_prompt/message_list()
alt LLM Call Succeeds
LLMUtils->>LLMProvider: llm.ainvoke(prompt)
LLMProvider-->>LLMUtils: response
LLMUtils-->>ActionDispatcher: response
ActionDispatcher-->>LLMRails: result
LLMRails-->>User: generated response
else LLM Call Fails
LLMUtils->>LLMProvider: llm.ainvoke(prompt)
LLMProvider-->>LLMUtils: Exception (e.g., ConnectionError)
LLMUtils->>LLMUtils: _raise_llm_call_exception(exception, llm)
LLMUtils->>LLMUtils: Extract model_name from llm_call_info_var or _infer_model_name()
LLMUtils->>LLMUtils: Extract endpoint_url from BASE_URL_ATTRIBUTES or client.base_url
LLMUtils->>ExceptionHandler: raise LLMCallException(exception, context_message)
ExceptionHandler-->>ActionDispatcher: LLMCallException with enriched context
ActionDispatcher->>ActionDispatcher: catch LLMCallException and re-raise
ActionDispatcher-->>LLMRails: LLMCallException
LLMRails-->>User: Error with model and endpoint details
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (2)
8 files reviewed, 2 comments
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, 1 comment
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, 1 comment
Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format
9c120c2 to
6405e09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
13 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
13 files reviewed, 1 comment
…del for text models
74b5891 to
fb0cc19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11 files reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 files reviewed, no comments
Description
An area of improvement we'd like to address in the NeMo Guardrails microservice is error messages. Specifically, they tend to lack enough context and are not actionable.
This PR contains a few changes around error handling:
Related Issue(s)
Checklist