Skip to main content

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

aitemplates

aitemplates is a Python package designed to simplify and streamline your work with the OpenAI API. It provides automatic function calling, helper classes, 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

  • Function Integration: Quick and easy integration with OpenAI functions for automatic execution and error handling.
  • 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-in print_every option prints every time a completion finishes in parallel. If you'd like to maintain the order of your completions, pass in the keep_order boolean as True.
  • Prompt Engineering Examples: Get started quickly with included examples of prompt engineering techniques.
  • Python Typing Support: Enjoy the benefits of Python's dynamic typing system while using OpenAI API.

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

For chat completions with function boilerplate add the -func flag (async do not support functions):

aitemplates name_of_notebook -db -func

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 including functions.
  • 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 the OPENAI_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?

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

aitemplates-0.1.19.tar.gz (49.4 kB view details)

Uploaded Source

Built Distribution

aitemplates-0.1.19-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file aitemplates-0.1.19.tar.gz.

File metadata

  • Download URL: aitemplates-0.1.19.tar.gz
  • Upload date:
  • Size: 49.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10

File hashes

Hashes for aitemplates-0.1.19.tar.gz
Algorithm Hash digest
SHA256 56be0265898ca9e742097ab45aa9cb5c4c7d5da58ae20bee0990cdff0740371c
MD5 95996c77e288ed993c5c0fd80bc78631
BLAKE2b-256 f060611540dc94e1ff9280f9bde3d532204bd93568ecfb3c79b301ec371390a8

See more details on using hashes here.

File details

Details for the file aitemplates-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: aitemplates-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Windows/10

File hashes

Hashes for aitemplates-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 66b7e9b68574a515e5e7ea58f40593c331677c723f131ab0b45c95c280e63ea9
MD5 4f3df65cc9810b1b8103ce887b19808e
BLAKE2b-256 b48807d1aebd9171f81127647f48401f77fc6082879f9228403ebbae367bb000

See more details on using hashes here.

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