Skip to main content

Autonomize Core contains the unified authentication source to access platform.

Project description

Autonomize Core

Python Version PyPI Version Code Formatter Code Linter Code Checker Code Coverage

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 for environment management:
    conda create -n autocore python=3.12
    conda activate autocore
    
  2. Install the package:
    pip install autonomize-core
    

To install with optional dependencies like Qdrant, Huggingface, OpenAI, Modelhub, etc., refer to the Installation Guide.

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)

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

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

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:

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
GENESIS_COPILOT_ID=your_copilot

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

Contribution

To contribute in our Autonomize Core SDK, please refer to our Contribution Guidelines.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autonomize_core-0.1.14.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autonomize_core-0.1.14-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file autonomize_core-0.1.14.tar.gz.

File metadata

  • Download URL: autonomize_core-0.1.14.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for autonomize_core-0.1.14.tar.gz
Algorithm Hash digest
SHA256 2be77f353664270077facbd3fb36fab67195faedd1bfc1ae744c57d776136c41
MD5 da65783f1c63ffaa4e980553003e51d1
BLAKE2b-256 0b908586be9be493c82b9851c649507178300cd11af1c34ea830adb5130c739e

See more details on using hashes here.

File details

Details for the file autonomize_core-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: autonomize_core-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.11 Linux/6.11.0-1018-azure

File hashes

Hashes for autonomize_core-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4fa0b31e6c99e4716707b9d3a21bea0b4af6a337f1ae1679ad7f3b6af9d1dc
MD5 0436b9929bb1445e4e2c3b9ea33682bb
BLAKE2b-256 3224091df0316b82fb3458c0b136f66ed8cf0bdc1f674bda55e9991803a6ee29

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page