This change adds a music player example to the python typechat implementation. Unlike the typescript edition, this example does not rely on JsonProgram. Instead, the music player schema is exposed as a set of actions (and their corresponding parameter types). The model selects a sequence of actions to run. These are passed to a handler function that executes them in order.
The code is organized as follows:
The demo.py file is the console app entry point - this is similar to previous python examples.
The schema.py file defines the action types and their associated parameters.
The notebooks/music.pynb file has an interactive Jupyter notebook for the music scenario.
The client.py file has the logic for executing schmatized actions against the spotify API
For this example, we are using the popular Spotipy (https://spotipy.readthedocs.io/en/2.22.1/) package to interact with spotfiy's API. This package does not currently provide type hints on its method,, so we have added code in spotipyWrapper.py that wraps the methods that we use. This file also has stub implementations of the data contracts we use in the example. Spotipy2 (https://pypi.org/project/spotipy2/) is a promising effort that has type hints and async method definitions - it's currently missing key parts of Spotify automation that we use (e.g. controlling playback on a particular device). ''Once Spotipy2 is ready, we can retire the wrapper code.
This change adds a music player example to the python typechat implementation. Unlike the typescript edition, this example does not rely on JsonProgram. Instead, the music player schema is exposed as a set of actions (and their corresponding parameter types). The model selects a sequence of actions to run. These are passed to a handler function that executes them in order.
The code is organized as follows: