fleetfluid


Namefleetfluid JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryAI Agent Functions for ETL Processing
upload_time2025-08-17 22:47:23
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords ai etl data-processing text-processing pydantic-ai llm
VCS
bugtrack_url
requirements pydantic-ai pydantic httpx
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FleetFluid

**AI Agent Functions for Data Processing**

FleetFluid is a Python library that simplifies data transformation by letting you use AI-powered functions without writing them from scratch. Instead of building functions, you invoke ready-made, agent-based functions that handle tasks like text cleaning, information extraction, translation, labeling, anonymization, and more—just by specifying what you need in natural language.

Powered by PydanticAI, FleetFluid offers a streamlined interface for embedding intelligent data processing into your ETL workflows, without the overhead of managing complex AI infrastructure.

## Installation

```bash
pip install fleetfluid
```

## Quick Start

```python
import fleetfluid

# Initialize with your preferred model
fleetfluid.init(
    model="anthropic:claude-sonnet-4-20250514",
    temperature=0.7,
    max_tokens=1000
)

# AI Transformation
sample_text = "The data processing pipeline needs optimization for better performance."
result = fleetfluid.ai("Rewrite this in a more technical tone", sample_text)
print(result)  # "The data processing pipeline requires optimization for enhanced performance."

# Multi-label Classification
text = "The database query is running slowly and consuming too much memory"
labels = ["Performance Issue", "Feature Request", "Bug Report"]
result = fleetfluid.label(text, labels, multiple=True)
print(result.labels)  # ["Performance Issue", "Bug Report"]
print(result.confidence_scores)  # {"Performance Issue": 0.9, "Bug Report": 0.8}

# Single-label Classification
result = fleetfluid.label(text, labels, multiple=False)
print(result.label)  # "Performance Issue"
print(result.confidence)  # 0.9

# Text Anonymization
personal_text = "Hi, my name is John Smith. Email: john@email.com. Phone: 555-123-4567"
anonymized = fleetfluid.anonymize(personal_text)
print(anonymized)  # "Hi, my name is [NAME]. Email: [EMAIL]. Phone: [PHONE]"

# Feature Description Generation
product_features = {
    "material": "leather",
    "color": "black", 
    "type": "wallet"
}
description = fleetfluid.describe(product_features, style="marketing")
print(description)  # "A sophisticated black leather wallet that combines style and functionality."

# Information Extraction
job_description = """Senior Data Engineer with 5+ years experience 
in Python, SQL, AWS, and machine learning pipelines."""
skills = fleetfluid.extract("skills", job_description)
print(skills)  # ["Python", "SQL", "AWS", "machine learning"]

## Configuration

```python
import fleetfluid

# Basic initialization
fleetfluid.init(model="openai:gpt-4")

# With additional PydanticAI configuration
fleetfluid.init(
    model="anthropic:claude-sonnet-4-20250514",
    temperature=0.7,
    max_tokens=1000
)
```

## API Reference

### `fleetfluid.init(model, **kwargs)`

Initialize FleetFluid with model configuration.

- **model** (str): Model identifier (e.g., "openai:gpt-4")
- **kwargs**: Additional configuration passed to PydanticAI agents

### `fleetfluid.ai(prompt, data)`

Apply AI transformation to data using the given prompt.

- **prompt** (str): Instruction for the AI
- **data** (str): Input data to transform
- **Returns** (str): Transformed data

### `fleetfluid.label(text, labels, multiple=False)`

Label text using AI agent with structured output.

- **text** (str): Input text to label
- **labels** (list[str]): List of possible labels to choose from
- **multiple** (bool): If True, select multiple labels; if False, select single best label (default: False)
- **Returns**: 
  - `SingleLabelResult` (when `multiple=False`): Contains `label`, `confidence`, and `reasoning`
  - `MultipleLabelResult` (when `multiple=True`): Contains `labels`, `confidence_scores`, and `reasoning`

### `fleetfluid.anonymize(text)`

Anonymize personal information in text using AI.

- **text** (str): Input text containing personal information to anonymize
- **Returns** (str): Anonymized text with personal information replaced by placeholders

### `fleetfluid.describe(features, style="natural")`

Generate a meaningful text description from a dictionary of features.

- **features** (dict): Dictionary of product/object features
- **style** (str): Description style ("natural", "marketing", "technical", "casual")
- **Returns** (str): Natural language description of the features

### `fleetfluid.extract(extraction_type, text)`

Extract specific types of information from text using AI.

- **extraction_type** (str): Type of information to extract (e.g., "skills", "countries", "companies", "technologies")
- **text** (str): Input text to extract information from
- **Returns** (list): List of extracted items

## Use Cases

### Data Cleaning & Standardization
```python
# Fix inconsistent formatting
clean_data = fleetfluid.ai("standardize this address format", "123 main st apt 4b")

