Skip to main content

Wrapper library for openai to send events to the Imaginary Programming monitor

Project description

Imaginary Dev OpenAI wrapper



Documentation Status

Wrapper library for openai to send events to the Imaginary Programming monitor


  • Patches the openai library to allow user to set an ip_project_key for each request
  • Works out of the box with langchain

Get Started

At startup, before any openai calls, patch the library with the following code:

from im_openai import patch_openai

Then, set the ip_project_key for each request:

import openai

completion = openai.ChatCompletion.create(
    prompt="This is a test",

If you're using langchain, you can set the ip_project_key in the langchain llm setup:

llm = OpenAI(
    model_kwargs={"ip_prompt_project_key": "my_project_key"},


This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage_ project template.

.. _Cookiecutter: .. _audreyr/cookiecutter-pypackage:

======= History =======

0.1.0 (2023-06-20)

  • First release on PyPI.

0.1.1 (2023-06-23)

  • add TemplateString helper and support for data / params


  • add support for original template too

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

im_openai-0.1.2.tar.gz (11.2 kB view hashes)

Uploaded Source

Built Distribution

im_openai-0.1.2-py2.py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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