INTEGRATIONS SDK

Welcome to the E2E Networks External Integrations notebook! This guide will take you through the entire workflow of creating and managing Integrations using E2E Networks SDK.

Whether you want to create the Integration of type Hugging Face or Weight & Biases, you can create using the SDK.

For detailed information about the available methods and how to use them, you can call the help() function of the Integration class.

Overview

The Integration SDK offers a user-friendly interface to:

  • Create Integration: Create an integration with Hugging Face or Weights & Biases using the SDK

  • List Integrations: Retrieve a list of all available integrations and access detailed information for any specific integration within the system.

  • Delete Integration: Delete an integration as needed by utilizing the appropriate function to remove it from the system.

  • Show Integrations: Display the list of all integrations and view the details of any specific integration as required.

Setup the SDK and Initialize a IntegrationClient

First of all install the E2E Networks library

from e2enetworks.cloud import tir
from e2enetworks.cloud.tir import Integration
  • There are two ways by which you can initialize the SDK with your credentials

  1. Using the load_config

CONFIG_FILE_PATH = "path_to_config_file"
tir_client = tir.load_config(CONFIG_FILE_PATH)
  1. By defining the credentials and project details

# Define your credentials and project details
TIR_API_KEY = 'your_tir_api_key'
TIR_ACCESS_TOKEN = 'your_tir_access_token'
TIR_PROJECT_ID = 'your_tir_project_id'
TIR_TEAM_ID = 'your_tir_team_id'

# Initialize the SDK
tir.init(
    api_key=TIR_API_KEY,
    access_token=TIR_ACCESS_TOKEN,
    project=TIR_PROJECT_ID,
    team=TIR_TEAM_ID
)

Set up and initialize the SDK file to start using its functionalities.

# Initialize the integration_client
integration_client = Integration()

# Optionally, display the available methods and their usage
integration_client.help()

Configure and Create Integration

Change the integration parameters as per your requirements. You can make use of the various functions provided at the end of the notebook to explore different options that suit your needs.

# Define your Integration parameters
INTEGRATION_NAME = "sample-integration"
TOKEN = 123456  # Replace with your Hugging Face Token or WandB Key
There are 2 types of Integration which can be created:
  • Hugging Face - set the INTEGRATION_TYPE variable as hugging_face to create Hugging Face Integration.

  • Weight & Biases - set the INTEGRATION_TYPE variable as weights_biases to create the Weight & Biases Integration.

  1. Hugging Face

Specify the necessary parameters for integrating with Hugging Face and proceed to create the integration.

INTEGRATION_TYPE = "hugging_face"


is_success, data = integration_client.create(
    name = INTEGRATION_NAME,
    token = TOKEN,
    integration_type = INTEGRATION_TYPE
)

# Check success
if is_success:
    print("Your Integration is created successfully.")
else:
    print("Failed to create Integration.")
  1. Weight & Biases

Provide the required parameters for Weights & Biases integration and set up the integration accordingly.

INTEGRATION_TYPE = "weights_biasese"
WANDB_USERNAME = "test_username"  # Replace with your WandB Username
WANDB_PROJECT = "test_project" # Replace with your WandB Project

is_success, data = integration_client.create(
    name = INTEGRATION_NAME,
    token = TOKEN,
    integration_type = INTEGRATION_TYPE,
    wandb_username = WANDB_USERNAME,
    wandb_project = WANDB_PROJECT
)

# Check success
if is_success:
    print("Your Integration is created successfully.")
else:
    print("Failed to create Integration.")

List Integration and Integration Details

Get list of the Integration and details of any specific integration

#To return all integrations of a specified type.
list_integrations(INTEGRATION_TYPE)

#To retrieve details for a specific integration.
get_integration_details(INTEGRATION_ID)

Delete Integrations

To delete an integration, follow the correct procedure to remove it

# To delete any specific integration.
delete_integration(integration_id)

Show Integrations

To view the List of Integrations and details of any Integration, use the methods.

# To Display a table of all integrations of any specific type of Integration.
show_integrations(integration_type)

# To Display details of any specific Integration
show_integration_details(integration_id)