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.
0.1.1 (2023-06-23)
- add TemplateString helper and support for data / params
0.1.2(2023-06-23)
- add support for original template too
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
Hashes for im_openai-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cad41c4652bd777d48431fd89fa43b1e10c03b8c7e820f020d3591cb8f0d0692 |
|
MD5 | 974dea79cdbe46ed0fd93e453ce4e70c |
|
BLAKE2b-256 | b03b82acd6fcbccc485f7a71acb908ef4bd767db0d54feb7bb565365a32410ea |