Code Monkey home page Code Monkey logo

api-interfaces's Introduction

๐Ÿ“ Table of Contents

About

Api-Interfaces is the gRPC protocol for communication between the api-bridge, the api-web, and the generator_server. Additionally, any other client application communicating directly with api-web also use the interfaces generated from this repository.

Getting Started

These instructions will get you an environment setup to build the interface files from the proto source files.

Prerequisites

The following items are needed to develop api-interfaces:

It is recommended to use ssh cloning with this project for git and for go get, although https does appear to work. To force ssh (for github) put the following in your .gitconfig:

[url "ssh://[email protected]/"]
  insteadOf = https://github.com/

Setup and building

After all the prerequisites are installed and available, this project can be setup by the following:

git clone --recurse-submodules [email protected]:Stability-AI/api-interfaces.git
cd api-interfaces
cmake .
cmake --build .

This will produce files for the various languages in gooseai to support the proto files in src. When rebuilding the files it is recommended to do a clean before as there have been instances of not all files being regenerated without it.

๐ŸŽˆ Usage

The generated files are all output in gooseai. How to use these files depends on the programming language being used. The following sections provide details for each of the supported languages.

The files have different usages and not all are required depending on the situation:

Suffix Client Server
_grpc_pb โœ”๏ธ1 โœ”๏ธ
_pb_service โœ”๏ธ2
_pb โœ”๏ธ โœ”๏ธ
  1. Not needed for typescript/javascript clients.
  2. Only needed for typscript/javascripts clients.

Golang

For Golang the interfaces can be added to the project as a normal module require. To add them run:

go get github.com/Stability-AI/api-interfaces@latest

Similarly to update them just run the same command with the short sha of the version to update to. Use them as you would a normal module.

Python

With the current output, the best way to consume these is to add them as a git submodule to your project. It is recommended to use ssh clone when adding the submodule. To update them just checkout the newer version from within the submodule (and remember to commit the submodule change to your project).

To use them make sure the files are on the python path.

Typescript / Javascript

With the current output, the best way to consume these is to add them as a git submodule to your project. It is recommended to use ssh clone when adding the submodule. To update them just checkout the newer version from within the submodule (and remember to commit the submodule change to your project).

To use them make sure they are in a location that can be found by your typescript/javascript files.

NOTE: Typescript requires both the typescript and javascript files to be available.

Other Languages / Custom Build

If not using the CMake defined builds to generate make sure when building from the source proto files that the following proto include paths are set:

  • src/proto
  • src/tensorizer/proto

api-interfaces's People

Contributors

arsenetar avatar chigozienri avatar dmarx avatar gd1551 avatar huo-ju avatar johnsabath avatar palp avatar pharmapsychotic avatar systemcluster avatar wbrown avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.