Skip to content

Commit 1db42f6

Browse files
committed
caching the first prompt
1 parent 3c81823 commit 1db42f6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/idp_common_pkg/idp_common/extraction/agentic_idp.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from strands import Agent, tool
3030
from strands.agent.conversation_manager import SummarizingConversationManager
3131
from strands.models.bedrock import BedrockModel
32-
from strands.types.content import ContentBlock, Message
32+
from strands.types.content import CachePoint, ContentBlock, Message
3333
from strands.types.media import (
3434
DocumentContent,
3535
ImageContent,
@@ -725,15 +725,21 @@ async def structured_output_async(
725725
format="png", source=ImageSource(bytes=img_bytes)
726726
)
727727
),
728+
ContentBlock(cachePoint=CachePoint(type="default")),
728729
],
729730
)
730731
]
731732
elif isinstance(prompt, dict) and "content" in prompt:
732733
prompt_content = [prompt]
733-
# Extract and store images as binary strings
734734
else:
735735
prompt_content = [
736-
Message(role="user", content=[ContentBlock(text=str(prompt))])
736+
Message(
737+
role="user",
738+
content=[
739+
ContentBlock(text=str(prompt)),
740+
ContentBlock(cachePoint=CachePoint(type="default")),
741+
],
742+
)
737743
]
738744

739745
# Track token usage

0 commit comments

Comments
 (0)