Skip to content

wesleyfantinel/cohere-go

 
 

Repository files navigation

Unofficial Cohere Go SDK

GoDoc Go Report Card GitHub release

This is Cohere's unofficial Go client, designed to enable you to use Cohere's services easily from your own applications.

Cohere

Cohere empowers every developer and enterprise to build amazing products and capture true business value with language AI.

API support

Index Operations Status
Generate 🟢
Chat 🟢
Embed 🟢
Classify 🟢
Tokenize 🟢
Detokenize 🟢
Detect Language 🟢
Summarize 🟢
Rerank 🟢

Getting started

Installation

You can load cohere-go into your project by using:

go get github.com/henomis/cohere-go

Configuration

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.

Usage

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)

}

Who uses cohere-go?

  • LinGoose Go framework for building awesome LLM apps

About

Unofficial Cohere client for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%