LaunchKit
LaunchKit is an open-source library that enables developers to create and manage Python-based tools which enhance GPT chatbots' capabilities. It turns your Python code into a format that large language models (LLMs) like OpenAI's GPT can understand and use, thanks to the generation of JSON schemas driven by your code's type annotations.
Using Pydantic, LaunchKit reads your code's structure and details, ensuring that bots can interact with your tools correctly. This process provides clear, enforceable contracts between your functions and chatbots, making your bots more robust and easier to maintain.
With Launchkit, you can:
- Create Python-based tools that your bot can use.
- Talk with your bot and test functions locally.
- Deploy the upgraded bot to channels like Discord, Slack, and Telegram. (via MissionControl)
Toy Example
from launchkit import LaunchKit
def add(a: int, b: int):
"""Adds two numbers together."""
return a + b
# async functions are also supported
async def fetch_today_weather():
"""Gets today's weather."""
await some_async_function()
return {
"temperature": 20,
"humidity": 50
}
tools = LaunchKit([add, fetch_today_weather])
tools.openai_tools() # list of tools in OpenAI format - ready to be sent to the API.
Talk with your bot locally in the terminal:
launchkit module_name:tools
Getting started
-
Install PDM
-
Create a new project
mkdir my_project
cd my_project
pdm init --copier gh:missioncontrolai/template
pdm install
- Test it out
pdm test # run tests
pdm dev # talk with your bot
- Deploy it (with MissionControl)
git init
git add .
git commit -m "Initial commit"
- Create a new repo on github and push to it.
- Create a Discord bot and save the token.
- Go to https://www.missioncontrolbot.com/ and add your repo.
First Steps
Create functions
def add(a: int, b: int): # use a descriptive name and type annotations
"""Adds two numbers together.""" # add a docstring
return a + b
[!NOTE]
- The function's name will be used as the tool's name. The docstring will be used as the tool's description.
- Use type annotations(More on types) to help the bot understand what kind of data to send to your function.
Async functions are also supported:
async def fetch_today_weather():
"""Gets today's weather."""
await some_async_function()
return {
"temperature": 20,
"humidity": 50
}
[!NOTE]
- Return type should be serializable to JSON.
- When returning a dictionary, make sure that the fiels names are descriptive. The bot will use them to generate better summaries to function execution results.
Exposing your functions to the bot
from launchkit import LaunchKit
tools = LaunchKit([add, fetch_today_weather])
Testing
Talk with your bot locally in the terminal:
launchkit module_name:tools
Write tests for your functions:
def test_add():
assert add(1, 2) == 3
Summary
- Use descriptive names
- Add docstrings
- Use type annotations
- Return type should be serializable to JSON
- Return dictionaries with descriptive field names
Metadata
Release files for launchkit 0.1.6
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 |
|---|---|---|---|---|
| launchkit-0.1.6.tar.gz | 4.5 kB | Without provenance | Details for launchkit-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| launchkit-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for launchkit-0.1.6-py3-none-any.whl |
Total release size: 10.1 kB
Release files / launchkit-0.1.6.tar.gz
| Download URL | launchkit-0.1.6.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b76d43b8fe67bbf6076fa40850b26795bb1ba581bc9c3df536cc56298f99e6e6
|
|
BLAKE2b-256 checksum How to use checksums |
a04e3749a81a0055e69fb853d756fa066fa0217d4f78a550629018679658e3a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.10.4 CPython/3.10.12
|
Release files / launchkit-0.1.6-py3-none-any.whl
| Download URL | launchkit-0.1.6-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ee32264cf694edf78c1f8ca78341e67d559fee849cdbe57478852688c7fb662
|
|
BLAKE2b-256 checksum How to use checksums |
07b6a69a899d592b838308ae8354ce88a029aa75955b8f534281b35b900c2e01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.10.4 CPython/3.10.12
|
Security for launchkit 0.1.6
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.