A package for sending data to the Reconify platform
Project description
Reconify PIP module
The Reconify module is used for sending data to the Reconify platform at www.reconify.com.
Currently the module supports processing and analyzing Chats and Completions from OpenAI. Support for additional actions and providers will be added.
Get started
The first step is to create an account at app.reconify.com.
Generate API and APP Keys
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.
Install the module
pip install reconify
Integrate the module in code
Import the module
from reconify import reconifyOpenAIHandler
Initialize the module
Prior to initializing the Reconify module, make sure to import the OpenaAI module.
import openai
openai.api_key = 'YOUR_OPENAI_KEY'
Configure the instance of Reconify passing the OpenAi instance along with the Reconify API_KEY and APP_KEY created above.
reconifyOpenAIHandler.config(openai,
appKey = 'Your_App_Key',
apiKey = 'Your_Api_Key'
)
This is all that is needed for a basic integration. The module takes care of sending the correct data to Reconify when you call openai.Completion.create or openai.ChatCompletion.create.
Optional Config Parameters
There are additional optional parameters that can be passed in to the handler.
- debug: (default False) Enable/Disable console logging
- trackImages: (default True) Turn on/off tracking of createImage
For example:
reconifyOpenAIHandler.config(openai,
appKey = 'Your_App_Key',
apiKey = 'Your_Api_Key',
debug = True
)
Optional methods
You can optionally pass in a user object or session ID to be used in the analytics reporting. The session ID will be used to group interactions together in the same session transcript.
Set a user
The user JSON should include a unique userId, all the other fields are optional. Without a unique userId, each user will be treated as a new user.
reconifyOpenAIHandler.setUser ({
"userId": "ABC123",
"isAuthenticated": 1,
"firstName": "Francis",
"lastName": "Smith",
"email": "",
"phone": "",
"gender": "female"
})
Set a Session ID
The Session ID is an alphanumeric string.
reconifyOpenAIHandler.setSession('MySessionId')
Set Session Timeout
Set the session timeout in minutes to override the default
reconifyOpenAIHandler.setSessionTimeout(15)
Examples
Chat Example
import os
import openai
from reconify import reconifyOpenAIHandler
openai.api_key = 'YOUR_OPENAI_KEY'
reconifyOpenAIHandler.config(openai, 'Your_App_Key', 'Your_Api_Key')
reconifyOpenAIHandler.setUser({
"userId": "12345",
"isAuthenticated": 1,
"firstName": "Jim",
"lastName": "Stand",
"gender": "male"
})
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are an expert on commedians."},
{"role": "user", "content": "Tell a joke about cats"},
],
temperature=0,
)
Completion Example
import os
import openai
from reconify import reconifyOpenAIHandler
openai.api_key = 'YOUR_OPENAI_KEY'
reconifyOpenAIHandler.config(openai, 'Your_App_Key', 'Your_Api_Key')
reconifyOpenAIHandler.setUser({
"userId": "12345",
"isAuthenticated": 1,
"firstName": "Jim",
"lastName": "Stand",
"gender": "male"
})
response = openai.Completion.create(
model = "text-davinci-003",
prompt = "write a haiku about cats",
max_tokens = 100,
temperature = 0,
)
Image Example
import os
import openai
from reconify import reconifyOpenAIHandler
openai.api_key = 'YOUR_OPENAI_KEY'
reconifyOpenAIHandler.config(openai, 'Your_App_Key', 'Your_Api_Key')
reconifyOpenAIHandler.setUser({
"userId": "12345",
"isAuthenticated": 1,
"firstName": "Jim",
"lastName": "Stand",
"gender": "male"
})
response = openai.Image.create(
prompt = "a cat on the moon",
n = 1,
size = "256x256"
response_format = "url"
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reconify-1.0.2.tar.gz.
File metadata
- Download URL: reconify-1.0.2.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51b797bd4ae44dc188f42e2db3eb9f1b1e9b17c6daa22788e1f0662ff4550f89
|
|
| MD5 |
06b17cda8e9023ba826816d8b73ef9ee
|
|
| BLAKE2b-256 |
1722a710965401032ee8928a7f95b6c18d3f3a09b0c503f2a5bd86d0cf80e222
|
File details
Details for the file reconify-1.0.2-py3-none-any.whl.
File metadata
- Download URL: reconify-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14085b16cdbfa8c76e208b0bb16085ef2bec006540479b96c1a78bec85e3510a
|
|
| MD5 |
a1e7cd9c933d2a07e263d5c7b13eddf2
|
|
| BLAKE2b-256 |
481099361e249634fb901d6ca59790bf10530576f5fa7b67c4430e5c9d4c67b2
|