Metadata-Version: 2.4
Name: genguardx
Version: 2026.3.31
Summary: Python SDK to interact with the GenGuardX Platform
License-Expression: Apache-2.0
Project-URL: Homepage, https://ggx.corridorplatforms.com
Project-URL: Documentation, https://ggx-docs.corridorplatforms.com
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx
Requires-Dist: python-dateutil
Requires-Dist: plotly>=4.0
Requires-Dist: pydantic
Requires-Dist: typing-extensions
Requires-Dist: importlib-metadata
Requires-Dist: numpy
Requires-Dist: pandas

# GenGuardX Python SDK

[![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-Proprietary-red.svg)](https://corridorplatforms.com)

**GenGuardX Python SDK** provides a python interface to interact with the GenGuardX Platform - an enterprise-grade AI governance, model management, and monitoring solution from Corridor Platforms.

## Installation

### Using pip

```bash
pip install genguardx
```

## Quick Start

### 1. Initialize Connection

Connect to your GenGuardX platform instance:

```python
import genguardx as ggx

# Initialize with your API key
ggx.init(api_key='your-api-key-here')
```

For custom deployments, specify the API URL:

```python
ggx.init(
    api_key='your-api-key-here',
    api_url='your-genguardx-instance-url'
)
```

### 2. Check Your Connection

```python
# Verify who you're logged in as
ggx.whoami()
# Output: Logged in as 'John Doe' to workspace 'corridor'. Any changes made in this session will be tracked under the user 'john.doe'.
```

### 3. Work with AI Pipelines

```python
# Access a registered pipeline
chatbot = ggx.Pipeline('customer_support_bot')

# View pipeline details
print(f"Pipeline: {chatbot.name} (v{chatbot.version})")
print(f"Status: {chatbot.current_status}")
print(f"Description: {chatbot.description}")

# Simulate the pipeline with test inputs
results = chatbot(
    user_message="What's my account balance?",
    context={"customer_id": "12345"}
)
print(results)

```

### 4. List Available Components

```python
# List all available pipelines
all_pipelines = ggx.Pipeline.all()
for pipeline in all_pipelines:
    print(f"- {pipeline.name} (v{pipeline.version})")

# Filter pipelines by group
ml_pipelines = ggx.Pipeline.all(group='Machine Learning')

# Search across all pipelines
qa_pipelines = ggx.Pipeline.all(contains='question')
```

## Core Concepts

### DataTable

Represents registered datasets that can be queried and analyzed:

```python
# Access by alias or name
table = ggx.DataTable(alias='customer_data')

# Get column information
for column in table.columns:
    print(f"{column.alias}: {column.type}")

# Access as PySpark DataFrame
df = table.to_spark()

# Get data types dictionary
dtypes = table.dtypes  # {'customer_id': 'str', 'signup_date': 'datetime', ...}
```

### Model (Foundation Models)

Manage and version AI models:

```python
# Load a model
gpt_model = ggx.Model('gpt4-turbo')

# Check model properties
print(f"Provider: {gpt_model.provider}")
print(f"Model Type: {gpt_model.type}")
print(f"Version: {gpt_model.version}")

# Simulate model execution
result = gpt_model(
    prompt="Explain quantum computing",
    temperature=0.7
)
```

### Prompt

Manage versioned prompt templates:

```python
# Access a prompt template
prompt = ggx.Prompt('classification_prompt')

# View template and arguments
print(f"Template: {prompt.template}")
print(f"Arguments: {prompt.arguments}")

# Get prompt metadata
print(f"Task Type: {prompt.current_status}")
print(f"Group: {prompt.group}")
```

### RAG (Retrieval-Augmented Generation)

Access RAG systems for context-aware AI:

```python
# Load a RAG configuration
knowledge_rag = ggx.Rag('product_knowledge_base')

# Check RAG details
print(f"Type: {knowledge_rag.type}")
print(f"Description: {knowledge_rag.description}")

# Simulate RAG retrieval
results = knowledge_rag(
    query="What are the product specifications?",
    top_k=5
)
```

### Pipeline

Orchestrate complex AI workflows:

```python
# Access pipeline
pipeline = ggx.Pipeline('sentiment_analyzer')

# View pipeline configuration
print(f"Type: {pipeline.pipeline_type}")
print(f"Inputs: {pipeline.input_models}")
print(f"Prompts: {pipeline.input_prompts}")

# Check permissible purposes
print(f"Allowed for: {pipeline.permissible_purpose}")

# For chat-based pipelines, access chat sessions
if pipeline.pipeline_type == "Chat based - OpenAI Spec":
    sessions = pipeline.chat_sessions
    for session in sessions[:5]:
        print(f"Session: {session.name}")
```

## Searching and Filtering

All main components support powerful search and filtering:

```python
# Search by name
models = ggx.Model.all(name='gpt')

# Search by contains
pipelines = ggx.Pipeline.all(contains='customer')

# Filter by group
qa_checks = ggx.QualityCheck.all(group='Data Quality')

# Filter by status
approved_models = ggx.Model.all(status='approved')

# Combine filters
results = ggx.Pipeline.all(
    group='Production',
    status='approved',
    contains='chatbot'
)
```

## Documentation

- **Homepage**: https://ggx-docs.corridorplatforms.com

## Support

For support, please contact:

- **Email**: support@corridorplatforms.com
- **Documentation**: https://ggx-docs.corridorplatforms.com
- **Enterprise Support**: Available for enterprise customers

---
