abbu
abbu is a python library for easy code generation with ChatGPT.
Installation
pip install abbu
Usage example
To use abbu, there's three simple key components:
setup: This function initializes abbu by setting up the necessary configuration. Provide your OpenAI API key, a file path for caching, and optional settings. This step prepares everything abbu needs to generate and manage code.FunctionSpec: This class defines what you want your function to do. You specify the function name, input parameters, and the desired functionality.create_function: This function generates the code based on your FunctionSpec. It checks if the function is already in the cache; if not, it generates the code using the OpenAI API and saves it to the cache. The function is then returned, ready for use.
An example of how these come together is in the
# my_example.py
import os
import sys
import abbu
abbu.setup(
api_key = os.getenv("OPENAI_API_KEY"),
cache_file = "/Users/jawada/Documents/CC/jawad_cache.py",
reset_cache=True
)
spec = abbu.FunctionSpec(
name = "number_adder_2",
params = ["num1", "num2"],
description = "takes as input two numbers and returns their sum"
)
def add_three_numbers(a, b, c):
f = abbu.create_function(spec=spec)
return f(a, b) + c
add_three_numbers(1,2,3)
As an example of how this would get run:
$ python3 /path/to/my_example.py
Creating function for spec: <abbu.spec.FunctionSpec object at 0x108a8b8f0>
Loaded cache: {}
Generating code for spec: <abbu.spec.FunctionSpec object at 0x108a8b8f0>
Cache saved to /Users/jawada/Documents/CC/jawad_cache.py.
6
abbu will create a cache file at /path/to/your/cache.py so that you can see what was generated.
Metadata
Release files for abbu 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| abbu-0.1.0.tar.gz | 5.8 kB | Without provenance | Details for abbu-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| abbu-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for abbu-0.1.0-py3-none-any.whl |
Total release size: 12.1 kB
Release files / abbu-0.1.0.tar.gz
| Download URL | abbu-0.1.0.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
312a82fe95c48e2da2a88839c3edc71b240c8e8bd9a4daa49a973e44c6a19d5a
|
|
BLAKE2b-256 checksum How to use checksums |
de069b47c8e10351f9a553e77a6230553689eda4019aadd3812d80a20ecc1cd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / abbu-0.1.0-py3-none-any.whl
| Download URL | abbu-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ff2dbf6bff18017cf63c9f9e5335810ba7d2d09fe2682016d9c065efdd2fd2b
|
|
BLAKE2b-256 checksum How to use checksums |
84f0b224207ef1f7d5616df1a198baab9ea637f4b77495ec1113f33ecb72737e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for abbu 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.