-
Notifications
You must be signed in to change notification settings - Fork 20
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
Plfm 8720 #687
Merged
Merged
Plfm 8720 #687
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7a12899
try using JSON schema for functions
john-hill a717dea
try setting template from s3
john-hill 180c749
fixed errors
john-hill e4ad17a
converted schema to support annotations
john-hill d7f5e98
trying to extend the connection createtion timeout
john-hill f92bad8
removed unused dependency
john-hill 23b0701
grant bedrock access to s3
john-hill 31e73d9
changed the policy order to prevent breaking the test
john-hill 9d6845a
added test and parameters for Open API schema defined action group
john-hill 99c58b6
require confirmation on update
john-hill 0eac376
timeout might not be needed
john-hill cbc5e85
fixed error
john-hill 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 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 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
137 changes: 137 additions & 0 deletions
137
src/main/resources/templates/repo/agent/agent_open_api.json
This file contains 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 |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "CRUD Opperations Schema", | ||
"version": "v1" | ||
}, | ||
"paths": { | ||
"/entity/{entityId}/annotations": { | ||
"get": { | ||
"description": "Get the annotations of an entity.", | ||
"operationId": "orgSageOneEntityAnnotationsGet", | ||
"parameters": [ | ||
{ | ||
"name": "entityId", | ||
"description": "The 'syn' Id of the entity to get the annotations for.", | ||
"in": "path", | ||
"required": true, | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Auto-generated description", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/org.sagebionetworks.repo.model.annotation.v2.Annotations" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"put": { | ||
"description": "Set the annotations of an entity.", | ||
"operationId": "orgSageOneEntityAnnotationsPut", | ||
"x-requireConfirmation": "ENABLED", | ||
"parameters": [ | ||
{ | ||
"name": "entityId", | ||
"description": "The 'syn' of the target Entity.", | ||
"in": "path", | ||
"required": true, | ||
"schema": { | ||
"type": "string" | ||
} | ||
} | ||
], | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/org.sagebionetworks.repo.model.annotation.v2.Annotations" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"201": { | ||
"description": "the updated annotations", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/org.sagebionetworks.repo.model.annotation.v2.Annotations" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"org.sagebionetworks.repo.model.annotation.v2.Annotations": { | ||
"type": "object", | ||
"description": "Each annotation is a key-value pair of metadata for an Entity.", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"description": "The 'syn' ID of the Entity" | ||
}, | ||
"etag": { | ||
"type": "string", | ||
"description": "The current etag of the Entity. The etag of an Entity will change each time an Entity is updated. An annotations update request will be rejected if provided etag does not match the current etag of the Entity." | ||
}, | ||
"annotations": { | ||
"type": "object", | ||
"description": "Annotations are a map of key-value pairs. The key is the name of the annotation. The value is an object.", | ||
"additionalProperties": { | ||
"$ref": "#/components/schemas/org.sagebionetworks.repo.model.annotation.v2.AnnotationsValue" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"id", | ||
"etag", | ||
"annotations" | ||
] | ||
}, | ||
"org.sagebionetworks.repo.model.annotation.v2.AnnotationsValue": { | ||
"type": "object", | ||
"description": "This object defines the value of an annotation.", | ||
"properties": { | ||
"type": { | ||
"$ref": "#/components/schemas/org.sagebionetworks.repo.model.annotation.v2.AnnotationsValueType" | ||
}, | ||
"value": { | ||
"type": "array", | ||
"description": "The annotation's value must include one or more strings. See the 'type' to determine how each string should be parsed. An empty array is not allowed.", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"type", | ||
"value" | ||
] | ||
}, | ||
"org.sagebionetworks.repo.model.annotation.v2.AnnotationsValueType": { | ||
"type": "string", | ||
"description": "The annotation's type defines how each string value should be parsed.", | ||
"enum": [ | ||
"STRING", | ||
"DOUBLE", | ||
"LONG", | ||
"TIMESTAMP_MS", | ||
"BOOLEAN" | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -18,11 +18,32 @@ | |
"Type": "String", | ||
"Default": "This knowledge base contains the Synapse help documentation. You can use it to answer questions around Synapse usage and its features.", | ||
"MaxLength": 200 | ||
}, | ||
"openApiSchemaS3Bucket": { | ||
"Description": "The name of the S3 bucket containing the Open API Schema definition JSON file.", | ||
"Type": "String", | ||
"AllowedPattern": "^([0-9a-zA-Z][_-]?){1,100}$" | ||
}, | ||
"openApiSchemaS3Key": { | ||
"Description": "The S3 key of the Open API Schema definition JSON file.", | ||
"Type": "String", | ||
"AllowedPattern": "^([0-9a-zA-Z][_-]?){1,100}$" | ||
} | ||
}, | ||
"Conditions": { | ||
"AttachKnowledgeBase": {"Fn::Not": [{"Fn::Equals" : [{"Ref" : "knowledgeBaseId"}, ""]}]} | ||
}, | ||
"AttachKnowledgeBase": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Equals": [ | ||
{ | ||
"Ref": "knowledgeBaseId" | ||
}, | ||
"" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"Resources": { | ||
"bedrockAgentRole": { | ||
"Type": "AWS::IAM::Role", | ||
|
@@ -59,7 +80,7 @@ | |
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"Action": [ | ||
"bedrock:InvokeModel", | ||
"bedrock:InvokeModelWithResponseStream" | ||
], | ||
|
@@ -70,23 +91,29 @@ | |
] | ||
}, | ||
{ | ||
"Fn::If" : [ "AttachKnowledgeBase", | ||
"Fn::If": [ | ||
"AttachKnowledgeBase", | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"bedrock:Retrieve", | ||
"bedrock:RetrieveAndGenerate" | ||
], | ||
"Resource": [ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"bedrock:Retrieve", | ||
"bedrock:RetrieveAndGenerate" | ||
], | ||
"Resource": [ | ||
{ | ||
"Fn::Sub": "arn:aws:bedrock:${AWS::Region}:${AWS::AccountId}:knowledge-base/${knowledgeBaseId}" | ||
} | ||
] | ||
}, | ||
] | ||
}, | ||
{ | ||
"Ref" : "AWS::NoValue" | ||
"Ref": "AWS::NoValue" | ||
} | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": "s3:*", | ||
"Resource": "*" | ||
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. Read should be enough? |
||
} | ||
] | ||
} | ||
|
@@ -164,25 +191,52 @@ | |
] | ||
}, | ||
"SkipResourceInUseCheckOnDelete": false | ||
}, | ||
{ | ||
"ActionGroupExecutor": { | ||
"CustomControl": "RETURN_CONTROL" | ||
}, | ||
"ActionGroupName": "org_sage_one", | ||
"ActionGroupState": "ENABLED", | ||
"Description": "These functions can be used to make data changes in Synapse.", | ||
"ApiSchema": { | ||
"S3": { | ||
"S3BucketName": { | ||
"Ref": "openApiSchemaS3Bucket" | ||
}, | ||
"S3ObjectKey": { | ||
"Ref": "openApiSchemaS3Key" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"AgentName": { "Ref" : "agentName" }, | ||
"AgentName": { | ||
"Ref": "agentName" | ||
}, | ||
"AgentResourceRoleArn": { | ||
"Fn::GetAtt": [ | ||
"bedrockAgentRole", | ||
"Arn" | ||
] | ||
}, | ||
"KnowledgeBases": { | ||
"Fn::If" : [ "AttachKnowledgeBase", | ||
[{ | ||
"KnowledgeBaseId" : { "Ref" : "knowledgeBaseId" }, | ||
"Description" : { "Ref" : "knowledgeBaseDescription" } | ||
}], | ||
"Fn::If": [ | ||
"AttachKnowledgeBase", | ||
[ | ||
{ | ||
"KnowledgeBaseId": { | ||
"Ref": "knowledgeBaseId" | ||
}, | ||
"Description": { | ||
"Ref": "knowledgeBaseDescription" | ||
} | ||
} | ||
], | ||
{ | ||
"Ref" : "AWS::NoValue" | ||
} | ||
] | ||
"Ref": "AWS::NoValue" | ||
} | ||
] | ||
}, | ||
"AutoPrepare": true, | ||
"Description": "Test of the use of actions groups to allow the agent to make Synapse API calls.", | ||
|
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.
Instead of the UUID, the stack + instance should be enough for defining a version.