From 54f5df441874ef4d69e63865904242b20a851656 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 15:28:54 +0000 Subject: [PATCH] SDK regeneration --- client/client.go | 22 +++++++++++----------- connectors/client.go | 12 ++++++------ core/request_option.go | 2 +- datasets/client.go | 10 +++++----- embedjobs/client.go | 8 ++++---- environments.go | 2 +- finetuning/client/client.go | 14 +++++++------- models/client.go | 4 ++-- types.go | 14 +++++++++----- 9 files changed, 46 insertions(+), 42 deletions(-) diff --git a/client/client.go b/client/client.go index 904986e..a6c9a4c 100644 --- a/client/client.go +++ b/client/client.go @@ -63,7 +63,7 @@ func (c *Client) ChatStream( ) (*core.Stream[v2.StreamedChatResponse], error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -117,7 +117,7 @@ func (c *Client) Chat( ) (*v2.NonStreamedChatResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -178,7 +178,7 @@ func (c *Client) GenerateStream( ) (*core.Stream[v2.GenerateStreamedResponse], error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -249,7 +249,7 @@ func (c *Client) Generate( ) (*v2.Generation, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -324,7 +324,7 @@ func (c *Client) Embed( ) (*v2.EmbedResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -395,7 +395,7 @@ func (c *Client) Rerank( ) (*v2.RerankResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -453,7 +453,7 @@ func (c *Client) Classify( ) (*v2.ClassifyResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -528,7 +528,7 @@ func (c *Client) Summarize( ) (*v2.SummarizeResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -585,7 +585,7 @@ func (c *Client) Tokenize( ) (*v2.TokenizeResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -656,7 +656,7 @@ func (c *Client) Detokenize( ) (*v2.DetokenizeResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -712,7 +712,7 @@ func (c *Client) CheckApiKey( ) (*v2.CheckApiKeyResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } diff --git a/connectors/client.go b/connectors/client.go index 76044a7..82ea6c8 100644 --- a/connectors/client.go +++ b/connectors/client.go @@ -47,7 +47,7 @@ func (c *Client) List( ) (*v2.ListConnectorsResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -125,7 +125,7 @@ func (c *Client) Create( ) (*v2.CreateConnectorResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -204,7 +204,7 @@ func (c *Client) Get( ) (*v2.GetConnectorResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -282,7 +282,7 @@ func (c *Client) Delete( ) (v2.DeleteConnectorResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -368,7 +368,7 @@ func (c *Client) Update( ) (*v2.UpdateConnectorResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -455,7 +455,7 @@ func (c *Client) OAuthAuthorize( ) (*v2.OAuthAuthorizeResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } diff --git a/core/request_option.go b/core/request_option.go index 2f72c41..ac019e0 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -56,7 +56,7 @@ func (r *RequestOptions) cloneHeader() http.Header { headers := r.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") headers.Set("X-Fern-SDK-Name", "github.com/cohere-ai/cohere-go/v2") - headers.Set("X-Fern-SDK-Version", "v2.8.0") + headers.Set("X-Fern-SDK-Version", "v2.8.1") return headers } diff --git a/datasets/client.go b/datasets/client.go index e432801..0673db4 100644 --- a/datasets/client.go +++ b/datasets/client.go @@ -48,7 +48,7 @@ func (c *Client) List( ) (*v2.DatasetsListResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -114,7 +114,7 @@ func (c *Client) Create( ) (*v2.DatasetsCreateResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -209,7 +209,7 @@ func (c *Client) GetUsage( ) (*v2.DatasetsGetUsageResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -265,7 +265,7 @@ func (c *Client) Get( ) (*v2.DatasetsGetResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -321,7 +321,7 @@ func (c *Client) Delete( ) (map[string]interface{}, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } diff --git a/embedjobs/client.go b/embedjobs/client.go index 118982f..43f581a 100644 --- a/embedjobs/client.go +++ b/embedjobs/client.go @@ -46,7 +46,7 @@ func (c *Client) List( ) (*v2.ListEmbedJobResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -116,7 +116,7 @@ func (c *Client) Create( ) (*v2.CreateEmbedJobResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -188,7 +188,7 @@ func (c *Client) Get( ) (*v2.EmbedJob, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -266,7 +266,7 @@ func (c *Client) Cancel( ) error { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } diff --git a/environments.go b/environments.go index 56a405b..1acfc88 100644 --- a/environments.go +++ b/environments.go @@ -9,5 +9,5 @@ package api var Environments = struct { Production string }{ - Production: "https://api.cohere.ai/v1", + Production: "https://api.cohere.com/v1", } diff --git a/finetuning/client/client.go b/finetuning/client/client.go index 6abc118..619d8a3 100644 --- a/finetuning/client/client.go +++ b/finetuning/client/client.go @@ -47,7 +47,7 @@ func (c *Client) ListFinetunedModels( ) (*finetuning.ListFinetunedModelsResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -145,7 +145,7 @@ func (c *Client) CreateFinetunedModel( ) (*finetuning.CreateFinetunedModelResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -237,7 +237,7 @@ func (c *Client) GetFinetunedModel( ) (*finetuning.GetFinetunedModelResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -328,7 +328,7 @@ func (c *Client) DeleteFinetunedModel( ) (finetuning.DeleteFinetunedModelResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -420,7 +420,7 @@ func (c *Client) UpdateFinetunedModel( ) (*finetuning.UpdateFinetunedModelResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -513,7 +513,7 @@ func (c *Client) ListEvents( ) (*finetuning.ListEventsResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -613,7 +613,7 @@ func (c *Client) ListTrainingStepMetrics( ) (*finetuning.ListTrainingStepMetricsResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } diff --git a/models/client.go b/models/client.go index c263441..e55be54 100644 --- a/models/client.go +++ b/models/client.go @@ -47,7 +47,7 @@ func (c *Client) Get( ) (*v2.GetModelResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } @@ -117,7 +117,7 @@ func (c *Client) List( ) (*v2.ListModelsResponse, error) { options := core.NewRequestOptions(opts...) - baseURL := "https://api.cohere.ai/v1" + baseURL := "https://api.cohere.com/v1" if c.baseURL != "" { baseURL = c.baseURL } diff --git a/types.go b/types.go index ba847fa..8c8450b 100644 --- a/types.go +++ b/types.go @@ -167,7 +167,9 @@ type ChatRequest struct { // **Note**: Chat calls with `tool_results` should not be included in the Chat history to avoid duplication of the message text. // Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments ToolResults []*ToolResult `json:"tool_results,omitempty" url:"tool_results,omitempty"` - stream bool + // Forces the chat to be single step. Defaults to `false`. + ForceSingleStep *bool `json:"force_single_step,omitempty" url:"force_single_step,omitempty"` + stream bool } func (c *ChatRequest) Stream() bool { @@ -355,7 +357,9 @@ type ChatStreamRequest struct { // **Note**: Chat calls with `tool_results` should not be included in the Chat history to avoid duplication of the message text. // Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments ToolResults []*ToolResult `json:"tool_results,omitempty" url:"tool_results,omitempty"` - stream bool + // Forces the chat to be single step. Defaults to `false`. + ForceSingleStep *bool `json:"force_single_step,omitempty" url:"force_single_step,omitempty"` + stream bool } func (c *ChatStreamRequest) Stream() bool { @@ -395,7 +399,7 @@ type ClassifyRequest struct { Examples []*ClassifyExample `json:"examples,omitempty" url:"examples,omitempty"` // The identifier of the model. Currently available models are `embed-multilingual-v2.0`, `embed-english-light-v2.0`, and `embed-english-v2.0` (default). Smaller "light" models are faster, while larger models will perform better. [Fine-tuned models](https://docs.cohere.com/docs/fine-tuning) can also be supplied with their full ID. Model *string `json:"model,omitempty" url:"model,omitempty"` - // The ID of a custom playground preset. You can create presets in the [playground](https://dashboard.cohere.ai/playground/classify?model=large). If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters. + // The ID of a custom playground preset. You can create presets in the [playground](https://dashboard.cohere.com/playground/classify?model=large). If you use a preset, all other parameters become optional, and any included parameters will override the preset's parameters. Preset *string `json:"preset,omitempty" url:"preset,omitempty"` // One of `NONE|START|END` to specify how the API will handle inputs longer than the maximum token length. // Passing `START` will discard the start of the input. `END` will discard the end of the input. In both cases, input is discarded until the remaining input is exactly the maximum input token length for the model. @@ -479,7 +483,7 @@ type GenerateRequest struct { Temperature *float64 `json:"temperature,omitempty" url:"temperature,omitempty"` // If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinsim cannot be totally guaranteed. Seed *float64 `json:"seed,omitempty" url:"seed,omitempty"` - // Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.ai/playground/generate). + // Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate). // When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. Preset *string `json:"preset,omitempty" url:"preset,omitempty"` // The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text. @@ -574,7 +578,7 @@ type GenerateStreamRequest struct { Temperature *float64 `json:"temperature,omitempty" url:"temperature,omitempty"` // If specified, the backend will make a best effort to sample tokens deterministically, such that repeated requests with the same seed and parameters should return the same result. However, determinsim cannot be totally guaranteed. Seed *float64 `json:"seed,omitempty" url:"seed,omitempty"` - // Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.ai/playground/generate). + // Identifier of a custom preset. A preset is a combination of parameters, such as prompt, temperature etc. You can create presets in the [playground](https://dashboard.cohere.com/playground/generate). // When a preset is specified, the `prompt` parameter becomes optional, and any included parameters will override the preset's parameters. Preset *string `json:"preset,omitempty" url:"preset,omitempty"` // The generated text will be cut at the beginning of the earliest occurrence of an end sequence. The sequence will be excluded from the text.