You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use prompt caching, according to the AWS Bedrock documentation, the system message needs to look like this:
...
"system": [
{
"text": "You are an app that creates play lists for a radio station that plays rock and pop music. Only return song names and the artist. "
},
{
"cachePoint": {
"type": "default"
}
}
],
...
However, when trying to do this as a SystemMessage through Langchain, I get the following error:
System message must be a string, instead was: <class 'list'> Traceback (most recent call last):
File "/home/shahar/ProjectData/AgentFramework/onvego/agent_framework/task_handler/internal.py", line 318, in __call__
If I initialize ChatBedrock with the flag beta_use_converse_api=True, then it does let me send a list - but when this list has the cachepoint object as specified:
{
"cachePoint": {
"type": "default",
}
}
I get an error stating:
Parameter validation failed:
Unknown parameter in system[1]: "cachePoint", must be one of: text, guardContent
This seems to make cache prompting impossible, unless I am missing something.
The text was updated successfully, but these errors were encountered:
ShaharZivanOnvego
changed the title
Prompt caching does not work, as it requires SystemMessage to be a list
Prompt caching does not work, cachePoint object not supported
Jan 14, 2025
Amazon Bedrock prompt caching is still in preview and as such, the new cachePoint parameter for system messages is not yet supported by botocore (see here).
We need botocore/boto3 to support the cachePoint parameter for system messages before langchain-aws can integrate it.
To use prompt caching, according to the AWS Bedrock documentation, the system message needs to look like this:
However, when trying to do this as a
SystemMessage
through Langchain, I get the following error:If I initialize ChatBedrock with the flag
beta_use_converse_api=True
, then it does let me send a list - but when this list has the cachepoint object as specified:I get an error stating:
This seems to make cache prompting impossible, unless I am missing something.
The text was updated successfully, but these errors were encountered: