Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0"
".": "0.2.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-19772e79be7e030ebf8bd823aae76ff7e366c8f873aab056487dcc912ea5a6b4.yml
openapi_spec_hash: 92ead540a4d8d32f4411acf9de7fba21
config_hash: 67f1164874b1569a9845b46e7bfcc132
configured_endpoints: 35
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-64603433489e5f42ee45aea8504aa0e552ea7e0d438c78265dd7f6a0edf1e37e.yml
openapi_spec_hash: 4754c62b5c348a3972851324a2b50a95
config_hash: fd48534cdc69108d2dab97d5414984c2
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.2.0 (2026-05-15)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/usesapient/go-sdk/compare/v0.1.0...v0.2.0)

### Features

* Update Sapient public OpenAPI spec ([f535609](https://github.com/usesapient/go-sdk/commit/f53560907f2f40e035c8167c174c2f832f54118c))

## 0.1.0 (2026-05-15)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/usesapient/go-sdk/compare/v0.0.1...v0.1.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/usesapient/go-sdk@v0.1.0'
go get -u 'github.com/usesapient/go-sdk@v0.2.0'
```

<!-- x-release-please-end -->
Expand Down
6 changes: 4 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Response Types:
- <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptUpdateResponse">PromptUpdateResponse</a>
- <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptListResponse">PromptListResponse</a>
- <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptDeleteResponse">PromptDeleteResponse</a>
- <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptEstimateCostResponse">PromptEstimateCostResponse</a>

Methods:

Expand All @@ -35,6 +36,7 @@ Methods:
- <code title="patch /v1/prompts/{prompt_id}">client.Prompts.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptService.Update">Update</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, promptID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptUpdateParams">PromptUpdateParams</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptUpdateResponse">PromptUpdateResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v1/prompts">client.Prompts.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptListParams">PromptListParams</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptListResponse">PromptListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="delete /v1/prompts/{prompt_id}">client.Prompts.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, promptID <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptDeleteResponse">PromptDeleteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v1/prompts/estimate-cost">client.Prompts.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptService.EstimateCost">EstimateCost</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptEstimateCostResponse">PromptEstimateCostResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Topics

Expand All @@ -60,7 +62,7 @@ Response Types:

Methods:

- <code title="get /v1/prompts/platforms">client.Prompts.Platforms.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptPlatformService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptPlatformListResponse">PromptPlatformListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v1/prompts/platforms">client.Prompts.Platforms.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptPlatformService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (\*[]<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#PromptPlatformListResponse">PromptPlatformListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

# APIPerformance

Expand All @@ -74,7 +76,7 @@ Response Types:
Methods:

- <code title="get /v1/api-performance/platforms">client.APIPerformance.Platforms.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformListResponse">APIPerformancePlatformListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /v1/api-performance/platforms/estimate-cost">client.APIPerformance.Platforms.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformService.EstimateCost">EstimateCost</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, body <a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformEstimateCostParams">APIPerformancePlatformEstimateCostParams</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformEstimateCostResponse">APIPerformancePlatformEstimateCostResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /v1/api-performance/platforms/estimate-cost">client.APIPerformance.Platforms.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformService.EstimateCost">EstimateCost</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (\*<a href="https://pkg.go.dev/github.com/usesapient/go-sdk">githubcomusesapientgosdk</a>.<a href="https://pkg.go.dev/github.com/usesapient/go-sdk#APIPerformancePlatformEstimateCostResponse">APIPerformancePlatformEstimateCostResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

## Interfaces

Expand Down
16 changes: 15 additions & 1 deletion apiperformanceoperation.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,21 @@ func (r *APIPerformanceOperationListResponseCategory) UnmarshalJSON(data []byte)
return apijson.UnmarshalRoot(data, r)
}

type APIPerformanceOperationDeleteResponse = any
type APIPerformanceOperationDeleteResponse struct {
Ok bool `json:"ok" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Ok respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

// Returns the unmodified JSON received from the API
func (r APIPerformanceOperationDeleteResponse) RawJSON() string { return r.JSON.raw }
func (r *APIPerformanceOperationDeleteResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type APIPerformanceOperationNewParams struct {
Method string `json:"method" api:"required"`
Expand Down
99 changes: 47 additions & 52 deletions apiperformanceplatform.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/usesapient/go-sdk/internal/apijson"
"github.com/usesapient/go-sdk/internal/requestconfig"
"github.com/usesapient/go-sdk/option"
"github.com/usesapient/go-sdk/packages/param"
"github.com/usesapient/go-sdk/packages/respjson"
)

Expand Down Expand Up @@ -42,10 +41,10 @@ func (r *APIPerformancePlatformService) List(ctx context.Context, opts ...option
}

// Estimate Platform Cost
func (r *APIPerformancePlatformService) EstimateCost(ctx context.Context, body APIPerformancePlatformEstimateCostParams, opts ...option.RequestOption) (res *APIPerformancePlatformEstimateCostResponse, err error) {
func (r *APIPerformancePlatformService) EstimateCost(ctx context.Context, opts ...option.RequestOption) (res *APIPerformancePlatformEstimateCostResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/api-performance/platforms/estimate-cost"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}

Expand All @@ -68,24 +67,20 @@ func (r *APIPerformancePlatformListResponse) UnmarshalJSON(data []byte) error {
}

type APIPerformancePlatformListResponseAgentPlatform struct {
ID string `json:"id" api:"required"`
Label string `json:"label" api:"required"`
Provider string `json:"provider" api:"required"`
Type string `json:"type" api:"required"`
CostEstimatePerEval float64 `json:"cost_estimate_per_eval" api:"nullable"`
CostPer1mInput float64 `json:"cost_per_1m_input" api:"nullable"`
CostPer1mOutput float64 `json:"cost_per_1m_output" api:"nullable"`
ID string `json:"id" api:"required"`
CreditsPerEval int64 `json:"credits_per_eval" api:"required"`
Label string `json:"label" api:"required"`
Provider string `json:"provider" api:"required"`
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Label respjson.Field
Provider respjson.Field
Type respjson.Field
CostEstimatePerEval respjson.Field
CostPer1mInput respjson.Field
CostPer1mOutput respjson.Field
ExtraFields map[string]respjson.Field
raw string
ID respjson.Field
CreditsPerEval respjson.Field
Label respjson.Field
Provider respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

Expand All @@ -96,24 +91,20 @@ func (r *APIPerformancePlatformListResponseAgentPlatform) UnmarshalJSON(data []b
}

type APIPerformancePlatformListResponseTextPlatform struct {
ID string `json:"id" api:"required"`
Label string `json:"label" api:"required"`
Provider string `json:"provider" api:"required"`
Type string `json:"type" api:"required"`
CostEstimatePerEval float64 `json:"cost_estimate_per_eval" api:"nullable"`
CostPer1mInput float64 `json:"cost_per_1m_input" api:"nullable"`
CostPer1mOutput float64 `json:"cost_per_1m_output" api:"nullable"`
ID string `json:"id" api:"required"`
CreditsPerEval int64 `json:"credits_per_eval" api:"required"`
Label string `json:"label" api:"required"`
Provider string `json:"provider" api:"required"`
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Label respjson.Field
Provider respjson.Field
Type respjson.Field
CostEstimatePerEval respjson.Field
CostPer1mInput respjson.Field
CostPer1mOutput respjson.Field
ExtraFields map[string]respjson.Field
raw string
ID respjson.Field
CreditsPerEval respjson.Field
Label respjson.Field
Provider respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

Expand All @@ -124,14 +115,14 @@ func (r *APIPerformancePlatformListResponseTextPlatform) UnmarshalJSON(data []by
}

type APIPerformancePlatformEstimateCostResponse struct {
Costs map[string]float64 `json:"costs" api:"required"`
EvalCount int64 `json:"eval_count" api:"required"`
Estimates map[string]APIPerformancePlatformEstimateCostResponseEstimate `json:"estimates" api:"required"`
TotalCredits int64 `json:"total_credits" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Costs respjson.Field
EvalCount respjson.Field
ExtraFields map[string]respjson.Field
raw string
Estimates respjson.Field
TotalCredits respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

Expand All @@ -141,18 +132,22 @@ func (r *APIPerformancePlatformEstimateCostResponse) UnmarshalJSON(data []byte)
return apijson.UnmarshalRoot(data, r)
}

type APIPerformancePlatformEstimateCostParams struct {
EvalCount int64 `json:"eval_count" api:"required"`
PlatformIDs []string `json:"platform_ids,omitzero" api:"required"`
InputTokens param.Opt[int64] `json:"input_tokens,omitzero"`
OutputTokens param.Opt[int64] `json:"output_tokens,omitzero"`
paramObj
type APIPerformancePlatformEstimateCostResponseEstimate struct {
CreditsPerEval int64 `json:"credits_per_eval" api:"required"`
EvalCount int64 `json:"eval_count" api:"required"`
TotalCredits int64 `json:"total_credits" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreditsPerEval respjson.Field
EvalCount respjson.Field
TotalCredits respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

func (r APIPerformancePlatformEstimateCostParams) MarshalJSON() (data []byte, err error) {
type shadow APIPerformancePlatformEstimateCostParams
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *APIPerformancePlatformEstimateCostParams) UnmarshalJSON(data []byte) error {
// Returns the unmodified JSON received from the API
func (r APIPerformancePlatformEstimateCostResponseEstimate) RawJSON() string { return r.JSON.raw }
func (r *APIPerformancePlatformEstimateCostResponseEstimate) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
9 changes: 2 additions & 7 deletions apiperformanceplatform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestAPIPerformancePlatformList(t *testing.T) {
}
}

func TestAPIPerformancePlatformEstimateCostWithOptionalParams(t *testing.T) {
func TestAPIPerformancePlatformEstimateCost(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
Expand All @@ -49,12 +49,7 @@ func TestAPIPerformancePlatformEstimateCostWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.APIPerformance.Platforms.EstimateCost(context.TODO(), githubcomusesapientgosdk.APIPerformancePlatformEstimateCostParams{
EvalCount: 1,
PlatformIDs: []string{"string"},
InputTokens: githubcomusesapientgosdk.Int(0),
OutputTokens: githubcomusesapientgosdk.Int(0),
})
_, err := client.APIPerformance.Platforms.EstimateCost(context.TODO())
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
Expand Down
16 changes: 15 additions & 1 deletion apiperformanceprompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,21 @@ func (r *APIPerformancePromptUpdateResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type APIPerformancePromptDeleteResponse = any
type APIPerformancePromptDeleteResponse struct {
Ok bool `json:"ok" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Ok respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}

// Returns the unmodified JSON received from the API
func (r APIPerformancePromptDeleteResponse) RawJSON() string { return r.JSON.raw }
func (r *APIPerformancePromptDeleteResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type APIPerformancePromptUpdateParams struct {
Enabled param.Opt[bool] `json:"enabled,omitzero"`
Expand Down
Loading
Loading