1 Respuesta
- Más nuevo
- Más votos
- Más comentarios
0
This issue occurs because there are two different ways to interact with Bedrock Agents, each using different prompts:
- Bedrock Console (UI) Interaction:
- Uses the Knowledge Base orchestration prompt you configured
- Follows the custom prompt settings you defined in the agent configuration
- Boto3 API Interaction:
- By default, uses the standard API orchestration prompt
- Doesn't automatically use the custom prompt settings from the console
To resolve this, you have a few options:
- Pass the custom prompt explicitly in your boto3 call:
response = bedrock_client.invoke_agent( agentId=agent_id, agentAliasId=agent_alias_id, sessionId='techlead', endSession=False, inputText="what is product X?", orchestrationConfiguration={ "promptOverride": "Your custom prompt here" } )
- Use the prepare_agent API call first:
prepare_response = bedrock_client.prepare_agent( agentId=agent_id, agentAliasId=agent_alias_id, sessionId='techlead', orchestrationConfiguration={ "promptOverride": "Your custom prompt here" } ) response = bedrock_client.invoke_agent( agentId=agent_id, agentAliasId=agent_alias_id, sessionId='techlead', endSession=False, inputText="what is product X?" )
- Update your agent's default orchestration configuration through the AWS CLI or API, so it's consistent across all interaction methods.
The key is to ensure the orchestration configuration is properly set when making API calls. The console automatically handles this for you, but with boto3, you need to explicitly manage it.
Also, make sure you're using the latest version of boto3, as earlier versions might have different behavior regarding prompt handling.
respondido hace 5 meses
Contenido relevante
- preguntada hace 5 meses
- preguntada hace 4 meses
- preguntada hace 12 días
- preguntada hace 15 días
- OFICIAL DE AWSActualizada hace 4 meses
- OFICIAL DE AWSActualizada hace 6 meses
