Open ylwu-amzn opened 3 months ago
Here are some examples of RAG search pipeline requests that I used:
{
"_source": ["text"],
"query" : {
"match": {"text": "president"}
},
"ext": {
"generative_qa_parameters": {
"llm_model": "bedrock-converse/anthropic.claude-3-5-sonnet-20240620-v1:0",
"system_prompt": "You are a helpful assistant",
"context_size": 5,
"message_size": 5,
"timeout": 60,
"llm_messages": [
{ "role": "user", "content": [{"type": "text", "text": "use the information from the attached document to tell me something interesting about lincoln"},
{"document": {"format": "pdf", "name": "lincoln", "data": "<base64 encoded string>"}}] }
]
}
}
}
{
"_source": ["text"],
"query" : {
"match": {"text": "president"}
},
"ext": {
"generative_qa_parameters": {
"llm_model": "bedrock-converse/anthropic.claude-3-5-sonnet-20240620-v1:0",
"context_size": 5,
"message_size": 5,
"timeout": 60,
"llm_messages": [
{ "role": "user", "content": [
{"image": {"format": "jpeg", "data": "<base64 encoded string"}},
{"text": "Can you image Lincoln or any other figured mentioned in the attached document or search results in the scenary depicted in the image?"}
]}
]
}
}
}
{
"_source": ["text"],
"query" : {
"match": {"text": "president"}
},
"ext": {
"generative_qa_parameters": {
"llm_model": "bedrock-converse/anthropic.claude-3-5-sonnet-20240620-v1:0",
"timeout": 60,
"llm_messages": [
{ "role": "user", "content": [
{"document": {"format": "pdf", "name": "lincoln", "data": "<...>"}},
{"image": {"format": "jpeg", "data": "<...>"}},
{"text": "Can you image Lincoln or any other figured mentioned in the attached document or search results in the scenary depicted in the image?"}
]}
]
}
}
}
I tested with and without "system_prompt". If you include a system prompt, Bedrock (or Anthropic) includes some message about private (I guess it triggers some kind of guardrail). Otherwise, the same answer.
{
"name": "Bedrock Connector: claude 3",
"description": "The connector to bedrock claude 3 model",
"version": 1,
"protocol": "aws_sigv4",
"parameters": {
"region": "us-west-2",
"service_name": "bedrock",
"model": "anthropic.claude-3-sonnet-20240229-v1:0",
"system_prompt": "You are a helpful assistant."
},
"credential": {
"access_key": "...",
"secret_key": "...",
"session_token": "..."
},
"actions": [
{
"action_type": "predict",
"method": "POST",
"headers": {
"content-type": "application/json"
},
"url": "https://bedrock-runtime.us-west-2.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1:0/converse",
"request_body": "{\"system\": [{\"text\": \"${parameters.system_prompt}\"}], \"messages\": ${parameters.messages} , \"inferenceConfig\": {\"temperature\": 0.0, \"topP\": 0.9, \"maxTokens\": 1000} }"
}
]
}
@ylwu-amzn ^^
Build blueprint for Bedrock converse API https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html