Introduction
A module for prototyping asyncflows actions that classify data.
This repo contains a classify action, which prompts the LLM to return a classification for a piece of data, given a provided list of labels.
To use this action in your own flows, simply:
pip install asyncflows-classify
And include the action in your flow yaml file:
flow:
sentiment_analysis:
action: classify
labels:
- positive
- negative
data:
var: data
Running the Example
The repo also includes an example of how to use the classify action in sentiment analysis:
sentiment_analysis_example.yaml, a flow that classifies a piece of data as either funky, janky, or serious, and says hello world in that waysentiment_analysis_example.py, a script that runs the flow on a hardcoded piece of data
To run the example:
-
Set up Ollama or configure another language model
-
Clone the repository
git clone ssh://git@github.com/asynchronous-flows/asyncflows-classify
- Change into the directory
cd asyncflows-classify
- Create and activate your virtual environment (with, for example)
python3.11 -m venv .venv
source .venv/bin/activate
- If not already installed, install poetry. Install dependencies with:
poetry install
- Run the example
python sentiment_analysis_example.py
Release files for asyncflows-classify 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asyncflows_classify-0.1.2.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asyncflows_classify-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / asyncflows_classify-0.1.2.tar.gz
| Download URL | asyncflows_classify-0.1.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3f034c269f55cdcb4879ac384bc5ae2e36915c29924550e4e1c095d058860c2
|
|
BLAKE2b-256 checksum How to use checksums |
067241d624528c51dd004e726be6352a99f7ca7ed1a71b121312f863a2c5bc46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Darwin/23.2.0
|
Release files / asyncflows_classify-0.1.2-py3-none-any.whl
| Download URL | asyncflows_classify-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80ea7abc894f24f5838712bf67b2ae6a11e7168de5853e9c2bf67f930fafedff
|
|
BLAKE2b-256 checksum How to use checksums |
1f1d1c6e0575bde0a11220085479ee36581be7ac8eab358b2e97addabfda9223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Darwin/23.2.0
|