-
Notifications
You must be signed in to change notification settings - Fork 18
feat: add persona to agent settings (DEVP-624) #294
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7c78b06
feat: add persona to agent settings (DEVP-624)
toswe 917202d
docs: frame persona as replacing personality and role, drop flag refe…
toswe 5f76303
feat: remove personality and role, superseded by the persona
toswe 5d468f4
fix: accept attribute references in the persona
toswe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,9 @@ | |
| Pronunciation, | ||
| Resource, | ||
| ResourceMapping, | ||
| SettingsPersona, | ||
| SettingsPersonality, | ||
| SettingsRole, | ||
| SubResource, | ||
| TestCase, | ||
| Topic, | ||
|
|
@@ -121,6 +124,8 @@ class AgentStudioProject: | |
| # before they are saved. | ||
| _not_loaded_resources: list[ResourceType] = None | ||
|
|
||
| push_warnings: list[str] = None | ||
|
|
||
| @property | ||
| def all_resources(self) -> list[Resource]: | ||
| """Get all resources in the project""" | ||
|
|
@@ -1199,6 +1204,8 @@ def push_project( | |
| - List of commands serialized to protobuf. | ||
| """ | ||
|
|
||
| self.push_warnings = [] | ||
|
|
||
| if not dry_run: | ||
| # If force, load latest version of the project | ||
| # to compare against | ||
|
|
@@ -1287,6 +1294,19 @@ def push_project( | |
| updated_resources.update(subresource_changes.updated) | ||
| deleted_resources.update(subresource_changes.deleted) | ||
|
|
||
| if new_state.get(SettingsPersona): | ||
| shadowed = [ | ||
| resource.file_path | ||
| for resource_type in (SettingsPersonality, SettingsRole) | ||
| for resource in updated_resources.get(resource_type, {}).values() | ||
| ] | ||
| if shadowed: | ||
| self.push_warnings.append( | ||
| f"{', '.join(sorted(shadowed))} changed, but this project uses " | ||
| f"{next(iter(new_state[SettingsPersona].values())).file_path} — " | ||
| "personality and role no longer affect the Role field in Agent Studio." | ||
| ) | ||
|
|
||
| if not (updated_resources or new_resources or deleted_resources): | ||
| return False, "No changes detected", [] | ||
|
|
||
|
|
@@ -1533,6 +1553,10 @@ def _clean_resources_before_push( | |
| queue_command=lambda command: self.api_handler.queue_command(command), | ||
| ) | ||
|
|
||
| # There is no create_persona command; authoring a persona is an update. | ||
| if new_personas := new_resources.pop(SettingsPersona, None): | ||
| updated_resources.setdefault(SettingsPersona, {}).update(new_personas) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? pre push we do a pull, that should mean it exists
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed. |
||
|
|
||
| return PushPhaseChangeSet( | ||
| main=ResourceChangeSet( | ||
| new=new_resources, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we should just deprecate, so not even read them
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.
Removed as well.