# Normalize names
normalized = fleetfluid.ai("convert to proper case", "JOHN SMITH")
```

### Text Processing
```python
# Summarize content
summary = fleetfluid.ai("summarize in 2 sentences", long_text)

# Extract entities
entities = fleetfluid.ai("extract all company names as a list", business_text)
```

### Data Enrichment
```python
# Categorize data
category = fleetfluid.ai("categorize this product: electronics, clothing, books", product_name)

# Generate missing data
description = fleetfluid.ai("write a product description", product_title)

# Structured labeling
text = "Customer complaint about delayed delivery"
labels = ["positive", "negative", "neutral", "urgent"]
result = fleetfluid.label(text, labels)
print(f"Sentiment: {result.label} (confidence: {result.confidence})")

# Multi-label classification
text = "Product review: Great quality but expensive"
result = fleetfluid.label(text, ["positive", "negative", "price", "quality"], multiple=True)
print(f"Labels: {result.labels}")
```

### Data Privacy & Compliance
```python
# Anonymize customer data
customer_text = "Customer: Jane Doe, Email: jane@email.com, Phone: 555-123-4567"
anonymized = fleetfluid.anonymize(customer_text)
print(anonymized)  # "Customer: [NAME], Email: [EMAIL], Phone: [PHONE]"
```

### Product & Content Generation
```python
# Generate product descriptions from features
product_features = {"material": "cotton", "color": "blue", "style": "casual"}
description = fleetfluid.describe(product_features, style="marketing")
print(description)  # "A comfortable blue cotton casual shirt perfect for everyday wear."

# Create content in different styles
tech_specs = {"processor": "Intel i7", "ram": "16GB", "storage": "512GB SSD"}
tech_description = fleetfluid.describe(tech_specs, style="technical")
print(tech_description)  # "Intel i7 processor with 16GB RAM and 512GB SSD storage."
```

### Information Extraction & Mining
```python
# Extract skills from job descriptions
job_text = "Looking for Python developer with AWS and Docker experience"
skills = fleetfluid.extract("skills", job_text)
print(skills)  # ["Python", "AWS", "Docker"]

# Extract countries from travel content
travel_text = "I visited Paris, France and Tokyo, Japan last year"
countries = fleetfluid.extract("countries", travel_text)
print(countries)  # ["France", "Japan"]

# Extract companies from business articles
business_text = "Apple, Microsoft, and Google are leading tech companies"
companies = fleetfluid.extract("companies", business_text)
print(companies)  # ["Apple", "Microsoft", "Google"]
```

## Error Handling

```python
try:
    result = fleetfluid.ai("translate to French", text)
except RuntimeError as e:
    print(f"AI processing failed: {e}")
