Skip to content

Commit fcd785f

Browse files
committed
Updates for brackets and README.
1 parent bfad5ca commit fcd785f

File tree

4 files changed

+13
-71
lines changed

4 files changed

+13
-71
lines changed

python/example_code/bedrock-agent/README.md

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ Code excerpts that show you how to call individual service functions.
4444
- [CreateFlow](flows/flow.py#L18)
4545
- [CreateFlowAlias](flows/flow_alias.py#L15)
4646
- [CreateFlowVersion](flows/flow_version.py#L18)
47-
- [CreateKnowledgeBase](knowledge_bases/knowledge_base.py#L29)
47+
- [CreateKnowledgeBase](knowledge_bases/knowledge_base.py#L30)
4848
- [CreatePrompt](prompts/prompt.py#L18)
4949
- [CreatePromptVersion](prompts/prompt.py#L84)
5050
- [DeleteAgent](bedrock_agent_wrapper.py#L118)
5151
- [DeleteAgentAlias](bedrock_agent_wrapper.py#L139)
5252
- [DeleteFlow](flows/flow.py#L155)
5353
- [DeleteFlowAlias](flows/flow_alias.py#L98)
5454
- [DeleteFlowVersion](flows/flow_version.py#L91)
55-
- [DeleteKnowledgeBase](knowledge_bases/knowledge_base.py#L165)
55+
- [DeleteKnowledgeBase](knowledge_bases/knowledge_base.py#L167)
5656
- [DeletePrompt](prompts/prompt.py#L159)
5757
- [GetAgent](bedrock_agent_wrapper.py#L161)
5858
- [GetFlow](flows/flow.py#L192)
5959
- [GetFlowVersion](flows/flow_version.py#L54)
60-
- [GetKnowledgeBase](knowledge_bases/knowledge_base.py#L86)
60+
- [GetKnowledgeBase](knowledge_bases/knowledge_base.py#L88)
6161
- [GetPrompt](prompts/prompt.py#L124)
6262
- [ListAgentActionGroups](bedrock_agent_wrapper.py#L208)
6363
- [ListAgentKnowledgeBases](bedrock_agent_wrapper.py#L237)
6464
- [ListAgents](bedrock_agent_wrapper.py#L185)
6565
- [ListFlowAliases](flows/flow_alias.py#L132)
6666
- [ListFlowVersions](flows/flow_version.py#L128)
6767
- [ListFlows](flows/flow.py#L229)
68-
- [ListKnowledgeBases](knowledge_bases/knowledge_base.py#L195)
68+
- [ListKnowledgeBases](knowledge_bases/knowledge_base.py#L197)
6969
- [ListPrompts](prompts/prompt.py#L191)
7070
- [PrepareAgent](bedrock_agent_wrapper.py#L266)
7171
- [PrepareFlow](flows/flow.py#L58)
7272
- [UpdateFlow](flows/flow.py#L112)
7373
- [UpdateFlowAlias](flows/flow_alias.py#L55)
74-
- [UpdateKnowledgeBase](knowledge_bases/knowledge_base.py#L116)
74+
- [UpdateKnowledgeBase](knowledge_bases/knowledge_base.py#L118)
7575

7676
### Scenarios
7777

@@ -95,6 +95,7 @@ functions within the same service.
9595
<!--custom.instructions.end-->
9696

9797

98+
9899
#### Create and invoke a flow
99100

100101
This example shows you how to do the following:
@@ -119,36 +120,11 @@ Start the example by running the following at a command prompt:
119120
python flows/playlist_flow.py
120121
```
121122

122-
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockFlows.start-->
123-
124-
When prompted, enter the genre of music and the number of songs you want
125-
in the playlist.
126-
Optionally, the script can delete the resources that it creates. If you want to use the flow later, such as in the Amazon Bedrock console, enter `n` when the script prompts you to delete resources. Note that you will then need to manually delete the resources.
127-
128-
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockFlows.end-->
129-
130-
131-
#### Create and invoke a managed prompt
132-
133-
This example shows you how to do the following:
134-
135-
- Create a managed prompt.
136-
- Create a version of the prompt.
137-
- Invoke the prompt using the version.
138-
- Clean up resources (optional).
139-
140-
<!--custom.scenario_prereqs.bedrock-agent_GettingStartedWithBedrockPrompts.start-->
141-
<!--custom.scenario_prereqs.bedrock-agent_GettingStartedWithBedrockPrompts.end-->
142-
143-
Start the example by running the following at a command prompt:
144123

145-
```
146-
python prompts/scenario_get_started_with_prompts.py
147-
```
148124
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockFlows.start-->
149125
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockFlows.end-->
150126

151-
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockPrompts.start-->
127+
#### Create and invoke a managed prompt
152128

153129
This example shows you how to do the following:
154130

@@ -174,19 +150,6 @@ python prompts/scenario_get_started_with_prompts.py
174150

175151
This example shows you how to do the following:
176152

177-
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockPrompts.end-->
178-
179-
#### Create and invoke an agent
180-
181-
This example shows you how to do the following:
182-
183-
- Create an execution role for the agent.
184-
- Create the agent and deploy a DRAFT version.
185-
- Create a Lambda function that implements the agent's capabilities.
186-
- Create an action group that connects the agent to the Lambda function.
187-
- Deploy the fully configured agent.
188-
- Invoke the agent with user-provided prompts.
189-
- Delete all created resources.
190153
- Create an execution role for the agent.
191154
- Create the agent and deploy a DRAFT version.
192155
- Create a Lambda function that implements the agent's capabilities.

python/example_code/bedrock-agent/knowledge_bases/knowledge_base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import uuid
2323
import time
2424
from botocore.exceptions import ClientError
25-
from roles import create_knowledge_base_role, delete_knowledge_base_role
25+
from knowledge_bases.roles import create_knowledge_base_role, delete_knowledge_base_role
2626

2727
logger = logging.getLogger(__name__)
2828

@@ -58,13 +58,14 @@ def create_knowledge_base(bedrock_agent_client, name, role_arn, description=None
5858
# you can use the quick-create flow to have Knowledge Bases create the collection for you.
5959
"opensearchServerlessConfiguration": {
6060
"collectionArn": "arn:aws:aoss:us-east-1::123456789012:collection/abcdefgh12345678defgh",
61+
"fieldMapping": {
6162
"metadataField": "metadata",
6263
"textField": "text",
6364
"vectorField": "vector"
64-
},
65+
},
6566
"vectorIndexName": "test-uuid"
66-
}
67-
},
67+
},
68+
},
6869
"clientToken": "test-client-token-" + str(uuid.uuid4())
6970
}
7071

python/example_code/bedrock-agent/test/test_knowledge_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_create_knowledge_base(make_stubber, error_code):
7979
"storageConfiguration": {
8080
"type": "OPENSEARCH_SERVERLESS",
8181
"opensearchServerlessConfiguration": {
82-
"collectionArn": "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v1",
82+
"collectionArn": "arn:aws:aoss:us-east-1::123456789012:collection/abcdefgh12345678defgh",
8383
"fieldMapping": {
8484
"metadataField": "metadata",
8585
"textField": "text",

python/example_code/bedrock-runtime/README.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -183,28 +183,6 @@ python ../bedrock-agent/prompts/scenario_get_started_with_prompts.py
183183
```
184184

185185

186-
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockPrompts.start-->
187-
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockPrompts.end-->
188-
189-
#### Create and invoke a managed prompt
190-
191-
This example shows you how to do the following:
192-
193-
- Create a managed prompt.
194-
- Create a version of the prompt.
195-
- Invoke the prompt using the version.
196-
- Clean up resources (optional).
197-
198-
<!--custom.scenario_prereqs.bedrock-agent_GettingStartedWithBedrockPrompts.start-->
199-
<!--custom.scenario_prereqs.bedrock-agent_GettingStartedWithBedrockPrompts.end-->
200-
201-
Start the example by running the following at a command prompt:
202-
203-
```
204-
python ../bedrock-agent/prompts/scenario_get_started_with_prompts.py
205-
```
206-
207-
208186
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockPrompts.start-->
209187
<!--custom.scenarios.bedrock-agent_GettingStartedWithBedrockPrompts.end-->
210188

0 commit comments

Comments
 (0)