Skip to main content

Your SDK and model zoo for generative AI. Build AI-powered applications with ease.

Project description

fastSDK

Built your SDK for any hosted service

Ever wanted to use web APIs as if they are any other python function? It was never easier to build an SDK for your hosted services, than it is with fastSDK. FastSDK creates a full functioning client for any openapi service.

Why?

Let's say you have created a webservice for example with fastAPI or flask and now you want to write a python client for it. In a first approach you would just use the requests library and send the requests to the server. However, while you do so, your cpu is idle waiting for the request to finish. Over time your requirements get bigger, suddenly you do not only have one endpoint but multiples. You will do different requests in parallel, you need to transfer files, and you struggle to do so in a structured, performant way. Suddenly you end up in a threading, asyncio and complexity hell with many inconsistencies. You realize that you cannot transfer your 1GB video via an simple web request to your beautiful API. All these problems are solved with the fastSDK. Simple API calls, file uploads, job handling, and cloud storage providers are just a few features of the fastSDK.

FastSDK is designed to work beautifully with long-running services like machine learning and data processing endpoints. It works hand-in-hand with APIPod that let's you build and deploy those services and endpoints easily.

Service compatibility

Out of the box works with following services:

Can be used together with

Features:

  • Easy file upload, download thanks to media-toolkit.
  • Async and Threaded job support. Execute multiple requests and heavy preprocessing tasks in parallel and with high speed.
    • Massively parallel job and request execution.
  • Working with services that create "Jobs". The SDK will wait for the job to finish and return the result.
  • Streaming of files
  • Automatic serialization of data types

Installation

To install from PyPI: This version includes all features needed to conveniently wrap your API into an SDK.

pip install fastsdk

Get started

First get your openapi.json file from your service usually under: http://localhost:8000/openapi.json. You can use an example openapi.json from our face2face service located in this repos under /test/test_files/face2face.json

# create a full working client stub 
create_sdk("openapi.json", save_path="my_service.py")

# Import the client. It will have a method for each of your service endpoints including all parameters and its default values.
from my_service import awesome_client
mySDK = awesome_client()
mySDK.my_method(...)

Authorization

Let's say you have created your SDK (client) with @fastSDK and named it face2face Then you can init it with arguments. In this moment you can pass the api key.

f2f = face2face(api_key="my_api_key")
api_job = f2f.swap_img_to_img(source_img="my_face_1.jpg", target_img="my_face_2.jpg")
swapped_img = api_job.get_result()

Alternatively you can set the api_keys in the settings and give them names like "runpod". Add this at the beginning of your script.

import os
import settings
settings.api_keys["runpod"] = os.getenv("my_api_key")

API keys can be set in environment variables, when creating the Service Client or when initializing your SDK. In settings.py the default environment variables are set.

FastSDK :two_hearts: APIPod

APIPod allows you to easily create and deploy services that can be used with fastSDK. They are two beating hearts :two_hearts: beating in harmony for client <--> service interaction. Create your service now.

Contribute

We at socaity want to provide the best tools to bring generative AI to the cloud. Please report bugs, your ideas and feature requests in the issues section. fastSDK is licensed under the MIT license and free-to-use.

Note: THE PACKAGE IS STILL IN DEVELOPMENT!

LEAVE A STAR TO SUPPORT US. ANY BUG REPORT OR CONTRIBUTION IS HIGHLY APPRECIATED.

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

fastsdk-0.2.30.tar.gz (72.2 kB view details)

Uploaded Source

Built Distribution

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

fastsdk-0.2.30-py3-none-any.whl (61.4 kB view details)

Uploaded Python 3

File details

Details for the file fastsdk-0.2.30.tar.gz.

File metadata

  • Download URL: fastsdk-0.2.30.tar.gz
  • Upload date:
  • Size: 72.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fastsdk-0.2.30.tar.gz
Algorithm Hash digest
SHA256 0f24f5a069e00840ab10542e48fe5d26686a143680f8a9933321fbf6dd6cf7eb
MD5 e4c74bac14d7a8c2312e0daddc178914
BLAKE2b-256 e319ac6366536c30516f8bea4dd44ed08852c6ce9dd8b16c5984c1ff3c8c15fd

See more details on using hashes here.

File details

Details for the file fastsdk-0.2.30-py3-none-any.whl.

File metadata

  • Download URL: fastsdk-0.2.30-py3-none-any.whl
  • Upload date:
  • Size: 61.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fastsdk-0.2.30-py3-none-any.whl
Algorithm Hash digest
SHA256 458fac579127ddbf9edae96a041198a301cabda5f6f6e97ec5a2aaf37268d6f9
MD5 15033f200d9fa671353460eb9b264dc8
BLAKE2b-256 4c1eee49fa5a5b6fbe65aea7bf19a9138e79b097f60bf56728102d98b53e49dc

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