Skip to main content

No project description provided

Project description

asyncflows classify

Built for asyncflows

main repo Discord

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 way
  • sentiment_analysis_example.py, a script that runs the flow on a hardcoded piece of data

To run the example:

  1. Set up Ollama or configure another language model

  2. Clone the repository

git clone ssh://git@github.com/asynchronous-flows/asyncflows-classify
  1. Change into the directory
cd asyncflows-classify
  1. Create and activate your virtual environment (with, for example)
python3.11 -m venv .venv
source .venv/bin/activate
  1. If not already installed, install poetry. Install dependencies with:
poetry install
  1. Run the example
python sentiment_analysis_example.py

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

asyncflows_classify-0.1.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

asyncflows_classify-0.1.2-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page