- Introduction
- Installation
- Core Concepts
- Basic Usage
- Advanced Features
- API Reference
- Troubleshooting
- Contributing
VirtWorker is a Python framework for creating and managing workflows with Language Learning Models (LLMs). It allows users to build complex AI-driven text processing and generation pipelines by chaining modular LLM operations.
- Debian 12
- CUDA 1.8
- NVIDIA RTX 3090 GPU
- Ollama
-
Clone the repository:
git clone https://github.com/yourusername/VirtWorker.git cd VirtWorker
-
Run the setup script:
bash setup_envs.sh
Note: This script will take a considerable amount of time to download and set up all necessary files and environments.
Nodes are the basic building blocks in VirtWorker. Each node represents a specific LLM operation, such as summarization or joke generation.
A workflow is a series of connected nodes that process input and produce output.
Nodes maintain context, allowing them to remember previous interactions within a session.
Here's a simple example of how to use VirtWorker:
from virtworker import *
# Create nodes
summarizer = create_node("gemma2:latest", "Summarizer")
summarizer.definition = "Summarize the given text concisely."
joke_writer = create_node("gemma2:latest", "Joke Writer")
joke_writer.definition = "Write a short, witty joke based on the given summary."
# Define workflow
summary = summarizer(input_text)
joke = joke_writer(summary)
print("Summary:", summary)
print("Joke:", joke)
VirtWorker supports web scraping and RSS feed parsing for input:
target_site = Website("https://www.yahoo.com/news/example-article-url")
summary = summarizer(target_site.text)
Generate audio from text output:
summary_audio = generate_audio(summary, "summary.wav")
Clear node contexts for fresh interactions:
summarizer.clear_context()
joke_writer.clear_context()
Creates a new node with the specified model and name.
definition
: Set the node's task definition.__call__(input_text: str) -> str
: Process input and return output.clear_context()
: Clear the node's conversation history.
__init__(url: str, use_rss: bool = False, rss_feed_url: str = None)
text
: Property that returns the fetched content.
Generates an audio file from the given text and returns the file path.
- Ensure Ollama is running before starting your VirtWorker script.
- Check that the required models (e.g., gemma2:latest) are available in Ollama.
- If you encounter CUDA errors, verify that your NVIDIA drivers and CUDA installation are correct.
We welcome contributions to VirtWorker! Please see the Contributing section in the README for guidelines on how to contribute.
For any questions or issues not covered in this documentation, please open an issue on the GitHub repository or contact the project maintainer directly.