diff --git a/README.md b/README.md index caa4462..8380747 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ import ( func main() { co := cohere.CreateClient("YOUR_API_KEY") - res, err := co.Generate("baseline-seal", cohere.GenerateOptions{ + res, err := co.Generate("large", cohere.GenerateOptions{ Prompt: "co:here", MaxTokens: 10, Temperature: 0.75, @@ -45,6 +45,22 @@ func main() { A more complete example of `Generate` can be found [here](https://github.com/cohere-ai/cohere-go/blob/main/example/main.go) and example usage of other endpoints can be found [here](https://github.com/cohere-ai/cohere-go/blob/main/client_test.go). +## Versioning +To use the SDK with a specific API version, you can modify the client with the desired version as such: + +```go +package main + +import ( + "github.com/cohere-ai/cohere-go" +) + +func main() { + co := cohere.CreateClient("YOUR_API_KEY") + co.Version = "2021-11-08" +} +``` + ## Endpoints For a full breakdown of endpoints and arguments, please consult the [Cohere Docs](https://docs.cohere.ai/). @@ -57,7 +73,7 @@ Cohere Endpoint | Function /likelihood | co.Likelihood() ## Models -To view an up-to-date list of available models please consult the [Cohere CLI](https://docs.cohere.ai/command/). To get started try out `baseline-shrimp` or `baseline-seal`. +To view an up-to-date list of available models please consult the [Cohere CLI](https://docs.cohere.ai/command/). To get started try out `large`. ## Responses All of the endpoint functions will return a Cohere object corresponding to the endpoint (e.g. for generation, it would be `GenerateResponse`). The responses can be found as fields on the struct (e.g. generations would be `GenerateResponse.Generations`). The names of these fields and a detailed breakdown of the response body can be found in the [Cohere Docs](https://docs.cohere.ai/). diff --git a/client_test.go b/client_test.go index 71e2022..0e3346f 100644 --- a/client_test.go +++ b/client_test.go @@ -18,7 +18,7 @@ func init() { func TestErrors(t *testing.T) { t.Run("Invalid api key", func(t *testing.T) { co := CreateClient("") - _, err := co.Generate("baseline-shrimp", GenerateOptions{ + _, err := co.Generate("small", GenerateOptions{ Prompt: "", MaxTokens: 10, Temperature: 0.75, @@ -35,7 +35,7 @@ func TestGenerate(t *testing.T) { co := CreateClient(apiKey) t.Run("Generate basic", func(t *testing.T) { - _, err := co.Generate("baseline-shark", GenerateOptions{ + _, err := co.Generate("medium", GenerateOptions{ Prompt: "Hello my name is", MaxTokens: 10, Temperature: 0.75, @@ -47,7 +47,7 @@ func TestGenerate(t *testing.T) { t.Run("Generate multi", func(t *testing.T) { num := 4 - res, err := co.Generate("baseline-shark", GenerateOptions{ + res, err := co.Generate("medium", GenerateOptions{ Prompt: "What is your", MaxTokens: 10, Temperature: 0.75, @@ -65,7 +65,7 @@ func TestSimilarity(t *testing.T) { co := CreateClient(apiKey) t.Run("Similarity", func(t *testing.T) { - _, err := co.Similarity("baseline-shrimp", SimilarityOptions{ + _, err := co.Similarity("small", SimilarityOptions{ Anchor: "hi how are you doing today?", Targets: []string{"greeting", "request for assistance", "asking a question"}, }) @@ -79,7 +79,7 @@ func TestChooseBest(t *testing.T) { co := CreateClient(apiKey) t.Run("ChooseBest", func(t *testing.T) { - _, err := co.ChooseBest("baseline-otter", ChooseBestOptions{ + _, err := co.ChooseBest("small", ChooseBestOptions{ Query: "Carol picked up a book and walked to the kitchen. She set it down, picked up her glasses and left. This is in the kitchen now: ", Options: []string{"book", "glasses", "dog"}, Mode: AppendOption, @@ -97,7 +97,7 @@ func TestEmbed(t *testing.T) { t.Run("Embed", func(t *testing.T) { texts := []string{"hello", "goodbye"} - _, err := co.Embed("baseline-shrimp", texts) + _, err := co.Embed("small", texts) if err != nil { t.Errorf("expected result, got error: %s", err.Error()) } @@ -110,7 +110,7 @@ func TestLikelihood(t *testing.T) { t.Run("Likelihood", func(t *testing.T) { text := "so I crept up the basement stairs and BOOOO!" - _, err := co.Likelihood("baseline-orca", text) + _, err := co.Likelihood("large", text) if err != nil { t.Errorf("expected result, got error: %s", err.Error()) } diff --git a/example/main.go b/example/main.go index 9d1a5c6..8e37c69 100644 --- a/example/main.go +++ b/example/main.go @@ -17,7 +17,7 @@ func main() { co := cohere.CreateClient(apiKey) prompt := "What is your" - res, err := co.Generate("baseline-seal", cohere.GenerateOptions{ + res, err := co.Generate("medium", cohere.GenerateOptions{ Prompt: prompt, MaxTokens: 20, Temperature: 1,