Skip to content

Document how one can provide a system prompt in RetrieveAndGenerateCommand. #7164

@sandrooco

Description

@sandrooco

Describe the issue

I'm using the @aws-sdk/client-bedrock-agent-runtime library to try building a RAG system. I'd like to provide a system prompt to provide some context for the model. The docs from RetrieveAndGenerateCommand don't provide any information about system prompts. How to do this?

Example code:

// This code works, but where can I put the system prompt?
const input = {
        sessionId: requestSessionId,
        input: {
          text: question,
        },
        retrieveAndGenerateConfiguration: {
          type: "KNOWLEDGE_BASE",
          knowledgeBaseConfiguration: {
            knowledgeBaseId: process.env.KNOWLEDGE_BASE_ID,
            modelArn: `arn:aws:bedrock:eu-central-2::foundation-model/anthropic.claude-3-5-sonnet-20240620-v1:0`,
          },
        },
      };
const command = new RetrieveAndGenerateCommand(input);
const response = await client.send(command);

Links

Docs: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent-runtime/command/RetrieveAndGenerateCommand/
Code is based on this example repo: https://github.com/aws-samples/amazon-bedrock-rag

Metadata

Metadata

Assignees

Labels

closed-for-stalenessdocumentationThis is a problem with documentation.p3This is a minor priority issueservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions