Metadata-Version: 2.4
Name: autonomize-core
Version: 0.1.16
Summary: Autonomize Core contains the unified authentication source to access platform.
License: Proprietary
License-File: LICENSE
Author: Varun Prakash
Author-email: varun.prakash@autonomize.ai
Requires-Python: >=3.12,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Classifier: Typing :: Typed
Requires-Dist: httpx (>=0.28.0)
Project-URL: Documentation, https://github.com/autonomize-ai/autonomize-core
Project-URL: Homepage, https://github.com/autonomize-ai/autonomize-core
Project-URL: Repository, https://github.com/autonomize-ai/autonomize-core
Description-Content-Type: text/markdown

# Autonomize Core

![Python Version](https://img.shields.io/badge/Python-3.12+-blue?style=for-the-badge&logo=python)
![PyPI Version](https://img.shields.io/pypi/v/autonomize-core?style=for-the-badge&logo=pypi)
![Code Formatter](https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge)
![Code Linter](https://img.shields.io/badge/linting-pylint-green.svg?style=for-the-badge)
![Code Checker](https://img.shields.io/badge/mypy-checked-blue?style=for-the-badge)
![Code Coverage](https://img.shields.io/badge/coverage-100%25-a4a523?style=for-the-badge&logo=codecov)

## Overview

Autonomize Core houses the core functionality about authentication of our in-house platform.

## Features

- **Authentication**: The SDK allows you to authenticate tokens for Modelhub.
- **High scalability**: Built to handle large-scale data retrieval and generation, enabling robust, production-ready applications.

## Installation

1. Create a virtual environment, we recommend [Miniconda](https://docs.anaconda.com/miniconda/) for environment management:
    ```bash
    conda create -n autocore python=3.12
    conda activate autocore
    ```
2. Install the package:
    ```bash
    pip install autonomize-core
    ```

To install with optional dependencies like Qdrant, Huggingface, OpenAI, Modelhub, etc., refer to the [Installation Guide](INSTALL.md).


## Usage

### Authentication Types

The SDK supports three authentication methods:

1. **OAuth 2.0 Client Credentials Flow** (default)
2. **API Key Authentication**
3. **Permanent Token Authentication**

### Sync Usage

#### OAuth Authentication (Default)

```python
import os
from autonomize.core.credential import ModelhubCredential

cred = ModelhubCredential(
    modelhub_url=MODELHUB_URI,
    client_id=MODELHUB_AUTH_CLIENT_ID,
    client_secret=MODELHUB_AUTH_CLIENT_SECRET,
)

token = cred.get_token()  # Returns JWT token from OAuth flow
```

#### API Key Authentication

```python
from autonomize.core.credential import ModelhubCredential

# Using API key directly (no OAuth flow)
cred = ModelhubCredential(
    api_key="your-api-key-here"
)

token = cred.get_token()  # Returns API key directly
```

#### Permanent Token Authentication

```python
from autonomize.core.credential import ModelhubCredential
from autonomize.types.core.credential import AuthType

# Using permanent token with explicit auth_type
cred = ModelhubCredential(
    token="your-permanent-token-here",
    auth_type=AuthType.PERMANENT_TOKEN
)

token = cred.get_token()  # Returns token directly without validation
```

### Async Usage

Simply use sync methods with `a` prefix and use `await` for each call:

```python
import asyncio
from autonomize.core.credential import ModelhubCredential
from autonomize.types.core.credential import AuthType

async def main():
    # OAuth authentication
    cred = ModelhubCredential(
        modelhub_url=MODELHUB_URI,
        client_id=MODELHUB_AUTH_CLIENT_ID,
        client_secret=MODELHUB_AUTH_CLIENT_SECRET,
    )
    token = await cred.aget_token()

    # API key authentication
    cred_api = ModelhubCredential(api_key="your-api-key")
    api_key = await cred_api.aget_token()

    # Permanent token authentication
    cred_perm = ModelhubCredential(
        token="your-permanent-token",
        auth_type=AuthType.PERMANENT_TOKEN
    )
    perm_token = await cred_perm.aget_token()

asyncio.run(main())
```

## New preferred environment variables:
```
MODELHUB_URI=https://your-modelhub.com
MODELHUB_AUTH_CLIENT_ID=your_client_id
MODELHUB_AUTH_CLIENT_SECRET=your_secret
MODELHUB_API_KEY=your_api_key
GENESIS_CLIENT_ID=your_genesis_client
```

## Old environment variables (still work for backward compatibility):
```
MODELHUB_BASE_URL=https://your-modelhub.com
MODELHUB_CLIENT_ID=your_client_id
MODELHUB_CLIENT_SECRET=your_secret
CLIENT_ID=your_client
COPILOT_ID=your_copilot
GENESIS_COPILOT_ID=your_copilot
```

## Contribution

To contribute in our Autonomize Core SDK, please refer to our [Contribution Guidelines](CONTRIBUTING.md).

## License
Copyright (C) Autonomize AI - All Rights Reserved

The contents of this repository cannot be copied and/or distributed without the explicit permission from Autonomize.ai

