Skip to main content

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.

There are additional optional parameters as well:

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,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reconify-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reconify-1.0.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file reconify-1.0.1.tar.gz.

File metadata

  • Download URL: reconify-1.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for reconify-1.0.1.tar.gz
Algorithm Hash digest
SHA256 25cb424835f6a6deb177b260d5acdd5a763bc8898c96867587f0ec14e4bd0bb6
MD5 160bb170cd53a07d6f66d23a6571d383
BLAKE2b-256 3cfb3847e911dfec9f30147b81d6650338535fe89f3e8b93efe0cf07509a37b2

See more details on using hashes here.

File details

Details for the file reconify-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: reconify-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for reconify-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e4deee9b55f3c451a6b68f4d429e3f333828f4e3f56bd0eb7be6a6f0639f240a
MD5 a9e03311306af8d7dbb4b4b6587000d0
BLAKE2b-256 9a96e4155f2b54de302b342b79f89b76d03ee06b9b60cdf5270218512e831cc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page