No project description provided
Project description
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
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
Built Distribution
File details
Details for the file launchkit-0.1.6.tar.gz
.
File metadata
- Download URL: launchkit-0.1.6.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.10.4 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b76d43b8fe67bbf6076fa40850b26795bb1ba581bc9c3df536cc56298f99e6e6 |
|
MD5 | ff1bae6cdde9fe3cd5e9e15d2d05a53a |
|
BLAKE2b-256 | a04e3749a81a0055e69fb853d756fa066fa0217d4f78a550629018679658e3a9 |
File details
Details for the file launchkit-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: launchkit-0.1.6-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.10.4 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ee32264cf694edf78c1f8ca78341e67d559fee849cdbe57478852688c7fb662 |
|
MD5 | 76c12c62ce8804f6b1fa08a84de44cd1 |
|
BLAKE2b-256 | 07b6a69a899d592b838308ae8354ce88a029aa75955b8f534281b35b900c2e01 |