Metadata-Version: 2.4
Name: get-systems
Version: 0.2.26
Summary: Get Systems Prefect Blocks - Enterprise LLM and HTTP operations
Author: Get Systems
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: prefect>=3.6.5
Requires-Dist: pydantic>=2.0.0
Provides-Extra: llm
Requires-Dist: openai>=2.21.0; extra == "llm"
Provides-Extra: http
Requires-Dist: httpx>=0.27.0; extra == "http"
Provides-Extra: models
Requires-Dist: nameparser>=1.1.3; extra == "models"
Requires-Dist: gender-guesser>=0.4.0; extra == "models"
Requires-Dist: python-stdnum>=1.19; extra == "models"
Provides-Extra: azure-cu
Requires-Dist: azure-ai-contentunderstanding; extra == "azure-cu"
Requires-Dist: azure-identity; extra == "azure-cu"
Provides-Extra: azure-cu-langchain
Requires-Dist: langchain-azure-ai; extra == "azure-cu-langchain"
Provides-Extra: all
Requires-Dist: openai>=2.21.0; extra == "all"
Requires-Dist: httpx>=0.27.0; extra == "all"
Requires-Dist: nameparser>=1.1.3; extra == "all"
Requires-Dist: gender-guesser>=0.4.0; extra == "all"
Requires-Dist: python-stdnum>=1.19; extra == "all"
Requires-Dist: azure-ai-contentunderstanding; extra == "all"
Requires-Dist: azure-identity; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=9.0.2; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"

# get_systems - Get Systems Prefect Blocks

Enterprise-grade Prefect blocks for LLM operations, HTTP requests, and data models.

🐍 **Available on PyPI** — install it with `pip install get-systems`

## Features

### LLM Module (`get_systems.llm`)
- ✅ **OpenAI & Azure OpenAI Support** - Seamlessly switch between providers
- ✅ **Environment Variables** - Automatic fallback to env vars
- ✅ **Retry Logic** - Exponential backoff with jitter
- ✅ **Caching** - Optional in-memory response caching
- ✅ **Safe Logging** - No API key leaks
- ✅ **Flexible Parameters** - Pass any OpenAI API parameter via **kwargs
- ✅ **Function Calling** - Full support for tools

### HTTP Module (`get_systems.http`)
- ✅ **Multiple Auth Types** - None, Basic, Token, Bearer
- ✅ **Async HTTP Client** - Built on httpx
- ✅ **Prefect Integration** - First-class block support

### Models Module (`get_systems.models`)
- ✅ **Pydantic Models** - Type-safe data models with validation
- ✅ **Address Parsing** - German address format support with normalization
- ✅ **Contact Management** - Client, Debtor, and Contact models
- ✅ **GDPR Compliance** - Data protection and source tracking fields
- ✅ **Bank Accounts** - IBAN/BIC validation via python-stdnum
- ✅ **Event Handling** - Case events and interest calculations

### Azure Content Understanding Module (`get_systems.azure_cu`)
- ✅ **Async Azure SDK Client** - URL analysis through Azure AI Content Understanding
- ✅ **Prefect Block Config** - Store endpoint, key, and optional API version
- ✅ **Usage Metadata** - Returns raw analysis data plus token usage metadata when available
- ✅ **LangChain Tool Block** - Optional separate block for `langchain-azure-ai`

## Installation

### Install Everything (Recommended)

```bash
pip install "get_systems[all]"
```

### Install Specific Modules

Install only what you need:

```bash
# For LLM operations only
pip install "get_systems[llm]"

# For HTTP operations only  
pip install "get_systems[http]"

# For Azure Content Understanding only
pip install "get_systems[azure_cu]"

# For Azure Content Understanding LangChain tools
pip install "get_systems[azure_cu_langchain]"

# Install several modules
pip install "get_systems[llm,http,azure_cu]"
```

### From Azure Artifacts

```bash
# All modules
pip install "get_systems[all]" --extra-index-url https://pkget_systems.dev.azure.com/get-systems/_packaging/get-systems/pypi/simple/

# Specific modules
pip install "get_systems[llm]" --extra-index-url https://pkget_systems.dev.azure.com/get-systems/_packaging/get-systems/pypi/simple/
pip install "get_systems[http]" --extra-index-url https://pkget_systems.dev.azure.com/get-systems/_packaging/get-systems/pypi/simple/
```

### What Gets Installed

| Installation | Dependencies |
|-------------|--------------|
| `pip install get_systems` | `prefect`, `pydantic` (base only) |
| `pip install "get_systems[llm]"` | Base + `openai` |
| `pip install "get_systems[http]"` | Base + `httpx` |
| `pip install "get_systems[azure_cu]"` | Base + Azure Content Understanding SDK |
| `pip install "get_systems[azure_cu_langchain]"` | Base + `langchain-azure-ai` |
| `pip install "get_systems[all]"` | Base + LLM + HTTP + models + Azure Content Understanding SDK |

## Quick Start

### LLM Operations

