Skip to content

Commit 8deb8c6

Browse files
xueyao-bai-mikerlhagerm
authored andcommitted
1,fix corss-region inference endpoint issue; 2,change pdf path by asking user input;
1 parent be10dbf commit 8deb8c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

python/example_code/bedrock-runtime/models/anthropic_claude/converse_stream_pdf.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
read_timeout=1000,
1313
)
1414
# Create a Bedrock Runtime client in the AWS Region you want to use.
15-
session = boto3.session.Session(region_name='us-west-2')
15+
session = boto3.session.Session(region_name='us-east-1')
1616
bedrock_runtime = session.client(service_name = 'bedrock-runtime',
1717
config=config)
18+
pdf_path = input("Enter the path to the PDF file: ")
1819
prompt = """
1920
Please analyze this PDF document and provide the following information:
2021
@@ -29,8 +30,8 @@
2930

3031
# Set the model ID
3132

32-
SONNET_V2_MODEL_ID = "anthropic.claude-3-5-sonnet-20241022-v2:0"
33-
33+
#SONNET_V2_MODEL_ID = "anthropic.claude-3-5-sonnet-20241022-v2:0"
34+
SONNET_V2_MODEL_ID = "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
3435
def optimize_reel_prompt(user_prompt,ref_image):
3536
# open PDF
3637
with open(ref_image, "rb") as f:
@@ -74,5 +75,5 @@ def optimize_reel_prompt(user_prompt,ref_image):
7475
return text
7576

7677
if __name__ == "__main__":
77-
txt = optimize_reel_prompt(prompt,"/Path/To/your.pdf")
78+
txt = optimize_reel_prompt(prompt,pdf_path)
7879
print(txt)

0 commit comments

Comments
 (0)