This is Cohere's unofficial Go client, designed to enable you to use Cohere's services easily from your own applications.
Cohere empowers every developer and enterprise to build amazing products and capture true business value with language AI.
Index Operations | Status |
---|---|
Generate | 🟢 |
Chat | 🟢 |
Embed | 🟢 |
Classify | 🟢 |
Tokenize | 🟢 |
Detokenize | 🟢 |
Detect Language | 🟢 |
Summarize | 🟢 |
Rerank | 🟢 |
You can load cohere-go into your project by using:
go get github.com/henomis/cohere-go
The only thing you need to start using Cohere's APIs is the developer API key and related environment. Copy and paste them in the corresponding place in the code, select the API and the parameters you want to use, and that's it.
Please refer to the examples folder to see how to use the SDK.
Here below a simple usage example:
package main
import (
"context"
"fmt"
"os"
coherego "github.com/henomis/cohere-go"
"github.com/henomis/cohere-go/request"
"github.com/henomis/cohere-go/response"
)
func main() {
client := coherego.New(os.Getenv("COHERE_API_KEY"))
resp := &response.Generate{}
err := client.Generate(
context.Background(),
&request.Generate{
Prompt: "Please explain to me how LLMs work",
},
resp,
)
if err != nil {
panic(err)
}
fmt.Printf("resp: %#v\n", resp)
}
- LinGoose Go framework for building awesome LLM apps