```python
from get_systems.llm import GptCompletionBlock, GptAuth, LlmRuntime
from prefect import flow

# Configure auth
auth = GptAuth(
    api_key="sk-...",
    model="gpt-4o-mini",
    is_azure=False
)

# Create completion block
block = GptCompletionBlock(
    auth=auth,
    prompt="What is Prefect?",
    temperature=0.7
)

@flow
async def my_llm_flow():
    result = await block.run()
    print(result.content)
```

### HTTP Operations

```python
from get_systems.http import HttpAuth, HttpBlock
from prefect import flow

# Configure HTTP auth
auth = HttpAuth(
    auth_type="bearer",
    token="your-token",
    base_url="https://api.example.com"
)

# Create HTTP block
http_block = HttpBlock(auth=auth)

@flow
async def my_http_flow():
    response = await http_block.request("GET", "/users")
    print(response.json())
```

### Azure Content Understanding

```python
from get_systems.azure_cu import AzureAIContentBlock
from prefect import flow

cu_block = AzureAIContentBlock(
    endpoint="https://your-resource.services.ai.azure.com",
    key="your-key",
)

@flow
async def analyze_document():
    result = await cu_block.analyze_url(
        analyzer_id="auftrag",
        document_url="https://example.com/document.pdf",
    )
    print(result["raw"])
    print(result["usage"])
```

### Azure Content Understanding LangChain Tool

```python
from get_systems.azure_cu import AzureAIContentLangChainBlock

config_block = await AzureAIContentLangChainBlock.load("azure-cu-langchain-config")
tool = config_block.get_tool(analyzer_id="auftrag")
```

### Data Models

```python
from get_systems.models import Address, Contact, Debtor, BankAccount

# Parse German address from string
address = Address.from_raw("Zimmerstraße 456 c/o Amtsgericht, 63225 Langen, DE")
print(address.street)  # "Zimmerstraße 456 c/o Amtsgericht"
print(address.zip_code)  # "63225"
print(address.city)  # "Langen"

# Create address with validation
address = Address(
    street="Musterstraße 321a",
    zip_code="12345",
    city="Berlin",
    country_code="DE",
    validity="G"  # Gültig (Valid)
)

# GDPR-compliant data tracking
address_with_source = Address(
    street="Hauptstraße 10",
    zip_code="10115",
    city="Berlin",
    country_code="DE",
    source_contact_designation="Auskunftei",
    source_contact_id="12345",
    source_date="2026-06-01"
)

# Create debtor with contact info
debtor = Debtor(
    first_name="Max",
    last_name="Mustermann",
    addresses=[address],
    person_type="NP"  # Natural Person
)
```

## Register Blocks in Prefect

```bash
# Register all blocks
prefect block register -m get_systems.llm.gpt_blocks
prefect block register -m get_systems.http.http_block
prefect block register -m get_systems.azure_cu

# View registered blocks
prefect block ls
```

## Import Styles

All import styles are supported:

```python
# Submodule imports (recommended)
from get_systems.llm import GptCompletionBlock, GptAuth
from get_systems.http import HttpAuth, HttpBlock
from get_systems.azure_cu import AzureAIContentBlock, AzureAIContentLangChainBlock

# Direct module imports
from get_systems.llm.gpt_blocks import GptCompletionBlock
from get_systems.http.http_block import HttpAuth
from get_systems.azure_cu.blocks import AzureAIContentBlock

# Package-level imports
from get_systems import GptCompletionBlock, HttpAuth, AzureAIContentBlock
```

## Environment Variables

### OpenAI Configuration:

```bash
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini
OPENAI_BASE_URL=https://api.openai.com/v1  # optional
```

### Azure OpenAI Configuration:

```bash
OPENAI_API_KEY=your-azure-key
OPENAI_BASE_URL=https://your-resource.openai.azure.com
OPENAI_MODEL=your-deployment-name
OPENAI_API_VERSION=2024-02-15-preview
OPENAI_IS_AZURE=true
```

### Azure Content Understanding Configuration:

```bash
CONTENT_UNDERSTANDING_ENDPOINT=https://your-resource.services.ai.azure.com
CONTENT_UNDERSTANDING_KEY=your-key
CONTENT_UNDERSTANDING_API_VERSION=2025-11-01  # optional; SDK default is used when omitted
```

## Documentation

- [docs/QUICKSTART-GS.md](docs/QUICKSTART-GS.md) - Quick start and usage examples
- [docs/MODELS.md](docs/MODELS.md) - Complete models documentation (Address, Contact, BankAccount, etc.)
- [docs/MIGRATION.md](docs/MIGRATION.md) - Migration guide from old packages
- **LLM Module**: Full OpenAI/Azure OpenAI integration with enterprise features
- **HTTP Module**: Flexible HTTP client with multiple authentication types
- **Models Module**: Pydantic models for addresses, contacts, bank accounts with validation
- **Prefect Integration**: Native Prefect block support for LLM and HTTP modules

## License

Proprietary - Get Systems
