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.28.tar.gz (73.0 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.28-py3-none-any.whl (62.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastsdk-0.2.28.tar.gz
  • Upload date:
  • Size: 73.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for fastsdk-0.2.28.tar.gz
Algorithm Hash digest
SHA256 7f1e1aaf08a2d0408c92ad5cabc3f8850c70f79648b54587c9da25d5ed87c9e2
MD5 9d0b712e6734a7dc0a79f0b8eb919737
BLAKE2b-256 aebcf5c4a6468b2d6538293c76e9f4a1cc25fc1329e8bc2d875dbf4ee7fb4e73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fastsdk-0.2.28-py3-none-any.whl
  • Upload date:
  • Size: 62.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for fastsdk-0.2.28-py3-none-any.whl
Algorithm Hash digest
SHA256 47f40694b5677ccd9a8e8b84dc224cd3f34ef4e49a8bd748732149c64c558ce4
MD5 b07681ea33b74241edc5a6a43d94999b
BLAKE2b-256 c6fda8606d5bd7edf6a592a4c1235c37f41c63e1a9a6fdb20013dec89db69bed

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