Skip to content

Commit cd62449

Browse files
committed
caching the first prompt
1 parent add6377 commit cd62449

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/idp_common_pkg/idp_common/extraction/agentic_idp.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@
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,
3636
ImageSource,
3737
)
38+
from strands.types.streaming import ContentBlockDeltaToolUse
3839

3940
from idp_common.bedrock.client import CACHEPOINT_SUPPORTED_MODELS
4041
from idp_common.utils.strands_agent_tools.todo_list import (
@@ -725,15 +726,21 @@ async def structured_output_async(
725726
format="png", source=ImageSource(bytes=img_bytes)
726727
)
727728
),
729+
ContentBlock(cachePoint=CachePoint(type="default")),
728730
],
729731
)
730732
]
731733
elif isinstance(prompt, dict) and "content" in prompt:
732734
prompt_content = [prompt]
733-
# Extract and store images as binary strings
734735
else:
735736
prompt_content = [
736-
Message(role="user", content=[ContentBlock(text=str(prompt))])
737+
Message(
738+
role="user",
739+
content=[
740+
ContentBlock(text=str(prompt)),
741+
ContentBlock(cachePoint=CachePoint(type="default")),
742+
],
743+
)
737744
]
738745

739746
# Track token usage

0 commit comments

Comments
 (0)