Skip to main content

dowse

dowse, a python library for building natural language agents that can interpret and execute commands.

Test Package version Supported Python versions


Documentation: https://dowse.empyrealsdk.com

Source Code: https://github.com/empyrealapp/dowse


Dowse is a Python library that enables you to build intelligent agents capable of:

  • Parsing natural language commands and questions
  • Classifying inputs into different types (e.g. commands vs questions)
  • Executing structured commands based on natural language requests
  • Responding to user queries with relevant information
  • Building complex pipelines for command processing

Key Features

  • Natural Language Processing: Convert human language into structured commands
  • Flexible Pipeline Architecture: Build custom processing flows with branching logic
  • Built-in Command Handlers: Ready-to-use handlers for common operations
  • Extensible Design: Easy to add new command types and handlers
  • Async Support: Built for high-performance async/await operations

Requirements

dowse is built utilizing the following libraries:

Installation

pip install dowse

Quickstart

Dowse enables you to quickly build intelligent agents by abstracting the complexity of state management, type safety, and async operations.

The following pipeline classifies tweets as either a command or a question, and then executes a handler based on the classification.

import asyncio
import os
import logging
from enum import StrEnum
from typing import Literal

from eth_rpc import set_alchemy_key

from dowse import Pipeline
from dowse.impls.basic.llms import BasicTweetClassifier, BasicTwitterCommands, BasicTwitterQuestion
from dowse.impls.basic.effects import Printer
from dowse.impls.basic.source import TwitterMock
from dowse.models import Tweet

logging.getLogger("dowse").setLevel(logging.DEBUG)
set_alchemy_key(os.environ["ALCHEMY_KEY"])


class Classifications(StrEnum):
    """A class that defines the different classifications that can be made by the pipeline."""

    COMMANDS = "commands"
    QUESTION = "question"


async def amain():
    # create a pipeline that classifiers commands as either a command or a question.
    pipeline = Pipeline[Tweet, Tweet, Classifications](
        # classifies the request as one of the Classifications
        classifier=BasicTweetClassifier,
        # a handler that executes each classification
        handlers={
            # commands are consumed by the BasicTwitterCommands operator
            "commands": BasicTwitterCommands.add_effect(Printer(prefix="COMMANDS")),
            # questions are consumed by the BasicTwitterQuestion operator
            "question": BasicTwitterQuestion.add_effects([Printer(prefix="QUESTION")]),
        },
        # the source that will emit the data that is consumed by the pipeline
        source=TwitterMock(),
    )

    # process a single event
    result = await pipeline.process(
        # the input is a tweet, which then gets handled by the Pipeline
        Tweet(
            id=1684298214198108160,
            content="swap $300 for $UNI and then send half of it to @vitalikbuterin",
            creator_id=12,
            creator_name="@jack",
        ),
    )

    # run the pipeline for 3 executions, with a minimum of 120 seconds between each execution
    # this pulls data from the source and processes it
    await pipeline.run(max_executions=3, iteration_min_time=120)


if __name__ == "__main__":
    asyncio.run(amain())

Tests

poetry install
poetry run pytest

Metadata

Release files for dowse 0.1.6.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dowse 0.1.6.post1
File Size Uploaded
dowse-0.1.6.post1.tar.gz 31.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dowse 0.1.6.post1
File Interpreter ABI Platform
dowse-0.1.6.post1-py3-none-any.whl Python 3 none any Details

Total release size: 87.0 kB

Release files / dowse-0.1.6.post1.tar.gz

Download URL dowse-0.1.6.post1.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c9bddf24ca4df52366d08c96ed7c26c1afe88822cf8a6c9b1c5928b57930729c
BLAKE2b-256 checksum
How to use checksums
0e6198c0ed9d84d24244ca4b83b00829fb438892e961bf9a6a24e37e384ff074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / dowse-0.1.6.post1-py3-none-any.whl

Download URL dowse-0.1.6.post1-py3-none-any.whl
Size 55.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bddcab521aec962688fe90e67558717cb3281571c4d6855b7877a4328c25286b
BLAKE2b-256 checksum
How to use checksums
60a24125097649b9a4b3bce3044cc1dd23198df77311f788bfc70dd234dde8d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.6.post1 This release

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page