Below is the documentation for integration Reconify with Amazon Bedrock Runtime via REST API.
Currently the REST API for Bedrock ony supports Chat actions with the following foundational models: Amazon Titan, AI21 Jurassic, Anthropic Claude, Cohere Command, Meta Llama 2, and Mistral. For image support with Stable Diffusion or Amazon Titan, try the Node NPM or Python PIP modules.
The first step is to create an account at app.reconify.com.
In the Reconify console, add an Application to your account. This will generate both an API_KEY and an APP_KEY which will be used in the code below to send data to Reconify.
Below are instructions on integrating with the REST API.
At a high level, you will send a JSON copy of the same input into the Bedrock Runtime invoke_model() method, and a copy of the response body, along with your Reconify API and APP keys. There are additional optional parameters for tracking users and sessions.
Sign up for an account to get the endpoint url.
{
"reconify": {},
"timestamps": {},
"session": "",
"sessionTimeOut": null,
"user": {},
"request": {},
"response": {}
}
{
"reconify": {
"format": "bedrock",
"type": "chat",
"version": "1.0.0",
"appKey": process.env.RECONIFY_APP_KEY,
"apiKey": process.env.RECONIFY_API_KEY
}
}
{
"timestamps": {
"request": 1686091778298,
"response": 1686091844345
}
}
{
"session": "ABCDEF123456",
"sessionTimeout": 10
}
{
"user: {
"userId": "ABC123",
"isAuthenticated": 1,
"firstName": "Jane",
"lastName": "Doe",
"email": "some_email",
"phone": "555-555-5555",
"gender": "female"
}
}
{
"request": {
"modelId": "anthropic.claude-instant-v1",
"contentType": "application/json",
"accept": "application/json",
"body": "{\"prompt\":\"\\n\\nHuman: Tell a cat joke.\\n\\nAssistant:\", \"max_tokens_to_sample\":300, \"temperature\":1, \"top_k\":250, \"top_p\":0.999, \"stop_sequences\":[\"\\n\\nHuman:\"], \"anthropic_version\":\"bedrock-2023-05-31\"}"
}
}
{
"response": {
"requestId": "54425f31-4c82-426e-a69c-efe05c886cd0",
"body": {
"completion": " Here is a cat joke in the voice of Jerry Seinfeld:\n\nWhat's the deal with cats, huh? They sleep all day and then right when you're trying to relax after a long day, that's when they want to play. It's like 'Hey buddy, I just got home. Think I could have a little me time here? But no, the minute I sit down you bring me your favorite mouse toy. What's up with that?' \n\nAnd don't even get me started on the litter box thing. So they use a box filled with sand to do their business, but everything else in the house is fair game? I find litter all over. It's under the couch, behind the TV, in my sneakers. Like they're leaving me a trail of clues for some scavenger hunt. And it's not just a few pieces, it's clumps! Clumps of litter everywhere! \n\nYou know, cats are funny creatures. They wake you up at 4am just to be fed, but then during the day it's like 'Hey, buddy, what's your problem? Tryna take a nap here.' Am I right? The whole cat thing, it's just one big puzzle. What's the deal?",
"stop_reason": "stop_sequence"
}
}
Below is an example JSON to post to the endpoint.
{
"reconify": {
"format": "bedrock",
"type": "chat",
"version": "1.0.0",
"appKey": process.env.RECONIFY_APP_KEY,
"apiKey": process.env.RECONIFY_API_KEY
},
"timestamps": {
"request": 1696450259007,
"response": 1696450283264
},
"user": {
"userId": "ABC123",
"firstName": "Jane",
"lastName": "Doe"
},
"request": {
"modelId": "anthropic.claude-instant-v1",
"contentType": "application/json",
"accept": "application/json",
"body": "{\"prompt\":\"\n\nHuman: Create a cat joke in the voice of Jerry Seinfeld.\n\nAssistant:\", \"max_tokens_to_sample\":300, \"temperature\":1, \"top_k\":250, \"top_p\":0.999, \"stop_sequences\":[\"\n\nHuman:\"], \"anthropic_version\":\"bedrock-2023-05-31\"}"
},
"response": {
"requestId": "54425f31-4c82-426e-a69c-efe05c886cd0",
"body": {
"completion": " Here is a cat joke in the voice of Jerry Seinfeld:\n\nWhat's the deal with cats, huh? They sleep all day and then right when you're trying to relax after a long day, that's when they want to play. It's like 'Hey buddy, I just got home. Think I could have a little me time here? But no, the minute I sit down you bring me your favorite mouse toy. What's up with that?' \n\nAnd don't even get me started on the litter box thing. So they use a box filled with sand to do their business, but everything else in the house is fair game? I find litter all over. It's under the couch, behind the TV, in my sneakers. Like they're leaving me a trail of clues for some scavenger hunt. And it's not just a few pieces, it's clumps! Clumps of litter everywhere! \n\nYou know, cats are funny creatures. They wake you up at 4am just to be fed, but then during the day it's like 'Hey, buddy, what's your problem? Tryna take a nap here.' Am I right? The whole cat thing, it's just one big puzzle. What's the deal?",
"stop_reason": "stop_sequence"
}
}
}
Below is an example JSON to post to the endpoint.
{
"reconify": {
"format": "bedrock",
"type": "chat",
"version": "1.0.0",
"appKey": process.env.RECONIFY_APP_KEY,
"apiKey": process.env.RECONIFY_API_KEY
},
"timestamps": {
"request": 1696456064984,
"response": 1696456077201
},
"user": {
"userId": "ABC123",
"firstName": "Jane",
"lastName": "Doe"
},
"request": {
"modelId": "cohere.command-text-v14",
"contentType": "application/json",
"accept": "application/json",
"body": "{\"prompt\":\"Create a cat joke in the voice of Jerry Seinfeld.\", \"max_tokens\":400, \"temperature\":0.75, \"p\":0.01, \"k\":0, \"stop_sequences\":[], \"return_likelihoods\":\"NONE\"}"
},
"response": {
"requestId": "72aa53af-21ef-4b6e-8e1d-4bb23e85a0d2",
"body": {
"generations": [
{
"id": "08dbd029-273e-4674-bbe0-5e0687e78079",
"text": " Why did the cat go to the chiropractor?\nTo get its spine aligned."
}
],
"id": "72aa53af-21ef-4b6e-8e1d-4bb23e85a0d2",
"prompt": "Create a cat joke in the voice of Jerry Seinfeld."
}
}
}