```

## API Token Configuration

FleetFluid uses PydanticAI for AI model interactions and relies on standard environment variables for API authentication. You need to set up API tokens for your chosen model provider before using FleetFluid.

### Setting Up API Tokens

#### OpenAI Models
For OpenAI models like `"openai:gpt-4"` or `"openai:gpt-3.5-turbo"`:

```bash
export OPENAI_API_KEY="your-openai-api-key-here"
```

#### Anthropic Models
For Anthropic models like `"anthropic:claude-sonnet-4-20250514"`:

```bash
export ANTHROPIC_API_KEY="your-anthropic-api-key-here"
```

#### Google Models
For Google models like `"gemini-2.5-pro"`:

```bash
export GOOGLE_API_KEY="your-google-api-key-here"
```

#### Groq Models
For Groq models like `"groq:llama-70b"`:

```bash
export GROQ_API_KEY="your-groq-api-key-here"
```

#### Google VertexAI Models
For Google VertexAI models like `"vertexai:gemini-2.5-pro"`:

```bash
# Set Google Cloud credentials
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-key.json"

# Or set project ID and use Application Default Credentials
export GOOGLE_CLOUD_PROJECT="your-project-id"
```

### Environment Variable Setup

You can set environment variables in several ways:

#### 1. Terminal/Shell
```bash
# For current session
export OPENAI_API_KEY="sk-your-key-here"

# For permanent setup (add to ~/.bashrc, ~/.zshrc, etc.)
echo 'export OPENAI_API_KEY="sk-your-key-here"' >> ~/.bashrc
source ~/.bashrc
```

#### 2. Python Environment
```python
import os
os.environ["OPENAI_API_KEY"] = "sk-your-key-here"

