Created
November 26, 2024 05:34
-
-
Save mikegc-aws/07af103cf13dea1717af645873db629c to your computer and use it in GitHub Desktop.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import boto3\n", | |
"client = boto3.client('bedrock-agent-runtime', region_name='us-west-2')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"response = client.invoke_inline_agent(\n", | |
" actionGroups=[\n", | |
" {\n", | |
" 'actionGroupName': 'CodeInterpreterAction',\n", | |
" 'parentActionGroupSignature': 'AMAZON.CodeInterpreter'\n", | |
" },\n", | |
" ],\n", | |
" enableTrace=True,\n", | |
" endSession=False,\n", | |
" foundationModel='anthropic.claude-3-sonnet-20240229-v1:0',\n", | |
" inputText='Calculate the square root of 169 added to the sum of the fibonacci sequence up to 321.',\n", | |
" instruction='You are a helpful assistant who can perform complex calculations and return the outputs from running Python code.',\n", | |
" sessionId='session-1'\n", | |
")\n", | |
"\n", | |
"eventstream = response.get('completion')\n", | |
"\n", | |
"for event in eventstream:\n", | |
" print(event)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "base", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.14" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment