Skip to content

Commit

Permalink
Release v2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jan 17, 2024
1 parent 4ab6c99 commit b9a1937
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 27 deletions.
22 changes: 11 additions & 11 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (c *Client) ChatStream(ctx context.Context, request *v2.ChatStreamRequest)
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/chat"
endpointURL := baseURL + "/" + "chat"

streamer := core.NewStreamer[v2.StreamedChatResponse](c.caller)
return streamer.Stream(
Expand All @@ -71,7 +71,7 @@ func (c *Client) Chat(ctx context.Context, request *v2.ChatRequest) (*v2.NonStre
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/chat"
endpointURL := baseURL + "/" + "chat"

var response *v2.NonStreamedChatResponse
if err := c.caller.Call(
Expand All @@ -95,7 +95,7 @@ func (c *Client) GenerateStream(ctx context.Context, request *v2.GenerateStreamR
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/generate"
endpointURL := baseURL + "/" + "generate"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -142,7 +142,7 @@ func (c *Client) Generate(ctx context.Context, request *v2.GenerateRequest) (*v2
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/generate"
endpointURL := baseURL + "/" + "generate"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -197,7 +197,7 @@ func (c *Client) Embed(ctx context.Context, request *v2.EmbedRequest) (*v2.Embed
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/embed"
endpointURL := baseURL + "/" + "embed"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -248,7 +248,7 @@ func (c *Client) Rerank(ctx context.Context, request *v2.RerankRequest) (*v2.Rer
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/rerank"
endpointURL := baseURL + "/" + "rerank"

var response *v2.RerankResponse
if err := c.caller.Call(
Expand All @@ -273,7 +273,7 @@ func (c *Client) Classify(ctx context.Context, request *v2.ClassifyRequest) (*v2
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/classify"
endpointURL := baseURL + "/" + "classify"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -324,7 +324,7 @@ func (c *Client) DetectLanguage(ctx context.Context, request *v2.DetectLanguageR
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/detect-language"
endpointURL := baseURL + "/" + "detect-language"

var response *v2.DetectLanguageResponse
if err := c.caller.Call(
Expand All @@ -348,7 +348,7 @@ func (c *Client) Summarize(ctx context.Context, request *v2.SummarizeRequest) (*
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/summarize"
endpointURL := baseURL + "/" + "summarize"

var response *v2.SummarizeResponse
if err := c.caller.Call(
Expand All @@ -372,7 +372,7 @@ func (c *Client) Tokenize(ctx context.Context, request *v2.TokenizeRequest) (*v2
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/tokenize"
endpointURL := baseURL + "/" + "tokenize"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -423,7 +423,7 @@ func (c *Client) Detokenize(ctx context.Context, request *v2.DetokenizeRequest)
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/detokenize"
endpointURL := baseURL + "/" + "detokenize"

var response *v2.DetokenizeResponse
if err := c.caller.Call(
Expand Down
12 changes: 6 additions & 6 deletions connectors/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (c *Client) List(ctx context.Context, request *v2.ConnectorsListRequest) (*
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/connectors"
endpointURL := baseURL + "/" + "connectors"

queryParams := make(url.Values)
if request.Limit != nil {
Expand Down Expand Up @@ -100,7 +100,7 @@ func (c *Client) Create(ctx context.Context, request *v2.CreateConnectorRequest)
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/connectors"
endpointURL := baseURL + "/" + "connectors"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -160,7 +160,7 @@ func (c *Client) Get(ctx context.Context, id string) (*v2.GetConnectorResponse,
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/connectors/%v", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"connectors/%v", id)

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -219,7 +219,7 @@ func (c *Client) Delete(ctx context.Context, id string) (v2.DeleteConnectorRespo
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/connectors/%v", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"connectors/%v", id)

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -285,7 +285,7 @@ func (c *Client) Update(ctx context.Context, id string, request *v2.UpdateConnec
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/connectors/%v", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"connectors/%v", id)

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -352,7 +352,7 @@ func (c *Client) OAuthAuthorize(ctx context.Context, id string, request *v2.Conn
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/connectors/%v/oauth/authorize", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"connectors/%v/oauth/authorize", id)

queryParams := make(url.Values)
if request.AfterTokenRedirect != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ func (c *ClientOptions) cloneHeader() http.Header {
headers := c.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.5.0")
headers.Set("X-Fern-SDK-Version", "v2.5.1")
return headers
}
10 changes: 5 additions & 5 deletions datasets/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (c *Client) List(ctx context.Context, request *v2.DatasetsListRequest) (*v2
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/datasets"
endpointURL := baseURL + "/" + "datasets"

queryParams := make(url.Values)
if request.DatasetType != nil {
Expand Down Expand Up @@ -82,7 +82,7 @@ func (c *Client) Create(ctx context.Context, data io.Reader, evalData io.Reader,
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/datasets"
endpointURL := baseURL + "/" + "datasets"

queryParams := make(url.Values)
if request.Name != nil {
Expand Down Expand Up @@ -164,7 +164,7 @@ func (c *Client) GetUsage(ctx context.Context) (*v2.DatasetsGetUsageResponse, er
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/datasets/usage"
endpointURL := baseURL + "/" + "datasets/usage"

var response *v2.DatasetsGetUsageResponse
if err := c.caller.Call(
Expand All @@ -187,7 +187,7 @@ func (c *Client) Get(ctx context.Context, id string) (*v2.DatasetsGetResponse, e
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/datasets/%v", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"datasets/%v", id)

var response *v2.DatasetsGetResponse
if err := c.caller.Call(
Expand All @@ -210,7 +210,7 @@ func (c *Client) Delete(ctx context.Context, id string) (map[string]interface{},
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/datasets/%v", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"datasets/%v", id)

var response map[string]interface{}
if err := c.caller.Call(
Expand Down
8 changes: 4 additions & 4 deletions embedjobs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (c *Client) List(ctx context.Context) (*v2.ListEmbedJobResponse, error) {
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/embed-jobs"
endpointURL := baseURL + "/" + "embed-jobs"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -88,7 +88,7 @@ func (c *Client) Create(ctx context.Context, request *v2.CreateEmbedJobRequest)
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "v1/embed-jobs"
endpointURL := baseURL + "/" + "embed-jobs"

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -141,7 +141,7 @@ func (c *Client) Get(ctx context.Context, id string) (*v2.EmbedJob, error) {
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/embed-jobs/%v", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"embed-jobs/%v", id)

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down Expand Up @@ -200,7 +200,7 @@ func (c *Client) Cancel(ctx context.Context, id string) error {
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"v1/embed-jobs/%v/cancel", id)
endpointURL := fmt.Sprintf(baseURL+"/"+"embed-jobs/%v/cancel", id)

errorDecoder := func(statusCode int, body io.Reader) error {
raw, err := io.ReadAll(body)
Expand Down
112 changes: 112 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,34 @@ type ChatRequest struct {
//
// A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.
Temperature *float64 `json:"temperature,omitempty"`
stream bool
}

func (c *ChatRequest) Stream() bool {
return c.stream
}

func (c *ChatRequest) UnmarshalJSON(data []byte) error {
type unmarshaler ChatRequest
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*c = ChatRequest(body)
c.stream = false
return nil
}

func (c *ChatRequest) MarshalJSON() ([]byte, error) {
type embed ChatRequest
var marshaler = struct {
embed
Stream bool `json:"stream"`
}{
embed: embed(*c),
Stream: false,
}
return json.Marshal(marshaler)
}

type ChatStreamRequest struct {
Expand Down Expand Up @@ -99,6 +127,34 @@ type ChatStreamRequest struct {
//
// A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations, and higher temperatures mean more random generations.
Temperature *float64 `json:"temperature,omitempty"`
stream bool
}

func (c *ChatStreamRequest) Stream() bool {
return c.stream
}

func (c *ChatStreamRequest) UnmarshalJSON(data []byte) error {
type unmarshaler ChatStreamRequest
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*c = ChatStreamRequest(body)
c.stream = true
return nil
}

func (c *ChatStreamRequest) MarshalJSON() ([]byte, error) {
type embed ChatStreamRequest
var marshaler = struct {
embed
Stream bool `json:"stream"`
}{
embed: embed(*c),
Stream: true,
}
return json.Marshal(marshaler)
}

type ClassifyRequest struct {
Expand Down Expand Up @@ -221,6 +277,34 @@ type GenerateRequest struct {
//
// Note: logit bias may not be supported for all custom models.
LogitBias map[string]float64 `json:"logit_bias,omitempty"`
stream bool
}

func (g *GenerateRequest) Stream() bool {
return g.stream
}

func (g *GenerateRequest) UnmarshalJSON(data []byte) error {
type unmarshaler GenerateRequest
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*g = GenerateRequest(body)
g.stream = false
return nil
}

func (g *GenerateRequest) MarshalJSON() ([]byte, error) {
type embed GenerateRequest
var marshaler = struct {
embed
Stream bool `json:"stream"`
}{
embed: embed(*g),
Stream: false,
}
return json.Marshal(marshaler)
}

type GenerateStreamRequest struct {
Expand Down Expand Up @@ -276,6 +360,34 @@ type GenerateStreamRequest struct {
//
// Note: logit bias may not be supported for all custom models.
LogitBias map[string]float64 `json:"logit_bias,omitempty"`
stream bool
}

func (g *GenerateStreamRequest) Stream() bool {
return g.stream
}

func (g *GenerateStreamRequest) UnmarshalJSON(data []byte) error {
type unmarshaler GenerateStreamRequest
var body unmarshaler
if err := json.Unmarshal(data, &body); err != nil {
return err
}
*g = GenerateStreamRequest(body)
g.stream = true
return nil
}

func (g *GenerateStreamRequest) MarshalJSON() ([]byte, error) {
type embed GenerateStreamRequest
var marshaler = struct {
embed
Stream bool `json:"stream"`
}{
embed: embed(*g),
Stream: true,
}
return json.Marshal(marshaler)
}

type RerankRequest struct {
Expand Down

0 comments on commit b9a1937

Please sign in to comment.