This client library is designed for Go developers who want to interact with the Text Embeddings Inference server. It handles the underlying HTTP requests and offers a simple API for embedding text.
To install the package, you can run:
go get github.com/gage-technologies/tei-go
Here's a simple example to demonstrate how to use this library:
import "github.com/gage-technologies/tei-go/tei"
func main() {
client := tei.NewClient("http://localhost:8080", nil, nil, time.Second*30)
res, err := client.Embed("Hi there!", false)
if err != nil {
panic(err)
}
fmt.Println("Embedding: ", res[0])
}
The client allows you to specify a timeout for HTTP requests.
You can specify custom headers when creating a new client:
headers := map[string]string{"Authorization": "Bearer token"}
client := tei.NewClient("http://localhost:8080", headers, nil, time.Second*30)
You can also specify cookies when creating a new client:
cookies := map[string]string{"session_id": "abc123"}
client := tei.NewClient("http://localhost:8080", nil, cookies, time.Second*30)
This project is licensed under the Apache 2.0 License - see the LICENSE file for details