From 641ecec20c73369e4fd91c780ebf746309193e37 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 19:31:39 +0000
Subject: [PATCH 1/6] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index fce9f8a..3ff5c0d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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
+config_hash: dd51c702b5106c7f018e18058acd17e5
From 8a174c63ca126d7769dda3cb3020395b14b804f3 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 19:42:04 +0000
Subject: [PATCH 2/6] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 3ff5c0d..8ecc683 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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: dd51c702b5106c7f018e18058acd17e5
+config_hash: 73e9eb8f368c28abc599e96da02bd156
From b7c4c998155c9059b566b499231108be74f1e847 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 21:24:21 +0000
Subject: [PATCH 3/6] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 8ecc683..99b96b2 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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: 73e9eb8f368c28abc599e96da02bd156
+config_hash: 98cfeec5711dea9776123d8a28832192
From 14cee8b73ed636f8c1993b6b652d7ec413d944dc Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 21:43:16 +0000
Subject: [PATCH 4/6] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 99b96b2..f12d289 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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: 98cfeec5711dea9776123d8a28832192
+config_hash: d6c024d09a6e0bbaa7a69b194a4988c8
From f53560907f2f40e035c8167c174c2f832f54118c Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 23:44:25 +0000
Subject: [PATCH 5/6] feat: Update Sapient public OpenAPI spec
---
.stats.yml | 8 +--
api.md | 6 ++-
apiperformanceoperation.go | 16 +++++-
apiperformanceplatform.go | 99 ++++++++++++++++------------------
apiperformanceplatform_test.go | 9 +---
apiperformanceprompt.go | 16 +++++-
apiperformancerun.go | 83 ++++++++++++++--------------
apiperformancerun_test.go | 1 -
apiperformanceusecase.go | 16 +++++-
prompt.go | 72 ++++++++++++++++++++++---
prompt_test.go | 27 ++++++++--
promptplatform.go | 26 ++++++++-
prompttopic.go | 16 +++++-
13 files changed, 272 insertions(+), 123 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index f12d289..7374277 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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: d6c024d09a6e0bbaa7a69b194a4988c8
+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
diff --git a/api.md b/api.md
index 1bbdd67..bf5ed37 100644
--- a/api.md
+++ b/api.md
@@ -27,6 +27,7 @@ Response Types:
- githubcomusesapientgosdk.PromptUpdateResponse
- githubcomusesapientgosdk.PromptListResponse
- githubcomusesapientgosdk.PromptDeleteResponse
+- githubcomusesapientgosdk.PromptEstimateCostResponse
Methods:
@@ -35,6 +36,7 @@ Methods:
- client.Prompts.Update(ctx context.Context, promptID string, body githubcomusesapientgosdk.PromptUpdateParams) (\*githubcomusesapientgosdk.PromptUpdateResponse, error)
- client.Prompts.List(ctx context.Context, query githubcomusesapientgosdk.PromptListParams) (\*githubcomusesapientgosdk.PromptListResponse, error)
- client.Prompts.Delete(ctx context.Context, promptID string) (\*githubcomusesapientgosdk.PromptDeleteResponse, error)
+- client.Prompts.EstimateCost(ctx context.Context) (\*githubcomusesapientgosdk.PromptEstimateCostResponse, error)
## Topics
@@ -60,7 +62,7 @@ Response Types:
Methods:
-- client.Prompts.Platforms.List(ctx context.Context) (\*githubcomusesapientgosdk.PromptPlatformListResponse, error)
+- client.Prompts.Platforms.List(ctx context.Context) (\*[]githubcomusesapientgosdk.PromptPlatformListResponse, error)
# APIPerformance
@@ -74,7 +76,7 @@ Response Types:
Methods:
- client.APIPerformance.Platforms.List(ctx context.Context) (\*githubcomusesapientgosdk.APIPerformancePlatformListResponse, error)
-- client.APIPerformance.Platforms.EstimateCost(ctx context.Context, body githubcomusesapientgosdk.APIPerformancePlatformEstimateCostParams) (\*githubcomusesapientgosdk.APIPerformancePlatformEstimateCostResponse, error)
+- client.APIPerformance.Platforms.EstimateCost(ctx context.Context) (\*githubcomusesapientgosdk.APIPerformancePlatformEstimateCostResponse, error)
## Interfaces
diff --git a/apiperformanceoperation.go b/apiperformanceoperation.go
index 46b0984..078cb7d 100644
--- a/apiperformanceoperation.go
+++ b/apiperformanceoperation.go
@@ -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"`
diff --git a/apiperformanceplatform.go b/apiperformanceplatform.go
index 5cb2159..5e855cb 100644
--- a/apiperformanceplatform.go
+++ b/apiperformanceplatform.go
@@ -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"
)
@@ -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
}
@@ -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:"-"`
}
@@ -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:"-"`
}
@@ -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:"-"`
}
@@ -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)
}
diff --git a/apiperformanceplatform_test.go b/apiperformanceplatform_test.go
index 909ce8b..a94538f 100644
--- a/apiperformanceplatform_test.go
+++ b/apiperformanceplatform_test.go
@@ -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 {
@@ -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) {
diff --git a/apiperformanceprompt.go b/apiperformanceprompt.go
index 9f554bc..3c97c26 100644
--- a/apiperformanceprompt.go
+++ b/apiperformanceprompt.go
@@ -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"`
diff --git a/apiperformancerun.go b/apiperformancerun.go
index 9619376..dbdec21 100644
--- a/apiperformancerun.go
+++ b/apiperformancerun.go
@@ -79,7 +79,6 @@ type APIPerformanceRunGetResponseData struct {
ID string `json:"id" api:"required"`
APICallLog map[string]any `json:"api_call_log" api:"nullable"`
ConversationTurns []map[string]any `json:"conversation_turns" api:"nullable"`
- CostUsd float64 `json:"cost_usd" api:"nullable"`
CreatedAt string `json:"created_at" api:"nullable"`
ErrorMessage string `json:"error_message" api:"nullable"`
EvalID string `json:"eval_id" api:"nullable"`
@@ -87,9 +86,11 @@ type APIPerformanceRunGetResponseData struct {
ExecutionStderr string `json:"execution_stderr" api:"nullable"`
ExecutionStdout string `json:"execution_stdout" api:"nullable"`
ExitCode int64 `json:"exit_code" api:"nullable"`
+ ExpectedBehavior string `json:"expected_behavior" api:"nullable"`
FailureReasons []string `json:"failure_reasons" api:"nullable"`
GeneratedFiles map[string]any `json:"generated_files" api:"nullable"`
GraderResults map[string]any `json:"grader_results" api:"nullable"`
+ Graders []map[string]any `json:"graders"`
LatencyMs int64 `json:"latency_ms" api:"nullable"`
Model string `json:"model" api:"nullable"`
ModelType string `json:"model_type" api:"nullable"`
@@ -97,6 +98,7 @@ type APIPerformanceRunGetResponseData struct {
Platform string `json:"platform" api:"nullable"`
Prompt string `json:"prompt" api:"nullable"`
RawResponse string `json:"raw_response" api:"nullable"`
+ ReferenceAnswer string `json:"reference_answer" api:"nullable"`
RunDate string `json:"run_date" api:"nullable"`
Score float64 `json:"score" api:"nullable"`
TokensUsed int64 `json:"tokens_used" api:"nullable"`
@@ -106,7 +108,6 @@ type APIPerformanceRunGetResponseData struct {
ID respjson.Field
APICallLog respjson.Field
ConversationTurns respjson.Field
- CostUsd respjson.Field
CreatedAt respjson.Field
ErrorMessage respjson.Field
EvalID respjson.Field
@@ -114,9 +115,11 @@ type APIPerformanceRunGetResponseData struct {
ExecutionStderr respjson.Field
ExecutionStdout respjson.Field
ExitCode respjson.Field
+ ExpectedBehavior respjson.Field
FailureReasons respjson.Field
GeneratedFiles respjson.Field
GraderResults respjson.Field
+ Graders respjson.Field
LatencyMs respjson.Field
Model respjson.Field
ModelType respjson.Field
@@ -124,6 +127,7 @@ type APIPerformanceRunGetResponseData struct {
Platform respjson.Field
Prompt respjson.Field
RawResponse respjson.Field
+ ReferenceAnswer respjson.Field
RunDate respjson.Field
Score respjson.Field
TokensUsed respjson.Field
@@ -212,44 +216,46 @@ func (r *APIPerformanceRunListResponse) UnmarshalJSON(data []byte) error {
}
type APIPerformanceRunListResponseData struct {
- ID string `json:"id" api:"required"`
- CostUsd float64 `json:"cost_usd" api:"nullable"`
- CreatedAt string `json:"created_at" api:"nullable"`
- ErrorMessage string `json:"error_message" api:"nullable"`
- EvalID string `json:"eval_id" api:"nullable"`
- EvalType string `json:"eval_type" api:"nullable"`
- FailureReasons []string `json:"failure_reasons" api:"nullable"`
- LatencyMs int64 `json:"latency_ms" api:"nullable"`
- Model string `json:"model" api:"nullable"`
- ModelType string `json:"model_type" api:"nullable"`
- Passed bool `json:"passed" api:"nullable"`
- Platform string `json:"platform" api:"nullable"`
- Prompt string `json:"prompt" api:"nullable"`
- RawResponse string `json:"raw_response" api:"nullable"`
- RunDate string `json:"run_date" api:"nullable"`
- Score float64 `json:"score" api:"nullable"`
- TokensUsed int64 `json:"tokens_used" api:"nullable"`
+ ID string `json:"id" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ ErrorMessage string `json:"error_message" api:"nullable"`
+ EvalID string `json:"eval_id" api:"nullable"`
+ EvalType string `json:"eval_type" api:"nullable"`
+ ExpectedBehavior string `json:"expected_behavior" api:"nullable"`
+ FailureReasons []string `json:"failure_reasons" api:"nullable"`
+ Graders []map[string]any `json:"graders"`
+ LatencyMs int64 `json:"latency_ms" api:"nullable"`
+ Model string `json:"model" api:"nullable"`
+ ModelType string `json:"model_type" api:"nullable"`
+ Passed bool `json:"passed" api:"nullable"`
+ Platform string `json:"platform" api:"nullable"`
+ Prompt string `json:"prompt" api:"nullable"`
+ ReferenceAnswer string `json:"reference_answer" api:"nullable"`
+ RunDate string `json:"run_date" api:"nullable"`
+ Score float64 `json:"score" api:"nullable"`
+ TokensUsed int64 `json:"tokens_used" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ID respjson.Field
- CostUsd respjson.Field
- CreatedAt respjson.Field
- ErrorMessage respjson.Field
- EvalID respjson.Field
- EvalType respjson.Field
- FailureReasons respjson.Field
- LatencyMs respjson.Field
- Model respjson.Field
- ModelType respjson.Field
- Passed respjson.Field
- Platform respjson.Field
- Prompt respjson.Field
- RawResponse respjson.Field
- RunDate respjson.Field
- Score respjson.Field
- TokensUsed respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ ID respjson.Field
+ CreatedAt respjson.Field
+ ErrorMessage respjson.Field
+ EvalID respjson.Field
+ EvalType respjson.Field
+ ExpectedBehavior respjson.Field
+ FailureReasons respjson.Field
+ Graders respjson.Field
+ LatencyMs respjson.Field
+ Model respjson.Field
+ ModelType respjson.Field
+ Passed respjson.Field
+ Platform respjson.Field
+ Prompt respjson.Field
+ ReferenceAnswer respjson.Field
+ RunDate respjson.Field
+ Score respjson.Field
+ TokensUsed respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -331,7 +337,6 @@ func (r *APIPerformanceRunListResponseOperationCategory) UnmarshalJSON(data []by
type APIPerformanceRunListParams struct {
OperationID string `query:"operation_id" api:"required" json:"-"`
- IncludeRaw param.Opt[bool] `query:"include_raw,omitzero" json:"-"`
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
paramObj
}
diff --git a/apiperformancerun_test.go b/apiperformancerun_test.go
index 16241fb..6b85ce2 100644
--- a/apiperformancerun_test.go
+++ b/apiperformancerun_test.go
@@ -51,7 +51,6 @@ func TestAPIPerformanceRunListWithOptionalParams(t *testing.T) {
)
_, err := client.APIPerformance.Runs.List(context.TODO(), githubcomusesapientgosdk.APIPerformanceRunListParams{
OperationID: "x",
- IncludeRaw: githubcomusesapientgosdk.Bool(true),
Limit: githubcomusesapientgosdk.Int(1),
})
if err != nil {
diff --git a/apiperformanceusecase.go b/apiperformanceusecase.go
index e8027d2..7237636 100644
--- a/apiperformanceusecase.go
+++ b/apiperformanceusecase.go
@@ -271,7 +271,21 @@ func (r *APIPerformanceUseCaseListResponseCategory) UnmarshalJSON(data []byte) e
return apijson.UnmarshalRoot(data, r)
}
-type APIPerformanceUseCaseDeleteResponse = any
+type APIPerformanceUseCaseDeleteResponse 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 APIPerformanceUseCaseDeleteResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseDeleteResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
type APIPerformanceUseCaseNewParams struct {
Prompt string `json:"prompt" api:"required"`
diff --git a/prompt.go b/prompt.go
index 1826789..b7d2b5f 100644
--- a/prompt.go
+++ b/prompt.go
@@ -93,6 +93,14 @@ func (r *PromptService) Delete(ctx context.Context, promptID string, opts ...opt
return res, err
}
+// Estimate Prompt Cost
+func (r *PromptService) EstimateCost(ctx context.Context, opts ...option.RequestOption) (res *PromptEstimateCostResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/prompts/estimate-cost"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
type PromptNewResponse struct {
ID string `json:"id" api:"required"`
Text string `json:"text" api:"required"`
@@ -539,14 +547,64 @@ func (r *PromptListResponseDataTopic) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PromptDeleteResponse = any
+type PromptDeleteResponse 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 PromptDeleteResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptDeleteResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptEstimateCostResponse struct {
+ Estimates map[string]PromptEstimateCostResponseEstimate `json:"estimates" api:"required"`
+ TotalCredits int64 `json:"total_credits" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Estimates respjson.Field
+ TotalCredits respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptEstimateCostResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptEstimateCostResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptEstimateCostResponseEstimate struct {
+ CreditsPerPrompt int64 `json:"credits_per_prompt" api:"required"`
+ PromptCount int64 `json:"prompt_count" api:"required"`
+ TotalCredits int64 `json:"total_credits" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CreditsPerPrompt respjson.Field
+ PromptCount respjson.Field
+ TotalCredits respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptEstimateCostResponseEstimate) RawJSON() string { return r.JSON.raw }
+func (r *PromptEstimateCostResponseEstimate) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
type PromptNewParams struct {
- Text string `json:"text" api:"required"`
- TopicID string `json:"topic_id" api:"required"`
- LanguageID param.Opt[string] `json:"language_id,omitzero"`
- RegionID param.Opt[string] `json:"region_id,omitzero"`
- PlatformIDs []string `json:"platform_ids,omitzero"`
+ Text string `json:"text" api:"required"`
+ TopicID string `json:"topic_id" api:"required"`
+ PlatformIDs []string `json:"platform_ids,omitzero"`
paramObj
}
@@ -560,8 +618,6 @@ func (r *PromptNewParams) UnmarshalJSON(data []byte) error {
type PromptUpdateParams struct {
IsActive param.Opt[bool] `json:"is_active,omitzero"`
- LanguageID param.Opt[string] `json:"language_id,omitzero"`
- RegionID param.Opt[string] `json:"region_id,omitzero"`
Text param.Opt[string] `json:"text,omitzero"`
TopicID param.Opt[string] `json:"topic_id,omitzero"`
PlatformIDs []string `json:"platform_ids,omitzero"`
diff --git a/prompt_test.go b/prompt_test.go
index a7b927c..4747b9c 100644
--- a/prompt_test.go
+++ b/prompt_test.go
@@ -29,9 +29,7 @@ func TestPromptNewWithOptionalParams(t *testing.T) {
_, err := client.Prompts.New(context.TODO(), githubcomusesapientgosdk.PromptNewParams{
Text: "x",
TopicID: "topic_id",
- LanguageID: githubcomusesapientgosdk.String("language_id"),
PlatformIDs: []string{"string"},
- RegionID: githubcomusesapientgosdk.String("region_id"),
})
if err != nil {
var apierr *githubcomusesapientgosdk.Error
@@ -83,9 +81,7 @@ func TestPromptUpdateWithOptionalParams(t *testing.T) {
"prompt_id",
githubcomusesapientgosdk.PromptUpdateParams{
IsActive: githubcomusesapientgosdk.Bool(true),
- LanguageID: githubcomusesapientgosdk.String("language_id"),
PlatformIDs: []string{"string"},
- RegionID: githubcomusesapientgosdk.String("region_id"),
Text: githubcomusesapientgosdk.String("x"),
TopicID: githubcomusesapientgosdk.String("topic_id"),
},
@@ -149,3 +145,26 @@ func TestPromptDelete(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestPromptEstimateCost(t *testing.T) {
+ t.Skip("Mock server tests are disabled")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := githubcomusesapientgosdk.NewClient(
+ option.WithBaseURL(baseURL),
+ option.WithAPIKey("My API Key"),
+ )
+ _, err := client.Prompts.EstimateCost(context.TODO())
+ if err != nil {
+ var apierr *githubcomusesapientgosdk.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/promptplatform.go b/promptplatform.go
index 2f85aaf..42105b2 100644
--- a/promptplatform.go
+++ b/promptplatform.go
@@ -7,8 +7,10 @@ import (
"net/http"
"slices"
+ "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/respjson"
)
// PromptPlatformService contains methods and other services that help with
@@ -31,11 +33,31 @@ func NewPromptPlatformService(opts ...option.RequestOption) (r PromptPlatformSer
}
// List Platforms
-func (r *PromptPlatformService) List(ctx context.Context, opts ...option.RequestOption) (res *PromptPlatformListResponse, err error) {
+func (r *PromptPlatformService) List(ctx context.Context, opts ...option.RequestOption) (res *[]PromptPlatformListResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/prompts/platforms"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
-type PromptPlatformListResponse = any
+type PromptPlatformListResponse struct {
+ ID string `json:"id" api:"required"`
+ CreditsPerPrompt int64 `json:"credits_per_prompt" api:"required"`
+ Name string `json:"name" api:"required"`
+ Model string `json:"model" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CreditsPerPrompt respjson.Field
+ Name respjson.Field
+ Model respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptPlatformListResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptPlatformListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/prompttopic.go b/prompttopic.go
index 8ea3572..aecce23 100644
--- a/prompttopic.go
+++ b/prompttopic.go
@@ -141,7 +141,21 @@ func (r *PromptTopicListResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PromptTopicDeleteResponse = any
+type PromptTopicDeleteResponse 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 PromptTopicDeleteResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptTopicDeleteResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
type PromptTopicNewParams struct {
Name string `json:"name" api:"required"`
From 93bf8a4862a254136421e8623ee9c5c0b4f89813 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 23:44:45 +0000
Subject: [PATCH 6/6] release: 0.2.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 8 ++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 3d2ac0b..10f3091 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0"
+ ".": "0.2.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1eb8b79..97fa089 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
diff --git a/README.md b/README.md
index 7e17d80..2a5c550 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/usesapient/go-sdk@v0.1.0'
+go get -u 'github.com/usesapient/go-sdk@v0.2.0'
```
diff --git a/internal/version.go b/internal/version.go
index 02eac73..774c6c4 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.1.0" // x-release-please-version
+const PackageVersion = "0.2.0" // x-release-please-version