fleetfluid


Namefleetfluid JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryAI Agent Functions for ETL Processing
upload_time2025-07-19 19:31:12
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, 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="openai:gpt-4")

# Use AI agent functions in your ETL pipeline
text = "this is sample text with bad grammar"
corrected = fleetfluid.ai("write it grammatically correct", text)
print(corrected)  # "This is sample text with correct grammar."

# Translate text
spanish = fleetfluid.ai("translate to Spanish", "Hello, how are you?")
print(spanish)  # "Hola, ¿cómo estás?"

# Extract information
data = "John Smith, Software Engineer, works at Tech Corp since 2020"
structured = fleetfluid.ai("extract as JSON with name, role, company, year", data)
print(structured)  # {"name": "John Smith", "role": "Software Engineer", ...}

# Label text with structured output
text = "The new iPhone 15 Pro Max features advanced camera capabilities"
labels = ["technology", "business", "sports", "entertainment", "health"]
result = fleetfluid.label(text, labels)
print(result.label)  # "technology"
print(result.confidence)  # 0.95
print(result.reasoning)  # "The text discusses iPhone features, which is clearly technology-related"

# Multi-label classification
text = "Apple's quarterly earnings show strong growth in services and hardware sales"
result = fleetfluid.label(text, labels, multiple=True)
print(result.labels)  # ["technology", "business"]
print(result.confidence_scores)  # {"technology": 0.9, "business": 0.85}
```

## 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`

## 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}")
```

## 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)

## 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": "Your Name <bobroe.web@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/53/57/0f8919327b563fac46169b52403fe297dfc06de5ebcb6290b9501855fa75/fleetfluid-0.1.2.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, 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(model=\"openai:gpt-4\")\n\n# Use AI agent functions in your ETL pipeline\ntext = \"this is sample text with bad grammar\"\ncorrected = fleetfluid.ai(\"write it grammatically correct\", text)\nprint(corrected)  # \"This is sample text with correct grammar.\"\n\n# Translate text\nspanish = fleetfluid.ai(\"translate to Spanish\", \"Hello, how are you?\")\nprint(spanish)  # \"Hola, \u00bfc\u00f3mo est\u00e1s?\"\n\n# Extract information\ndata = \"John Smith, Software Engineer, works at Tech Corp since 2020\"\nstructured = fleetfluid.ai(\"extract as JSON with name, role, company, year\", data)\nprint(structured)  # {\"name\": \"John Smith\", \"role\": \"Software Engineer\", ...}\n\n# Label text with structured output\ntext = \"The new iPhone 15 Pro Max features advanced camera capabilities\"\nlabels = [\"technology\", \"business\", \"sports\", \"entertainment\", \"health\"]\nresult = fleetfluid.label(text, labels)\nprint(result.label)  # \"technology\"\nprint(result.confidence)  # 0.95\nprint(result.reasoning)  # \"The text discusses iPhone features, which is clearly technology-related\"\n\n# Multi-label classification\ntext = \"Apple's quarterly earnings show strong growth in services and hardware sales\"\nresult = fleetfluid.label(text, labels, multiple=True)\nprint(result.labels)  # [\"technology\", \"business\"]\nprint(result.confidence_scores)  # {\"technology\": 0.9, \"business\": 0.85}\n```\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## 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## 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## 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.2",
    "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": "a07016e8bd4a2b2ce5af92ff82a7866885565445af8e16bfd693fd4dd2027e4e",
                "md5": "0c4b6f608920fb4546e60302fa10fdf0",
                "sha256": "57a8cc02f4640ebd82ef5478b5af9434977d7b037245f3afd73fdcf0753a5b58"
            },
            "downloads": -1,
            "filename": "fleetfluid-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0c4b6f608920fb4546e60302fa10fdf0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7969,
            "upload_time": "2025-07-19T19:31:10",
            "upload_time_iso_8601": "2025-07-19T19:31:10.777421Z",
            "url": "https://files.pythonhosted.org/packages/a0/70/16e8bd4a2b2ce5af92ff82a7866885565445af8e16bfd693fd4dd2027e4e/fleetfluid-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "53570f8919327b563fac46169b52403fe297dfc06de5ebcb6290b9501855fa75",
                "md5": "0c18659f716422327708f953bd4b11c5",
                "sha256": "e60b2257eb4ace9682ee1a6c20698129c53498e55651de629d0141328b91f4ef"
            },
            "downloads": -1,
            "filename": "fleetfluid-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "0c18659f716422327708f953bd4b11c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7896,
            "upload_time": "2025-07-19T19:31:12",
            "upload_time_iso_8601": "2025-07-19T19:31:12.008576Z",
            "url": "https://files.pythonhosted.org/packages/53/57/0f8919327b563fac46169b52403fe297dfc06de5ebcb6290b9501855fa75/fleetfluid-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-19 19:31:12",
    "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: 0.47780s