Skip to main content

No project description provided

Project description

Lazer

Lazer is a Python library that provides a convenient way to expose Python functions as schemas for OpenAI chat models.

For those not in the know: OpenAI - Function Calling

What it Does

Allows you to more easily inform GPT about functions in your code 😊

Warning don't RCE yourself lol

Installation

To install Lazer, simply run:

pip install lazer

Usage

Here is an example of how to use Lazer:

from lazer import Lazer, LazerConversation

lazer = Lazer()

# GPT is now made aware of your function `qux`
@lazer.use
def qux(num: int, name: str) -> str:
    """Retrieve a number and a name from the user and compute the qux of it"""
    return str(num + len(name) * 13)

conversation = LazerConversation(backdoor, {"model": "gpt-3.5-turbo-0613"})
response = conversation.talk("What is the qux of 3 and steven")
print(response)
# ... 117 ...

Note You do not have to use the LazerConversation GPT frontend, you can simply use the Lazer functions .use (decorator) and .get_functions() as well as .dispatch() to build your own GPT frontend utilizing Lazer.

Note If you are using the LazerConversation frontend be sure to set an OPENAI_API_KEY in a .env file somewhere in your directory.

Demo

Go to demo/ for some demo code.

Authors:

  • @JustinStitt
  • @diamondburned

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

lazer-0.1.8.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

lazer-0.1.8-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file lazer-0.1.8.tar.gz.

File metadata

  • Download URL: lazer-0.1.8.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.0 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for lazer-0.1.8.tar.gz
Algorithm Hash digest
SHA256 5d2fc62ae5fe242932ae582af5543e08a6d15b07fa44ee9282d0122342583ffe
MD5 14b8c1ba6f05ecd60139e9b83b61ac09
BLAKE2b-256 d3dbe26ca2b2566f0b2b91e00f5c1d4923e1faf56b94bf6476bfecb8def6e6b6

See more details on using hashes here.

File details

Details for the file lazer-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: lazer-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.0 Linux/5.10.16.3-microsoft-standard-WSL2

File hashes

Hashes for lazer-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 aef7d8f7568f2768cd96844ccb36333f0a390af4fe64bc7bdd9f151066d305ca
MD5 0599a0be6497baf6a8e363d7c3d17acb
BLAKE2b-256 85212a1f295779606962d575d96a242b26ca40aabf652170052716d06304c075

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