Below is the documentation for integrating Reconify with Mistral via REST API.
Currently we support Chat actions with Mistral via REST API. Try our Node NPM or Python PIP modules as well.
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 Mistral (i.e. the prompts) and the response from Mistral, 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": "mistral",
"type": "chat",
"version": "2.4.0",
"appKey": process.env.RECONIFY_APP_KEY,
"apiKey": process.env.RECONIFY_API_KEY
}
}
{
"timestamps": {
"request": 1704758189001,
"response": 1704758196343
}
}
{
"session": "ABCDEF123456",
"sessionTimeout": 10
}
{
"user: {
"userId": "ABC123",
"isAuthenticated": 1,
"firstName": "Jane",
"lastName": "Doe",
"email": "some_email",
"phone": "555-555-5555",
"gender": "female"
}
}
{
"request": {
"model": "mistral-tiny",
"messages": [
{ "role": "user", "content" : "tell me a cat joke" }
],
"max_tokens": 200
}
}
{
"response": {
"id": "cmpl-abcdef1234",
"object": "chat.completion",
"created": 1704758196,
"model": "mistral-tiny",
"choices": [{
"index": 0,
"message" : {
"role" : "assistant",
"content" : "Why did the cat sit on the computer keyboard?\n\nHe wanted to purr-use the internet!"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 13,
"completion_tokens": 22,
"total_tokens": 35
}
Below is an example JSON to post to the endpoint for a Chat.
{
"reconify": {
"format": "mistral",
"type": "chat",
"version": "2.4.0",
"appKey": "RECONIFY_APP_KEY",
"apiKey": "RECONIFY_API_KEY"
},
"timestamps": {
"request": 1704748161152,
"response": 1704748168536
},
"user": {
"userId": "ABC123",
"firstName": "Jane",
"lastName": "Doe"
},
"request": {
"model": "mistral-tiny",
"messages": [
{ "role" : "user", "content": "Tell me a cat joke" }
]
},
"response": {
"id": "chatcmpl-abcdef",
"object": "chat.completion",
"created": 1704748168,
"model": "mistral-tiny",
"choices": [{
"index": 0,
"message": {
"role" : "assistant",
"content" : "Why did the cat sit on the ventilation duct?\n\nTo become a cat-alogue!'' (This one is for the cat lovers who also appreciate a good pun!)",
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 13,
"completion_tokens": 38,
"total_tokens": 51
}
}
}