Wrapper library for openai to send events to the Imaginary Programming monitor
Project description
Imaginary Dev OpenAI wrapper
Wrapper library for openai to send events to the Imaginary Programming monitor
- Free software: MIT license
- Documentation: https://im-openai.readthedocs.io.
Features
- 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
patch_openai()
Then, set the ip_project_key for each request:
import openai
completion = openai.ChatCompletion.create(
engine="davinci",
prompt="This is a test",
ip_project_key="my_project_key"
)
If you're using langchain, you can set the ip_project_key in the langchain llm setup:
llm = OpenAI(
openai_api_key=os.environ["OPENAI_API_KEY"],
model_kwargs={"ip_prompt_project_key": "my_project_key"},
)
Credits
This package was created with Cookiecutter_ and the audreyr/cookiecutter-pypackage
_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _audreyr/cookiecutter-pypackage
: https://github.com/audreyr/cookiecutter-pypackage
======= History
0.1.0 (2023-06-20)
- First release on PyPI.
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
im_openai-0.1.1.tar.gz
(11.1 kB
view hashes)
Built Distribution
Close
Hashes for im_openai-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43e054eaea4ee36d185ab7878fe25f65c1743d94f26ed11038f4f8e2cc19b2cd |
|
MD5 | 0d3d9a91f9b9fc572b53549d5989e0b7 |
|
BLAKE2b-256 | 79be452687827a2eaddf5fac208afe9cd3f11069b7003ec730c88b09595a8a16 |