Below is the documentation for integrating Reconify with Anthropic via REST API.
Currently we support chat and completions on Anthropic via REST API.
If you are integrating with Amazon Bedrock, refer to the Bedrock Rest documentation.
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 copy of the JSON input into Anthropic (i.e. the prompts) and the response from Anthropic, 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": "anthropic",
"type": "chat",
"version": "2.1.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": {
"model": "claude-2",
"max_tokens_to_sample": 300,
"prompt": "\n\nHuman: Tell me a cat joke\n\nAssistant:"
}
}
{
"response": {
"completion": "Here's a silly cat joke:\n\nWhy don't cats play poker in the jungle? Too many cheetahs!",
"stop_reason": "stop_sequence",
"model": "claude-2.1",
"stop": "\n\nHuman:",
"log_id": "1106334994b78ba877c8f4ce0442910640381ae54b819019e134ce717867d339"
}
}
Below is an example JSON to post to the endpoint for a chat message.
{
"reconify": {
"format": "anthropic",
"type": "chat",
"version": "3.0.0",
"appKey": process.env.RECONIFY_APP_KEY,
"apiKey": process.env.RECONIFY_API_KEY
},
"timestamps": {
"request": 1709495294482,
"response": 1709495296398
},
"user": {
"userId": "ABC123",
"firstName": "Jane",
"lastNam": "Doe"
},
"request": {
"model": "claude-2.1",
"max_tokens": 300,
"messages": [
{
"role": "user",
"content": "Tell me a cat joke"
}
],
"system": "you are a comic"
},
"response": {
"id": "msg_01P73dhZUgZ51JTkiFMgVopJ",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Here's a silly cat joke:\n\nWhy don't cats play poker in the jungle? Too many cheetahs!"
}
],
"model": "claude-2.1",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 18,
"output_tokens": 29
}
}
}
Below is an example JSON to post to the endpoint for a completion.
{
"reconify": {
"format": "anthropic",
"type": "completion",
"version": "2.1.0",
"appKey": process.env.RECONIFY_APP_KEY,
"apiKey": process.env.RECONIFY_API_KEY
},
"timestamps": {
"request": 1701391185825,
"response": 1701391187868
},
"user": {
"userId": "ABC123",
"firstName": "Jane",
"lastNam": "Doe"
},
"request": {
"model": "claude-2",
"max_tokens_to_sample": 300,
"prompt": "\n\nHuman: Tell me a cat joke\n\nAssistant:"
},
"response": {
"completion": " Here's a silly cat joke:\n\nWhy don't cats play poker in the jungle? Too many cheetahs!",
"stop_reason": "stop_sequence",
"model": "claude-2.1",
"stop": "\n\nHuman:",
"log_id": "1106334994b78ba877c8f4ce0442910640381ae54b819019e134ce717867d339"
}
}