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.32.tar.gz (73.7 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.32-py3-none-any.whl (63.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastsdk-0.2.32.tar.gz
  • Upload date:
  • Size: 73.7 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.32.tar.gz
Algorithm Hash digest
SHA256 bae346b60bd81aa985d004d5c971dae23fb767878df7e4978fe6426ab8134eab
MD5 147f52802bf64dab9e23e4abfac3d0e1
BLAKE2b-256 3b00d24bab9ae95f634cfd04c6ceef5f2791c825c2f66c1e5a5b714190dfcded

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastsdk-0.2.32-py3-none-any.whl
  • Upload date:
  • Size: 63.2 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.32-py3-none-any.whl
Algorithm Hash digest
SHA256 39627dcd18f7ba90cc5203aad28c755ddf15b50e8d475d69248d862cb8aa656e
MD5 454c0cecfbad685116a5b30e0d16638e
BLAKE2b-256 769b8f3a06f9354020491a170b2478b040ebe979a9ebe102c7ef990c73fef02b

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