Automatically generate an OpenAI Assistant interface for any python typer CLI.
Project description
TyperAssistant
Instantly turn any python Typer CLI in to a function-calling OpenAI assistant.
Example Typer app:
import getpass
import typer
from typerassistant import register_assistant
app = typer.Typer()
register_assistant(app)
@app.command()
def say_hello(name: str):
print(f"Hello, {name}!")
@app.command()
def get_current_user():
print(getpass.getuser())
if __name__ == "__main__":
app()
Example CLI usage:
Installing
TyperAssistant uses poetry for a build system, so you can safely install it like you would any python package.
$ pip install typerassistant
Or, with poetry:
$ poetry add typerassistant
Usage
Please be aware that OpenAI's API incurs fees. See OpenAI's help article on the subject for more information.
A documentation pass is planned before the 1.0 release, but at this time the best way to learn how to use
TyperAssistant's features is to go check out the examples/
directory. You can also see that the main typerassistant
package only exports three members:
Assistant
, a basic frontend for OpenAI's Assistant API that handles function calling and threads.TyperAssistant
, anAssistant
subclass which wraps a Typer application.register_assistant(app: Typer)
, a function which registers an "ask" command and automatically generates an appropriate assistant for your application.
Most use cases require only register_assistant(app)
to begin working immediately!
Contributing
Patches are welcome, as are questions, suggestions, and example usecases! TyperAssistant is still in very early development, and I am hoping to find some excited collaborators to help build the roadmap to 1.0.
For now, please use the github Issues feature, but I plan to investigate further as needs dictate.
License
This software is licensed with the MIT license. Please see the file LICENSE
for more information.
TyperAssistant is copyright Erich Blume, 2023.
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
Hashes for typerassistant-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4984f7981d28c57b39223b138c994bbb26d3d585dc50db2ba844685e900c759 |
|
MD5 | d1cba195df82956f00e7a2eaf225cca7 |
|
BLAKE2b-256 | aeb102db69a9af73564f2ba6add7bd550ad20a4c41e3e811b0b93fb416d8fb92 |