Skip to content

Commit

Permalink
Merge pull request #4 from cohere-ai/update-models
Browse files Browse the repository at this point in the history
Change Model names and update README
  • Loading branch information
jimwu6 authored Nov 15, 2021
2 parents 24ad715 + d2867fe commit a8f10df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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/).

Expand All @@ -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/).
Expand Down
14 changes: 7 additions & 7 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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"},
})
Expand All @@ -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,
Expand All @@ -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())
}
Expand All @@ -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())
}
Expand Down
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a8f10df

Please sign in to comment.