Designed to streamline and simplify your AI workflows, it offers Python typing support, error checking, and a smart usage meter to manage API costs efficiently. Plus, it features built-in examples with ChromaDB and efficient tools for prompt engineering.
Project description
Library is up to date with function calling. Reference oai_examples.ipynb to see functionality. All other docs including ipynb, templates, readme still need to be updated
aitemplates
aitemplates is a Python package designed to simplify and streamline your work with the OpenAI API. It provides Python typing support, error checking, and a usage meter to help manage API costs. Additionally, aitemplates offers built-in examples of using ChromaDB and tools for efficient prompt engineering with OpenAI.
Features
- Python Typing Support: Enjoy the benefits of Python's dynamic typing system while using OpenAI API.
- Error Checking: Automatically catch and handle errors during API calls.
- Usage Meter: Keep track of your OpenAI API usage with a built-in metering system.
- ChromaDB Integration: Work directly with ChromaDB from the aitemplates interface.
- Asynchronous Chat Completions: Use the
-asnc
flag to run asynchronous chat completions. The built-inprint_every
option prints every time a completion finishes in parallel. If a list is passed into theresponse_list
attribute, it updates that list as completions finish. If you'd like to maintain the order of your completions, pass in thekeep_order
boolean asTrue
. - Prompt Engineering Examples: Get started quickly with included examples of prompt engineering techniques.
Installation
You can install aitemplates directly from PyPI:
pip install aitemplates
To get the latest version of the package, you can also clone the repository and install the package by running pip install -e .
in the repository directory.
Creating Jupyter Notebook Templates
Create Jupyter notebook templates for prompt engineering with the following command:
aitemplates name_of_notebook
Include a Chroma database in the template with the -db
flag:
aitemplates name_of_notebook -db
For asynchronous chat completions, add the -asnc
flag:
aitemplates name_of_notebook -db -asnc
Documentation
The package includes example notebooks, which provide comprehensive guides and demonstrations of the functionalities provided by aitemplates. To access these notebooks, access or clone the repository at https://github.com/SilenNaihin/ai_templates and navigate to the /notebooks
directory.
Here are the available notebooks:
oai_examples.ipynb
: Provides examples for the OpenAI API.chroma_examples.ipynb
: Demonstrates usage of ChromaDB.prompt_engineering_example.ipynb
: A comprehensive guide on prompt engineering, including various techniques, usage of ChromaDB and the OpenAI library together.
Requirements
- Be sure to have a
.env
file with theOPENAI_API_KEY
defined in the root of your project or your api key defined in some way for OpenAI. AWS env variables are for ChromaDB deployment https://docs.trychroma.com/deployment - This library doesn't currently support text models like
text-davinci-003
. Streaming and logit_bias parameters are also not supported
Contributing
I welcome and appreciate contributions to aitemplates. If you'd like to contribute a feature, please submit a pull request. For bugs, please open a new issue, and I'll address it promptly.
Future?
- https://twitter.com/ItakGol/status/1668336193270865921
- Support for other LLMs
- Support for other dbs
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
File details
Details for the file aitemplates-0.1.5.tar.gz
.
File metadata
- Download URL: aitemplates-0.1.5.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.13 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 650faf2171e65935afff1bc27ca649cfc5eeb94acc1bc28c4820aae71e29cbde |
|
MD5 | 87e522742bd2d19a26c11281b6136c3c |
|
BLAKE2b-256 | dc7da1b09ddebae20babf22d5a11ed53c367593e4a7ff38371e1dbc622db46b1 |
File details
Details for the file aitemplates-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: aitemplates-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.13 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39ee225a85057f7ea520cdff8de58247f97ed3d6d1bf778ee9cf6958cc3ade41 |
|
MD5 | f1012524fe1436528bb01f5dde59fe4b |
|
BLAKE2b-256 | f914f41845703ac4f89bcdfe1a487f16245ab508d04b0c07d2ff2f8abbce4f66 |