import fleetfluid
fleetfluid.init(model="openai:gpt-4")
```

#### 3. .env File (if supported by your setup)
Create a `.env` file in your project root:
```
OPENAI_API_KEY=sk-your-key-here
ANTHROPIC_API_KEY=sk-ant-your-key-here
```

## Requirements

- Python 3.8+
- PydanticAI
- An API key for your chosen model provider (see API Token Configuration above)

## Version

Current version: 0.1.3

## License

MIT License. See LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fleetfluid",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "ai, etl, data-processing, text-processing, pydantic-ai, llm",
    "author": null,
    "author_email": "Andreyo <bobroe.web@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/fe/4d/2bb22c5a5eb7ca834c6d80e844b29aa0de9292a80d9a1f393bc993bed9da/fleetfluid-0.1.3.tar.gz",
    "platform": null,
    "description": "# FleetFluid\n\n**AI Agent Functions for Data Processing**\n\nFleetFluid is a Python library that simplifies data transformation by letting you use AI-powered functions without writing them from scratch. Instead of building functions, you invoke ready-made, agent-based functions that handle tasks like text cleaning, information extraction, translation, labeling, anonymization, and more\u2014just by specifying what you need in natural language.\n\nPowered by PydanticAI, FleetFluid offers a streamlined interface for embedding intelligent data processing into your ETL workflows, without the overhead of managing complex AI infrastructure.\n\n## Installation\n\n```bash\npip install fleetfluid\n```\n\n## Quick Start\n\n```python\nimport fleetfluid\n\n# Initialize with your preferred model\nfleetfluid.init(\n    model=\"anthropic:claude-sonnet-4-20250514\",\n    temperature=0.7,\n    max_tokens=1000\n)\n\n# AI Transformation\nsample_text = \"The data processing pipeline needs optimization for better performance.\"\nresult = fleetfluid.ai(\"Rewrite this in a more technical tone\", sample_text)\nprint(result)  # \"The data processing pipeline requires optimization for enhanced performance.\"\n\n# Multi-label Classification\ntext = \"The database query is running slowly and consuming too much memory\"\nlabels = [\"Performance Issue\", \"Feature Request\", \"Bug Report\"]\nresult = fleetfluid.label(text, labels, multiple=True)\nprint(result.labels)  # [\"Performance Issue\", \"Bug Report\"]\nprint(result.confidence_scores)  # {\"Performance Issue\": 0.9, \"Bug Report\": 0.8}\n\n# Single-label Classification\nresult = fleetfluid.label(text, labels, multiple=False)\nprint(result.label)  # \"Performance Issue\"\nprint(result.confidence)  # 0.9\n\n# Text Anonymization\npersonal_text = \"Hi, my name is John Smith. Email: john@email.com. Phone: 555-123-4567\"\nanonymized = fleetfluid.anonymize(personal_text)\nprint(anonymized)  # \"Hi, my name is [NAME]. Email: [EMAIL]. Phone: [PHONE]\"\n\n# Feature Description Generation\nproduct_features = {\n    \"material\": \"leather\",\n    \"color\": \"black\", \n    \"type\": \"wallet\"\n}\ndescription = fleetfluid.describe(product_features, style=\"marketing\")\nprint(description)  # \"A sophisticated black leather wallet that combines style and functionality.\"\n\n# Information Extraction\njob_description = \"\"\"Senior Data Engineer with 5+ years experience \nin Python, SQL, AWS, and machine learning pipelines.\"\"\"\nskills = fleetfluid.extract(\"skills\", job_description)\nprint(skills)  # [\"Python\", \"SQL\", \"AWS\", \"machine learning\"]\n\n## Configuration\n\n```python\nimport fleetfluid\n\n# Basic initialization\nfleetfluid.init(model=\"openai:gpt-4\")\n\n# With additional PydanticAI configuration\nfleetfluid.init(\n    model=\"anthropic:claude-sonnet-4-20250514\",\n    temperature=0.7,\n    max_tokens=1000\n)\n```\n\n## API Reference\n\n### `fleetfluid.init(model, **kwargs)`\n\nInitialize FleetFluid with model configuration.\n\n- **model** (str): Model identifier (e.g., \"openai:gpt-4\")\n- **kwargs**: Additional configuration passed to PydanticAI agents\n\n### `fleetfluid.ai(prompt, data)`\n\nApply AI transformation to data using the given prompt.\n\n- **prompt** (str): Instruction for the AI\n- **data** (str): Input data to transform\n- **Returns** (str): Transformed data\n\n### `fleetfluid.label(text, labels, multiple=False)`\n\nLabel text using AI agent with structured output.\n\n- **text** (str): Input text to label\n- **labels** (list[str]): List of possible labels to choose from\n- **multiple** (bool): If True, select multiple labels; if False, select single best label (default: False)\n- **Returns**: \n  - `SingleLabelResult` (when `multiple=False`): Contains `label`, `confidence`, and `reasoning`\n  - `MultipleLabelResult` (when `multiple=True`): Contains `labels`, `confidence_scores`, and `reasoning`\n\n### `fleetfluid.anonymize(text)`\n\nAnonymize personal information in text using AI.\n\n- **text** (str): Input text containing personal information to anonymize\n- **Returns** (str): Anonymized text with personal information replaced by placeholders\n\n### `fleetfluid.describe(features, style=\"natural\")`\n\nGenerate a meaningful text description from a dictionary of features.\n\n- **features** (dict): Dictionary of product/object features\n- **style** (str): Description style (\"natural\", \"marketing\", \"technical\", \"casual\")\n- **Returns** (str): Natural language description of the features\n\n### `fleetfluid.extract(extraction_type, text)`\n\nExtract specific types of information from text using AI.\n\n- **extraction_type** (str): Type of information to extract (e.g., \"skills\", \"countries\", \"companies\", \"technologies\")\n- **text** (str): Input text to extract information from\n- **Returns** (list): List of extracted items\n\n## Use Cases\n\n### Data Cleaning & Standardization\n```python\n# Fix inconsistent formatting\nclean_data = fleetfluid.ai(\"standardize this address format\", \"123 main st apt 4b\")\n\n# Normalize names\nnormalized = fleetfluid.ai(\"convert to proper case\", \"JOHN SMITH\")\n```\n\n### Text Processing\n```python\n# Summarize content\nsummary = fleetfluid.ai(\"summarize in 2 sentences\", long_text)\n\n# Extract entities\nentities = fleetfluid.ai(\"extract all company names as a list\", business_text)\n```\n\n### Data Enrichment\n```python\n# Categorize data\ncategory = fleetfluid.ai(\"categorize this product: electronics, clothing, books\", product_name)\n\n# Generate missing data\ndescription = fleetfluid.ai(\"write a product description\", product_title)\n\n# Structured labeling\ntext = \"Customer complaint about delayed delivery\"\nlabels = [\"positive\", \"negative\", \"neutral\", \"urgent\"]\nresult = fleetfluid.label(text, labels)\nprint(f\"Sentiment: {result.label} (confidence: {result.confidence})\")\n\n# Multi-label classification\ntext = \"Product review: Great quality but expensive\"\nresult = fleetfluid.label(text, [\"positive\", \"negative\", \"price\", \"quality\"], multiple=True)\nprint(f\"Labels: {result.labels}\")\n```\n\n### Data Privacy & Compliance\n```python\n# Anonymize customer data\ncustomer_text = \"Customer: Jane Doe, Email: jane@email.com, Phone: 555-123-4567\"\nanonymized = fleetfluid.anonymize(customer_text)\nprint(anonymized)  # \"Customer: [NAME], Email: [EMAIL], Phone: [PHONE]\"\n```\n\n### Product & Content Generation\n```python\n# Generate product descriptions from features\nproduct_features = {\"material\": \"cotton\", \"color\": \"blue\", \"style\": \"casual\"}\ndescription = fleetfluid.describe(product_features, style=\"marketing\")\nprint(description)  # \"A comfortable blue cotton casual shirt perfect for everyday wear.\"\n\n# Create content in different styles\ntech_specs = {\"processor\": \"Intel i7\", \"ram\": \"16GB\", \"storage\": \"512GB SSD\"}\ntech_description = fleetfluid.describe(tech_specs, style=\"technical\")\nprint(tech_description)  # \"Intel i7 processor with 16GB RAM and 512GB SSD storage.\"\n```\n\n### Information Extraction & Mining\n```python\n# Extract skills from job descriptions\njob_text = \"Looking for Python developer with AWS and Docker experience\"\nskills = fleetfluid.extract(\"skills\", job_text)\nprint(skills)  # [\"Python\", \"AWS\", \"Docker\"]\n\n# Extract countries from travel content\ntravel_text = \"I visited Paris, France and Tokyo, Japan last year\"\ncountries = fleetfluid.extract(\"countries\", travel_text)\nprint(countries)  # [\"France\", \"Japan\"]\n\n# Extract companies from business articles\nbusiness_text = \"Apple, Microsoft, and Google are leading tech companies\"\ncompanies = fleetfluid.extract(\"companies\", business_text)\nprint(companies)  # [\"Apple\", \"Microsoft\", \"Google\"]\n```\n\n## Error Handling\n\n```python\ntry:\n    result = fleetfluid.ai(\"translate to French\", text)\nexcept RuntimeError as e:\n    print(f\"AI processing failed: {e}\")\n```\n\n## API Token Configuration\n\nFleetFluid uses PydanticAI for AI model interactions and relies on standard environment variables for API authentication. You need to set up API tokens for your chosen model provider before using FleetFluid.\n\n### Setting Up API Tokens\n\n#### OpenAI Models\nFor OpenAI models like `\"openai:gpt-4\"` or `\"openai:gpt-3.5-turbo\"`:\n\n```bash\nexport OPENAI_API_KEY=\"your-openai-api-key-here\"\n```\n\n#### Anthropic Models\nFor Anthropic models like `\"anthropic:claude-sonnet-4-20250514\"`:\n\n```bash\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key-here\"\n```\n\n#### Google Models\nFor Google models like `\"gemini-2.5-pro\"`:\n\n```bash\nexport GOOGLE_API_KEY=\"your-google-api-key-here\"\n```\n\n#### Groq Models\nFor Groq models like `\"groq:llama-70b\"`:\n\n```bash\nexport GROQ_API_KEY=\"your-groq-api-key-here\"\n```\n\n#### Google VertexAI Models\nFor Google VertexAI models like `\"vertexai:gemini-2.5-pro\"`:\n\n```bash\n# Set Google Cloud credentials\nexport GOOGLE_APPLICATION_CREDENTIALS=\"/path/to/your/service-account-key.json\"\n\n# Or set project ID and use Application Default Credentials\nexport GOOGLE_CLOUD_PROJECT=\"your-project-id\"\n```\n\n### Environment Variable Setup\n\nYou can set environment variables in several ways:\n\n#### 1. Terminal/Shell\n```bash\n# For current session\nexport OPENAI_API_KEY=\"sk-your-key-here\"\n\n# For permanent setup (add to ~/.bashrc, ~/.zshrc, etc.)\necho 'export OPENAI_API_KEY=\"sk-your-key-here\"' >> ~/.bashrc\nsource ~/.bashrc\n```\n\n#### 2. Python Environment\n```python\nimport os\nos.environ[\"OPENAI_API_KEY\"] = \"sk-your-key-here\"\n\nimport fleetfluid\nfleetfluid.init(model=\"openai:gpt-4\")\n```\n\n#### 3. .env File (if supported by your setup)\nCreate a `.env` file in your project root:\n```\nOPENAI_API_KEY=sk-your-key-here\nANTHROPIC_API_KEY=sk-ant-your-key-here\n```\n\n## Requirements\n\n- Python 3.8+\n- PydanticAI\n- An API key for your chosen model provider (see API Token Configuration above)\n\n## Version\n\nCurrent version: 0.1.3\n\n## License\n\nMIT License. See LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "AI Agent Functions for ETL Processing",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/vossmoos/fleetfluid",
        "Issues": "https://github.com/vossmoos/fleetfluid/issues",
        "Repository": "https://github.com/vossmoos/fleetfluid"
    },
    "split_keywords": [
        "ai",
        " etl",
        " data-processing",
        " text-processing",
        " pydantic-ai",
        " llm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ab013d80686b37760f723a4af79a2427d85b1457d54ab936da4bd289e5ab4fcf",
                "md5": "ce92b599ca6c1980723d3d146691e7de",
                "sha256": "912aaa4ea1f9a456edc46c5c631641c02e16c118cbc6dbfa517846e8d46a9e9c"
            },
            "downloads": -1,
            "filename": "fleetfluid-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce92b599ca6c1980723d3d146691e7de",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10588,
            "upload_time": "2025-08-17T22:47:22",
            "upload_time_iso_8601": "2025-08-17T22:47:22.114551Z",
            "url": "https://files.pythonhosted.org/packages/ab/01/3d80686b37760f723a4af79a2427d85b1457d54ab936da4bd289e5ab4fcf/fleetfluid-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fe4d2bb22c5a5eb7ca834c6d80e844b29aa0de9292a80d9a1f393bc993bed9da",
                "md5": "a953b98de8abb7c8294134ff68d1b38f",
                "sha256": "bcf79a26595eea12a444ca172b5c9059148a0167cd606b38ba4d8db89298ac32"
            },
            "downloads": -1,
            "filename": "fleetfluid-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a953b98de8abb7c8294134ff68d1b38f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 12920,
            "upload_time": "2025-08-17T22:47:23",
            "upload_time_iso_8601": "2025-08-17T22:47:23.414769Z",
            "url": "https://files.pythonhosted.org/packages/fe/4d/2bb22c5a5eb7ca834c6d80e844b29aa0de9292a80d9a1f393bc993bed9da/fleetfluid-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 22:47:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vossmoos",
    "github_project": "fleetfluid",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pydantic-ai",
            "specs": []
        },
        {
            "name": "pydantic",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        }
    ],
    "lcname": "fleetfluid"
}
        
Elapsed time: 1.20894s