Skip to content

eachlabs/eachgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Each Golang Client

A Golang client for Each. Each is a platform for deploying and combining machine learning models as APIs.

This library supports only Each Flow API.

Installation

go get github.com/eachlabs/each-go

Usage

package main

import (
	"context"
	"fmt"

	each "github.com/eachlabs/eachgo"
)

func main() {
	appCtx := context.Background()
	client, err := each.NewClient(each.WithCredential("YOUR_API_KEY"))
	if err != nil {
		panic(err)
	}
}

Flow Methods

Each provides an AI workflow engine to orchestrate multiple models and data sources. You can create a chain flow multiple models and data sources together.

For more information, please refer to the Each Flow API documentation.

Trigger a Flow

    flowID := "flow id" 
    inputs := map[string]interface{}{
        "input1": "value1",
        "input2": "value2",
    }
    triggerID, err := client.TriggerFlow(ctx, flowID, inputs)
    if err != nil {
        panic(err)
    }
    fmt.Println(triggerID)

Get Execution

    triggerID := "trigger id"
    flowID := "flow id"
    result, err := client.GetExecution(ctx, flowID, triggerID)
    if err != nil {
        panic(err)
    }
    fmt.Println(result)

Get Executions

    flowID := "flow id"
    results, err := client.GetExecutions(ctx, flowID)
    if err != nil {
        panic(err)
    }
    fmt.Println(results)

TODO

  • Add tests
  • Add more examples
  • Add inference API support
  • CI Integration

About

Golang client for Each AI Flow and AI Inference API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages