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

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.0.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.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: reconify-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 1f0b68048d166ccd6745a7472b6f8cae074058c72be42600b038fff42f92ad65
MD5 535278323133620ad0cf6a6119135a59
BLAKE2b-256 6a0bc97a426c5d3f6a2929ccad6cc18b6428dcc2003c83de551ae5a53d945ee9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reconify-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f2dbaa1848c61362579447d2d3ad248cdbfb16795e193c159abc74ebb0fcd2a
MD5 692f38f607c21a2ebecf3c37fb013750
BLAKE2b-256 0036fa7d6f81f6d468ae1185a804c18309a14c89f54d90cc474320eec9de1765

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