-
Notifications
You must be signed in to change notification settings - Fork 596
feat: New top-level scaffold #1613
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
… methods to Guardrails object
Greptile OverviewGreptile SummaryThis PR introduces a new top-level Key changes:
The implementation correctly delegates all calls to the underlying
|
| Filename | Overview |
|---|---|
| nemoguardrails/init.py | Adds environment variable based wrapper selection to conditionally use new Guardrails class |
| nemoguardrails/guardrails/guardrails.py | New wrapper class providing simplified API by delegating to LLMRails, includes message format conversion |
| tests/guardrails/test_guardrails.py | Comprehensive unit tests with mocked LLMRails covering all Guardrails methods |
Sequence Diagram
sequenceDiagram
participant User
participant Guardrails
participant LLMRails
participant LLM
User->>Guardrails: __init__(config, llm, verbose)
Guardrails->>LLMRails: __init__(config, llm, verbose)
LLMRails-->>Guardrails: llmrails instance
Guardrails-->>User: Guardrails instance
User->>Guardrails: generate(prompt="Hello")
Guardrails->>Guardrails: _convert_to_messages(prompt)
Note over Guardrails: Converts to [{"role": "user", "content": "Hello"}]
Guardrails->>LLMRails: generate(messages=[...])
LLMRails->>LLM: Process with guardrails
LLM-->>LLMRails: Response
LLMRails-->>Guardrails: Response
Guardrails-->>User: Response
User->>Guardrails: generate_async(messages=[...])
Guardrails->>Guardrails: _convert_to_messages(messages)
Guardrails->>LLMRails: generate_async(messages=[...])
LLMRails->>LLM: Process with guardrails
LLM-->>LLMRails: Response
LLMRails-->>Guardrails: Response
Guardrails-->>User: Response
User->>Guardrails: update_llm(new_llm)
Guardrails->>LLMRails: update_llm(new_llm)
LLMRails-->>Guardrails: Updated
Guardrails-->>User: Updated
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.
3 files reviewed, 1 comment
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@greptile re-check and update comments above including score |
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.
3 files reviewed, no comments
Description
Create new top-level class in which to build new functionality outside of LLMRails. This is currently empty, and exposes the following methods from LLMRails:
The methods are either implementation-specific, or support advanced use-cases that aren't in-scope for the new top-level class. These may be added in follow-on PRs as needed.
state (core Colang 2.x runtime method)
Test Plan
Chat
Server
Server
Client
Related Issue(s)
Checklist