From aaa249d20e8fb643d66f48bf567af669ded55b14 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 5 May 2026 16:18:05 +0000
Subject: [PATCH 01/11] chore: update SDK settings
---
.release-please-manifest.json | 3 +
.stats.yml | 4 +-
CONTRIBUTING.md | 2 +-
README.md | 22 ++--
aliases.go | 4 +-
api.go | 2 +-
api.md | 100 +++++++++---------
apiapiperformance.go | 12 +--
apiapiperformance_test.go | 6 +-
apijob.go | 8 +-
apijob_test.go | 6 +-
apileaderboard.go | 8 +-
apileaderboard_test.go | 6 +-
apileaderboardcompany.go | 8 +-
apileaderboardcompany_test.go | 6 +-
apiprompt.go | 10 +-
apiprompt_test.go | 6 +-
auth.go | 4 +-
auth_test.go | 6 +-
client.go | 4 +-
client_test.go | 6 +-
context.go | 12 +--
context_test.go | 6 +-
evalrun.go | 12 +--
evalrun_test.go | 6 +-
field.go | 2 +-
go.mod | 2 +-
internal/apierror/apierror.go | 4 +-
internal/apiform/encoder.go | 2 +-
internal/apiform/form_test.go | 2 +-
internal/apiform/richparam.go | 2 +-
internal/apijson/decodeparam_test.go | 4 +-
internal/apijson/decoder.go | 2 +-
internal/apijson/decoderesp_test.go | 4 +-
internal/apijson/encoder.go | 2 +-
internal/apijson/subfield.go | 2 +-
internal/apijson/union.go | 2 +-
internal/apiquery/encoder.go | 2 +-
internal/apiquery/query_test.go | 2 +-
internal/apiquery/richparam.go | 2 +-
internal/encoding/json/decode.go | 2 +-
internal/encoding/json/encode.go | 4 +-
internal/encoding/json/sentinel/null.go | 2 +-
.../encoding/json/sentinel/sentinel_test.go | 4 +-
internal/encoding/json/time.go | 2 +-
internal/paramutil/field.go | 4 +-
internal/paramutil/union.go | 2 +-
internal/requestconfig/requestconfig.go | 8 +-
internal/version.go | 2 +-
option/requestoption.go | 4 +-
packages/param/encoder.go | 2 +-
packages/param/encoder_test.go | 2 +-
packages/param/null.go | 2 +-
packages/param/null_test.go | 2 +-
packages/param/option.go | 2 +-
packages/param/param.go | 2 +-
packages/respjson/decoder_test.go | 4 +-
prompt.go | 10 +-
prompt_test.go | 6 +-
release-please-config.json | 67 ++++++++++++
scripts/utils/upload-artifact.sh | 2 +-
shared/constant/constants.go | 2 +-
status.go | 4 +-
status_test.go | 6 +-
usage_test.go | 6 +-
workflow.go | 10 +-
workflow_test.go | 6 +-
workflowrun.go | 8 +-
workflowrun_test.go | 6 +-
69 files changed, 283 insertions(+), 205 deletions(-)
create mode 100644 .release-please-manifest.json
create mode 100644 release-please-config.json
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
new file mode 100644
index 0000000..1332969
--- /dev/null
+++ b/.release-please-manifest.json
@@ -0,0 +1,3 @@
+{
+ ".": "0.0.1"
+}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 3caa22e..31634b8 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 17
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-908ede43a8944686476822ee14a7f1b1ae3999071a43582a6f88e5d4bff26b33.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-4b34491e91581fe83b1750bd0f7563130239808e7c076e04f8df9a5c3a7c6265.yml
openapi_spec_hash: d786bf9a6956b2e85340b6869646ee38
-config_hash: ab4e633d60f3a8815964154998be703c
+config_hash: a5d275d7da5c3f027497d7559f02427e
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3498b09..5366dd3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -41,7 +41,7 @@ To use a local version of this library from source in another project, edit the
directive. This can be done through the CLI with the following:
```sh
-$ go mod edit -replace github.com/stainless-sdks/sapient-go=/path/to/sapient-go
+$ go mod edit -replace github.com/usesapient/go-sdk=/path/to/go-sdk
```
## Running tests
diff --git a/README.md b/README.md
index 77072ac..b027e4f 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-
+
@@ -13,18 +13,26 @@ It is generated with [Stainless](https://www.stainless.com/).
## Installation
+
+
```go
import (
- "github.com/stainless-sdks/sapient-go" // imported as sapient
+ "github.com/usesapient/go-sdk" // imported as sapient
)
```
+
+
Or to pin the version:
+
+
```sh
-go get -u 'github.com/stainless-sdks/sapient-go@v0.0.1'
+go get -u 'github.com/usesapient/go-sdk@v0.0.1'
```
+
+
## Requirements
This library requires Go 1.22+.
@@ -40,8 +48,8 @@ import (
"context"
"fmt"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/option"
)
func main() {
@@ -268,7 +276,7 @@ client.Status.Get(context.TODO(), ...,
The request option `option.WithDebugLog(nil)` may be helpful while debugging.
-See the [full list of request options](https://pkg.go.dev/github.com/stainless-sdks/sapient-go/option).
+See the [full list of request options](https://pkg.go.dev/github.com/usesapient/go-sdk/option).
### Pagination
@@ -465,7 +473,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
-We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/sapient-go/issues) with questions, bugs, or suggestions.
+We are keen for your feedback; please open an [issue](https://www.github.com/usesapient/go-sdk/issues) with questions, bugs, or suggestions.
## Contributing
diff --git a/aliases.go b/aliases.go
index d546547..32062c8 100644
--- a/aliases.go
+++ b/aliases.go
@@ -3,8 +3,8 @@
package sapient
import (
- "github.com/stainless-sdks/sapient-go/internal/apierror"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/internal/apierror"
+ "github.com/usesapient/go-sdk/packages/param"
)
// aliased to make [param.APIUnion] private when embedding
diff --git a/api.go b/api.go
index 4ffb834..3fe2c61 100644
--- a/api.go
+++ b/api.go
@@ -3,7 +3,7 @@
package sapient
import (
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk/option"
)
// APIService contains methods and other services that help with interacting with
diff --git a/api.md b/api.md
index 12b77f4..7b125f9 100644
--- a/api.md
+++ b/api.md
@@ -2,89 +2,89 @@
Response Types:
-- sapient.StatusGetResponse
-- sapient.StatusGetResponse
+- sapient.StatusGetResponse
+- sapient.StatusGetResponse
Methods:
-- client.Status.Get(ctx context.Context) (\*sapient.StatusGetResponse, error)
-- client.Status.Get(ctx context.Context) (\*sapient.StatusGetResponse, error)
+- client.Status.Get(ctx context.Context) (\*sapient.StatusGetResponse, error)
+- client.Status.Get(ctx context.Context) (\*sapient.StatusGetResponse, error)
# Auth
Response Types:
-- sapient.AuthGetStatusResponse
-- sapient.AuthStatusResponse
+- sapient.AuthGetStatusResponse
+- sapient.AuthStatusResponse
Methods:
-- client.Auth.GetStatus(ctx context.Context) (\*sapient.AuthGetStatusResponse, error)
-- client.Auth.Status(ctx context.Context) (\*sapient.AuthStatusResponse, error)
+- client.Auth.GetStatus(ctx context.Context) (\*sapient.AuthGetStatusResponse, error)
+- client.Auth.Status(ctx context.Context) (\*sapient.AuthStatusResponse, error)
# Context
Response Types:
-- sapient.EvalRunSummary
-- sapient.PublicCompany
-- sapient.PublicEndpoint
-- sapient.ContextGetCompanyResponse
-- sapient.ContextCompanyResponse
+- sapient.EvalRunSummary
+- sapient.PublicCompany
+- sapient.PublicEndpoint
+- sapient.ContextGetCompanyResponse
+- sapient.ContextCompanyResponse
Methods:
-- client.Context.GetCompany(ctx context.Context, company string, query sapient.ContextGetCompanyParams) (\*sapient.ContextGetCompanyResponse, error)
-- client.Context.Company(ctx context.Context, company string, query sapient.ContextCompanyParams) (\*sapient.ContextCompanyResponse, error)
+- client.Context.GetCompany(ctx context.Context, company string, query sapient.ContextGetCompanyParams) (\*sapient.ContextGetCompanyResponse, error)
+- client.Context.Company(ctx context.Context, company string, query sapient.ContextCompanyParams) (\*sapient.ContextCompanyResponse, error)
# EvalRuns
Response Types:
-- sapient.EvalRunDetail
-- sapient.PublicListMeta
-- sapient.EvalRunGetResponse
-- sapient.EvalRunListResponse
-- sapient.EvalRunDiagnoseResponse
+- sapient.EvalRunDetail
+- sapient.PublicListMeta
+- sapient.EvalRunGetResponse
+- sapient.EvalRunListResponse
+- sapient.EvalRunDiagnoseResponse
Methods:
-- client.EvalRuns.Get(ctx context.Context, runID string) (\*sapient.EvalRunGetResponse, error)
-- client.EvalRuns.List(ctx context.Context, query sapient.EvalRunListParams) (\*sapient.EvalRunListResponse, error)
-- client.EvalRuns.Diagnose(ctx context.Context, body sapient.EvalRunDiagnoseParams) (\*sapient.EvalRunDiagnoseResponse, error)
+- client.EvalRuns.Get(ctx context.Context, runID string) (\*sapient.EvalRunGetResponse, error)
+- client.EvalRuns.List(ctx context.Context, query sapient.EvalRunListParams) (\*sapient.EvalRunListResponse, error)
+- client.EvalRuns.Diagnose(ctx context.Context, body sapient.EvalRunDiagnoseParams) (\*sapient.EvalRunDiagnoseResponse, error)
# Prompts
Response Types:
-- sapient.PromptGenerateFromListResponse
+- sapient.PromptGenerateFromListResponse
Methods:
-- client.Prompts.GenerateFromList(ctx context.Context, body sapient.PromptGenerateFromListParams) (\*sapient.PromptGenerateFromListResponse, error)
+- client.Prompts.GenerateFromList(ctx context.Context, body sapient.PromptGenerateFromListParams) (\*sapient.PromptGenerateFromListResponse, error)
# Workflows
Response Types:
-- sapient.WorkflowResponse
-- sapient.WorkflowRunResponse
+- sapient.WorkflowResponse
+- sapient.WorkflowRunResponse
Methods:
-- client.Workflows.New(ctx context.Context, body sapient.WorkflowNewParams) (\*sapient.WorkflowResponse, error)
-- client.Workflows.Get(ctx context.Context, workflowID string) (\*sapient.WorkflowResponse, error)
-- client.Workflows.Run(ctx context.Context, workflowID string, body sapient.WorkflowRunParams) (\*sapient.WorkflowRunResponse, error)
+- client.Workflows.New(ctx context.Context, body sapient.WorkflowNewParams) (\*sapient.WorkflowResponse, error)
+- client.Workflows.Get(ctx context.Context, workflowID string) (\*sapient.WorkflowResponse, error)
+- client.Workflows.Run(ctx context.Context, workflowID string, body sapient.WorkflowRunParams) (\*sapient.WorkflowRunResponse, error)
# WorkflowRuns
Response Types:
-- sapient.PublicJob
+- sapient.PublicJob
Methods:
-- client.WorkflowRuns.Get(ctx context.Context, runID string) (\*sapient.PublicJob, error)
+- client.WorkflowRuns.Get(ctx context.Context, runID string) (\*sapient.PublicJob, error)
# API
@@ -92,56 +92,56 @@ Methods:
Response Types:
-- sapient.APILeaderboardListCompaniesResponse
+- sapient.APILeaderboardListCompaniesResponse
Methods:
-- client.API.Leaderboard.ListCompanies(ctx context.Context, query sapient.APILeaderboardListCompaniesParams) (\*sapient.APILeaderboardListCompaniesResponse, error)
+- client.API.Leaderboard.ListCompanies(ctx context.Context, query sapient.APILeaderboardListCompaniesParams) (\*sapient.APILeaderboardListCompaniesResponse, error)
### Companies
Response Types:
-- sapient.APILeaderboardCompanyListResponse
+- sapient.APILeaderboardCompanyListResponse
Methods:
-- client.API.Leaderboard.Companies.List(ctx context.Context, query sapient.APILeaderboardCompanyListParams) (\*sapient.APILeaderboardCompanyListResponse, error)
+- client.API.Leaderboard.Companies.List(ctx context.Context, query sapient.APILeaderboardCompanyListParams) (\*sapient.APILeaderboardCompanyListResponse, error)
## APIPerformance
Response Types:
-- sapient.FailureAnalysisSnapshot
-- sapient.ApiapiPerformanceLatestRunsResponse
+- sapient.FailureAnalysisSnapshot
+- sapient.ApiapiPerformanceLatestRunsResponse
Methods:
-- client.API.APIPerformance.FailureAnalysis(ctx context.Context, brandID string, query sapient.APIAPIPerformanceFailureAnalysisParams) (\*sapient.FailureAnalysisSnapshot, error)
-- client.API.APIPerformance.LatestRuns(ctx context.Context, brandID string, query sapient.APIAPIPerformanceLatestRunsParams) (\*sapient.ApiapiPerformanceLatestRunsResponse, error)
+- client.API.APIPerformance.FailureAnalysis(ctx context.Context, brandID string, query sapient.APIAPIPerformanceFailureAnalysisParams) (\*sapient.FailureAnalysisSnapshot, error)
+- client.API.APIPerformance.LatestRuns(ctx context.Context, brandID string, query sapient.APIAPIPerformanceLatestRunsParams) (\*sapient.ApiapiPerformanceLatestRunsResponse, error)
## Prompts
Response Types:
-- sapient.APIPromptNewBatchResponse
-- sapient.APIPromptBatchResponse
+- sapient.APIPromptNewBatchResponse
+- sapient.APIPromptBatchResponse
Methods:
-- client.API.Prompts.NewBatch(ctx context.Context, body sapient.APIPromptNewBatchParams) (\*sapient.APIPromptNewBatchResponse, error)
-- client.API.Prompts.Batch(ctx context.Context, body sapient.APIPromptBatchParams) (\*sapient.APIPromptBatchResponse, error)
+- client.API.Prompts.NewBatch(ctx context.Context, body sapient.APIPromptNewBatchParams) (\*sapient.APIPromptNewBatchResponse, error)
+- client.API.Prompts.Batch(ctx context.Context, body sapient.APIPromptBatchParams) (\*sapient.APIPromptBatchResponse, error)
## Jobs
Response Types:
-- sapient.APIJobListJobsResponse
-- sapient.APIJobListResponse
+- sapient.APIJobListJobsResponse
+- sapient.APIJobListResponse
Methods:
-- client.API.Jobs.ListJobs(ctx context.Context, query sapient.APIJobListJobsParams) (\*sapient.APIJobListJobsResponse, error)
-- client.API.Jobs.GetJob(ctx context.Context, jobID string) (\*sapient.PublicJob, error)
-- client.API.Jobs.List(ctx context.Context, query sapient.APIJobListParams) (\*sapient.APIJobListResponse, error)
-- client.API.Jobs.Get(ctx context.Context, jobID string) (\*sapient.PublicJob, error)
+- client.API.Jobs.ListJobs(ctx context.Context, query sapient.APIJobListJobsParams) (\*sapient.APIJobListJobsResponse, error)
+- client.API.Jobs.GetJob(ctx context.Context, jobID string) (\*sapient.PublicJob, error)
+- client.API.Jobs.List(ctx context.Context, query sapient.APIJobListParams) (\*sapient.APIJobListResponse, error)
+- client.API.Jobs.Get(ctx context.Context, jobID string) (\*sapient.PublicJob, error)
diff --git a/apiapiperformance.go b/apiapiperformance.go
index 801ac53..704d08f 100644
--- a/apiapiperformance.go
+++ b/apiapiperformance.go
@@ -10,12 +10,12 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "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"
)
// APIAPIPerformanceService contains methods and other services that help with
diff --git a/apiapiperformance_test.go b/apiapiperformance_test.go
index 412b59d..d05d5de 100644
--- a/apiapiperformance_test.go
+++ b/apiapiperformance_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
diff --git a/apijob.go b/apijob.go
index b39fdb3..89687d0 100644
--- a/apijob.go
+++ b/apijob.go
@@ -10,10 +10,10 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
+ "github.com/usesapient/go-sdk/packages/param"
)
// APIJobService contains methods and other services that help with interacting
diff --git a/apijob_test.go b/apijob_test.go
index 58873f7..4180ffc 100644
--- a/apijob_test.go
+++ b/apijob_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestAPIJobListJobsWithOptionalParams(t *testing.T) {
diff --git a/apileaderboard.go b/apileaderboard.go
index 8966de8..4fca089 100644
--- a/apileaderboard.go
+++ b/apileaderboard.go
@@ -8,10 +8,10 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
+ "github.com/usesapient/go-sdk/packages/param"
)
// APILeaderboardService contains methods and other services that help with
diff --git a/apileaderboard_test.go b/apileaderboard_test.go
index 66bf980..7c53aa1 100644
--- a/apileaderboard_test.go
+++ b/apileaderboard_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestAPILeaderboardListCompaniesWithOptionalParams(t *testing.T) {
diff --git a/apileaderboardcompany.go b/apileaderboardcompany.go
index 6155297..7da0236 100644
--- a/apileaderboardcompany.go
+++ b/apileaderboardcompany.go
@@ -8,10 +8,10 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
+ "github.com/usesapient/go-sdk/packages/param"
)
// APILeaderboardCompanyService contains methods and other services that help with
diff --git a/apileaderboardcompany_test.go b/apileaderboardcompany_test.go
index edd5403..e37d3fe 100644
--- a/apileaderboardcompany_test.go
+++ b/apileaderboardcompany_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestAPILeaderboardCompanyListWithOptionalParams(t *testing.T) {
diff --git a/apiprompt.go b/apiprompt.go
index 7facd5c..5f318c9 100644
--- a/apiprompt.go
+++ b/apiprompt.go
@@ -7,11 +7,11 @@ import (
"net/http"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "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"
)
// APIPromptService contains methods and other services that help with interacting
diff --git a/apiprompt_test.go b/apiprompt_test.go
index 73bc8e5..dd8511d 100644
--- a/apiprompt_test.go
+++ b/apiprompt_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestAPIPromptNewBatch(t *testing.T) {
diff --git a/auth.go b/auth.go
index 0a90365..3657f38 100644
--- a/auth.go
+++ b/auth.go
@@ -7,8 +7,8 @@ import (
"net/http"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
)
// AuthService contains methods and other services that help with interacting with
diff --git a/auth_test.go b/auth_test.go
index 79ea940..1386c6c 100644
--- a/auth_test.go
+++ b/auth_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestAuthGetStatus(t *testing.T) {
diff --git a/client.go b/client.go
index d8bb014..624fb19 100644
--- a/client.go
+++ b/client.go
@@ -9,8 +9,8 @@ import (
"slices"
"strings"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
)
// Client creates a struct with services and top level methods that help with
diff --git a/client_test.go b/client_test.go
index 8e7f0c1..8d8840d 100644
--- a/client_test.go
+++ b/client_test.go
@@ -10,9 +10,9 @@ import (
"testing"
"time"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal"
+ "github.com/usesapient/go-sdk/option"
)
type closureTransport struct {
diff --git a/context.go b/context.go
index 82077bf..c760d17 100644
--- a/context.go
+++ b/context.go
@@ -11,12 +11,12 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "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"
)
// ContextService contains methods and other services that help with interacting
diff --git a/context_test.go b/context_test.go
index d0b2dc1..00fd1ba 100644
--- a/context_test.go
+++ b/context_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestContextGetCompanyWithOptionalParams(t *testing.T) {
diff --git a/evalrun.go b/evalrun.go
index e1b4b93..215c469 100644
--- a/evalrun.go
+++ b/evalrun.go
@@ -11,12 +11,12 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "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"
)
// EvalRunService contains methods and other services that help with interacting
diff --git a/evalrun_test.go b/evalrun_test.go
index 142d414..cf8d349 100644
--- a/evalrun_test.go
+++ b/evalrun_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestEvalRunGet(t *testing.T) {
diff --git a/field.go b/field.go
index 4dd7bcd..9a84921 100644
--- a/field.go
+++ b/field.go
@@ -1,7 +1,7 @@
package sapient
import (
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"io"
"time"
)
diff --git a/go.mod b/go.mod
index a8debe4..8f220aa 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/stainless-sdks/sapient-go
+module github.com/usesapient/go-sdk
go 1.22
diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go
index bcccb8f..f1a4b77 100644
--- a/internal/apierror/apierror.go
+++ b/internal/apierror/apierror.go
@@ -7,8 +7,8 @@ import (
"net/http"
"net/http/httputil"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/packages/respjson"
)
// Error represents an error that originates from the API, i.e. when a request is
diff --git a/internal/apiform/encoder.go b/internal/apiform/encoder.go
index f47ed6d..cd09845 100644
--- a/internal/apiform/encoder.go
+++ b/internal/apiform/encoder.go
@@ -13,7 +13,7 @@ import (
"sync"
"time"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
)
var encoders sync.Map // map[encoderEntry]encoderFunc
diff --git a/internal/apiform/form_test.go b/internal/apiform/form_test.go
index 77d3ec9..4f8b635 100644
--- a/internal/apiform/form_test.go
+++ b/internal/apiform/form_test.go
@@ -2,7 +2,7 @@ package apiform
import (
"bytes"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"io"
"mime/multipart"
"strings"
diff --git a/internal/apiform/richparam.go b/internal/apiform/richparam.go
index df4c9f9..97940be 100644
--- a/internal/apiform/richparam.go
+++ b/internal/apiform/richparam.go
@@ -1,7 +1,7 @@
package apiform
import (
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"mime/multipart"
"reflect"
)
diff --git a/internal/apijson/decodeparam_test.go b/internal/apijson/decodeparam_test.go
index 2672c0d..32d5c0f 100644
--- a/internal/apijson/decodeparam_test.go
+++ b/internal/apijson/decodeparam_test.go
@@ -3,8 +3,8 @@ package apijson_test
import (
"encoding/json"
"fmt"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/packages/param"
"reflect"
"testing"
)
diff --git a/internal/apijson/decoder.go b/internal/apijson/decoder.go
index 9db8e70..41d0c12 100644
--- a/internal/apijson/decoder.go
+++ b/internal/apijson/decoder.go
@@ -7,7 +7,7 @@ package apijson
import (
"encoding/json"
"fmt"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"reflect"
"strconv"
"sync"
diff --git a/internal/apijson/decoderesp_test.go b/internal/apijson/decoderesp_test.go
index 737896c..049c728 100644
--- a/internal/apijson/decoderesp_test.go
+++ b/internal/apijson/decoderesp_test.go
@@ -2,8 +2,8 @@ package apijson_test
import (
"encoding/json"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/packages/respjson"
"testing"
)
diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go
index 4ecddf8..9d7be51 100644
--- a/internal/apijson/encoder.go
+++ b/internal/apijson/encoder.go
@@ -13,7 +13,7 @@ import (
"github.com/tidwall/sjson"
- shimjson "github.com/stainless-sdks/sapient-go/internal/encoding/json"
+ shimjson "github.com/usesapient/go-sdk/internal/encoding/json"
)
var encoders sync.Map // map[encoderEntry]encoderFunc
diff --git a/internal/apijson/subfield.go b/internal/apijson/subfield.go
index 34c50b2..7a47855 100644
--- a/internal/apijson/subfield.go
+++ b/internal/apijson/subfield.go
@@ -1,7 +1,7 @@
package apijson
import (
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/packages/respjson"
"reflect"
)
diff --git a/internal/apijson/union.go b/internal/apijson/union.go
index 8c79187..7fa44a9 100644
--- a/internal/apijson/union.go
+++ b/internal/apijson/union.go
@@ -2,7 +2,7 @@ package apijson
import (
"errors"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"reflect"
"github.com/tidwall/gjson"
diff --git a/internal/apiquery/encoder.go b/internal/apiquery/encoder.go
index cd8b56d..53e38f4 100644
--- a/internal/apiquery/encoder.go
+++ b/internal/apiquery/encoder.go
@@ -9,7 +9,7 @@ import (
"sync"
"time"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
)
var encoders sync.Map // map[reflect.Type]encoderFunc
diff --git a/internal/apiquery/query_test.go b/internal/apiquery/query_test.go
index d52df61..dc1f112 100644
--- a/internal/apiquery/query_test.go
+++ b/internal/apiquery/query_test.go
@@ -1,7 +1,7 @@
package apiquery
import (
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"net/url"
"testing"
"time"
diff --git a/internal/apiquery/richparam.go b/internal/apiquery/richparam.go
index 531a207..c13f24e 100644
--- a/internal/apiquery/richparam.go
+++ b/internal/apiquery/richparam.go
@@ -1,7 +1,7 @@
package apiquery
import (
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"reflect"
)
diff --git a/internal/encoding/json/decode.go b/internal/encoding/json/decode.go
index ca57617..a8640c8 100644
--- a/internal/encoding/json/decode.go
+++ b/internal/encoding/json/decode.go
@@ -14,7 +14,7 @@ import (
"encoding"
"encoding/base64"
"fmt"
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/shims"
+ "github.com/usesapient/go-sdk/internal/encoding/json/shims"
"reflect"
"strconv"
"strings"
diff --git a/internal/encoding/json/encode.go b/internal/encoding/json/encode.go
index 89f513a..d6dc83e 100644
--- a/internal/encoding/json/encode.go
+++ b/internal/encoding/json/encode.go
@@ -19,8 +19,8 @@ import (
"encoding"
"encoding/base64"
"fmt"
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/sentinel"
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/shims"
+ "github.com/usesapient/go-sdk/internal/encoding/json/sentinel"
+ "github.com/usesapient/go-sdk/internal/encoding/json/shims"
"math"
"reflect"
"slices"
diff --git a/internal/encoding/json/sentinel/null.go b/internal/encoding/json/sentinel/null.go
index 63013aa..cf5c0d0 100644
--- a/internal/encoding/json/sentinel/null.go
+++ b/internal/encoding/json/sentinel/null.go
@@ -1,7 +1,7 @@
package sentinel
import (
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/shims"
+ "github.com/usesapient/go-sdk/internal/encoding/json/shims"
"reflect"
"sync"
)
diff --git a/internal/encoding/json/sentinel/sentinel_test.go b/internal/encoding/json/sentinel/sentinel_test.go
index 3213c5c..ea694cb 100644
--- a/internal/encoding/json/sentinel/sentinel_test.go
+++ b/internal/encoding/json/sentinel/sentinel_test.go
@@ -1,8 +1,8 @@
package sentinel_test
import (
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/sentinel"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/internal/encoding/json/sentinel"
+ "github.com/usesapient/go-sdk/packages/param"
"reflect"
"slices"
"testing"
diff --git a/internal/encoding/json/time.go b/internal/encoding/json/time.go
index 24af40f..094ee7d 100644
--- a/internal/encoding/json/time.go
+++ b/internal/encoding/json/time.go
@@ -2,7 +2,7 @@
package json
import (
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/shims"
+ "github.com/usesapient/go-sdk/internal/encoding/json/shims"
"reflect"
"time"
)
diff --git a/internal/paramutil/field.go b/internal/paramutil/field.go
index 08404f2..39ec16a 100644
--- a/internal/paramutil/field.go
+++ b/internal/paramutil/field.go
@@ -1,8 +1,8 @@
package paramutil
import (
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/packages/param"
+ "github.com/usesapient/go-sdk/packages/respjson"
)
func AddrIfPresent[T comparable](v param.Opt[T]) *T {
diff --git a/internal/paramutil/union.go b/internal/paramutil/union.go
index c5c2678..e1ff458 100644
--- a/internal/paramutil/union.go
+++ b/internal/paramutil/union.go
@@ -2,7 +2,7 @@ package paramutil
import (
"fmt"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"reflect"
)
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index dc7c425..bf8ab63 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -18,10 +18,10 @@ import (
"strings"
"time"
- "github.com/stainless-sdks/sapient-go/internal"
- "github.com/stainless-sdks/sapient-go/internal/apierror"
- "github.com/stainless-sdks/sapient-go/internal/apiform"
- "github.com/stainless-sdks/sapient-go/internal/apiquery"
+ "github.com/usesapient/go-sdk/internal"
+ "github.com/usesapient/go-sdk/internal/apierror"
+ "github.com/usesapient/go-sdk/internal/apiform"
+ "github.com/usesapient/go-sdk/internal/apiquery"
)
func getDefaultHeaders() map[string]string {
diff --git a/internal/version.go b/internal/version.go
index 989c168..ebdd35f 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.0.1"
+const PackageVersion = "0.0.1" // x-release-please-version
diff --git a/option/requestoption.go b/option/requestoption.go
index 2505cb2..57986d1 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -11,15 +11,15 @@ import (
"strings"
"time"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
"github.com/tidwall/sjson"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
)
// RequestOption is an option for the requests made by the sapient API Client
// which can be supplied to clients, services, and methods. You can read more about this functional
// options pattern in our [README].
//
-// [README]: https://pkg.go.dev/github.com/stainless-sdks/sapient-go#readme-requestoptions
+// [README]: https://pkg.go.dev/github.com/usesapient/go-sdk#readme-requestoptions
type RequestOption = requestconfig.RequestOption
// WithBaseURL returns a RequestOption that sets the BaseURL for the client.
diff --git a/packages/param/encoder.go b/packages/param/encoder.go
index 0f128ed..0ce95b3 100644
--- a/packages/param/encoder.go
+++ b/packages/param/encoder.go
@@ -7,7 +7,7 @@ import (
"strings"
"time"
- shimjson "github.com/stainless-sdks/sapient-go/internal/encoding/json"
+ shimjson "github.com/usesapient/go-sdk/internal/encoding/json"
"github.com/tidwall/sjson"
)
diff --git a/packages/param/encoder_test.go b/packages/param/encoder_test.go
index b469f14..bc8740a 100644
--- a/packages/param/encoder_test.go
+++ b/packages/param/encoder_test.go
@@ -5,7 +5,7 @@ import (
"testing"
"time"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
)
type Struct struct {
diff --git a/packages/param/null.go b/packages/param/null.go
index f89e1cb..c597997 100644
--- a/packages/param/null.go
+++ b/packages/param/null.go
@@ -1,6 +1,6 @@
package param
-import "github.com/stainless-sdks/sapient-go/internal/encoding/json/sentinel"
+import "github.com/usesapient/go-sdk/internal/encoding/json/sentinel"
// NullMap returns a non-nil map with a length of 0.
// When used with [MarshalObject] or [MarshalUnion], it will be marshaled as null.
diff --git a/packages/param/null_test.go b/packages/param/null_test.go
index 5cbaf51..b047bdc 100644
--- a/packages/param/null_test.go
+++ b/packages/param/null_test.go
@@ -2,7 +2,7 @@ package param_test
import (
"encoding/json"
- "github.com/stainless-sdks/sapient-go/packages/param"
+ "github.com/usesapient/go-sdk/packages/param"
"testing"
)
diff --git a/packages/param/option.go b/packages/param/option.go
index 2178ee2..90b8776 100644
--- a/packages/param/option.go
+++ b/packages/param/option.go
@@ -3,7 +3,7 @@ package param
import (
"encoding/json"
"fmt"
- shimjson "github.com/stainless-sdks/sapient-go/internal/encoding/json"
+ shimjson "github.com/usesapient/go-sdk/internal/encoding/json"
"time"
)
diff --git a/packages/param/param.go b/packages/param/param.go
index 2aea892..3176b1f 100644
--- a/packages/param/param.go
+++ b/packages/param/param.go
@@ -2,7 +2,7 @@ package param
import (
"encoding/json"
- "github.com/stainless-sdks/sapient-go/internal/encoding/json/sentinel"
+ "github.com/usesapient/go-sdk/internal/encoding/json/sentinel"
"reflect"
)
diff --git a/packages/respjson/decoder_test.go b/packages/respjson/decoder_test.go
index d6732da..dfb402b 100644
--- a/packages/respjson/decoder_test.go
+++ b/packages/respjson/decoder_test.go
@@ -3,8 +3,8 @@ package respjson_test
import (
"encoding/json"
"fmt"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- rj "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "github.com/usesapient/go-sdk/internal/apijson"
+ rj "github.com/usesapient/go-sdk/packages/respjson"
"reflect"
"testing"
)
diff --git a/prompt.go b/prompt.go
index 5530874..8f48c76 100644
--- a/prompt.go
+++ b/prompt.go
@@ -7,11 +7,11 @@ import (
"net/http"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "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"
)
// PromptService contains methods and other services that help with interacting
diff --git a/prompt_test.go b/prompt_test.go
index 3de7043..7c3f0ad 100644
--- a/prompt_test.go
+++ b/prompt_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestPromptGenerateFromListWithOptionalParams(t *testing.T) {
diff --git a/release-please-config.json b/release-please-config.json
new file mode 100644
index 0000000..a38198e
--- /dev/null
+++ b/release-please-config.json
@@ -0,0 +1,67 @@
+{
+ "packages": {
+ ".": {}
+ },
+ "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
+ "include-v-in-tag": true,
+ "include-component-in-tag": false,
+ "versioning": "prerelease",
+ "prerelease": true,
+ "bump-minor-pre-major": true,
+ "bump-patch-for-minor-pre-major": false,
+ "pull-request-header": "Automated Release PR",
+ "pull-request-title-pattern": "release: ${version}",
+ "changelog-sections": [
+ {
+ "type": "feat",
+ "section": "Features"
+ },
+ {
+ "type": "fix",
+ "section": "Bug Fixes"
+ },
+ {
+ "type": "perf",
+ "section": "Performance Improvements"
+ },
+ {
+ "type": "revert",
+ "section": "Reverts"
+ },
+ {
+ "type": "chore",
+ "section": "Chores"
+ },
+ {
+ "type": "docs",
+ "section": "Documentation"
+ },
+ {
+ "type": "style",
+ "section": "Styles"
+ },
+ {
+ "type": "refactor",
+ "section": "Refactors"
+ },
+ {
+ "type": "test",
+ "section": "Tests",
+ "hidden": true
+ },
+ {
+ "type": "build",
+ "section": "Build System"
+ },
+ {
+ "type": "ci",
+ "section": "Continuous Integration",
+ "hidden": true
+ }
+ ],
+ "release-type": "go",
+ "extra-files": [
+ "internal/version.go",
+ "README.md"
+ ]
+}
\ No newline at end of file
diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh
index e9131ba..81b40d9 100755
--- a/scripts/utils/upload-artifact.sh
+++ b/scripts/utils/upload-artifact.sh
@@ -43,7 +43,7 @@ UPLOAD_RESPONSE=$(curl -v -X PUT \
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
- echo -e "\033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/sapient-go/$SHA'. Run 'go mod edit -replace github.com/stainless-sdks/sapient-go=/path/to/unzipped_directory'.\033[0m"
+ echo -e "\033[32mInstallation: Download and unzip: 'https://pkg.stainless.com/s/sapient-go/$SHA'. Run 'go mod edit -replace github.com/usesapient/go-sdk=/path/to/unzipped_directory'.\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index fc46679..59f8f93 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -3,7 +3,7 @@
package constant
import (
- shimjson "github.com/stainless-sdks/sapient-go/internal/encoding/json"
+ shimjson "github.com/usesapient/go-sdk/internal/encoding/json"
)
type Constant[T any] interface {
diff --git a/status.go b/status.go
index c0d7182..f013377 100644
--- a/status.go
+++ b/status.go
@@ -7,8 +7,8 @@ import (
"net/http"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
)
// StatusService contains methods and other services that help with interacting
diff --git a/status_test.go b/status_test.go
index 7ad9f97..1270fe1 100644
--- a/status_test.go
+++ b/status_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestStatusGet(t *testing.T) {
diff --git a/usage_test.go b/usage_test.go
index 7d15581..f324924 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -7,9 +7,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestUsage(t *testing.T) {
diff --git a/workflow.go b/workflow.go
index be787b6..670a6e0 100644
--- a/workflow.go
+++ b/workflow.go
@@ -10,11 +10,11 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/param"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "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"
)
// WorkflowService contains methods and other services that help with interacting
diff --git a/workflow_test.go b/workflow_test.go
index c031d62..598d029 100644
--- a/workflow_test.go
+++ b/workflow_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestWorkflowNewWithOptionalParams(t *testing.T) {
diff --git a/workflowrun.go b/workflowrun.go
index 8e2d194..3e6ccc4 100644
--- a/workflowrun.go
+++ b/workflowrun.go
@@ -10,10 +10,10 @@ import (
"net/url"
"slices"
- "github.com/stainless-sdks/sapient-go/internal/apijson"
- "github.com/stainless-sdks/sapient-go/internal/requestconfig"
- "github.com/stainless-sdks/sapient-go/option"
- "github.com/stainless-sdks/sapient-go/packages/respjson"
+ "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"
)
// WorkflowRunService contains methods and other services that help with
diff --git a/workflowrun_test.go b/workflowrun_test.go
index cc63054..b505a93 100644
--- a/workflowrun_test.go
+++ b/workflowrun_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sapient-go"
- "github.com/stainless-sdks/sapient-go/internal/testutil"
- "github.com/stainless-sdks/sapient-go/option"
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
)
func TestWorkflowRunGet(t *testing.T) {
From ad0264c170c36604b0384f01fcc12015403879d8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 5 May 2026 16:18:22 +0000
Subject: [PATCH 02/11] codegen metadata
---
.stats.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 31634b8..ee8064e 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 17
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-4b34491e91581fe83b1750bd0f7563130239808e7c076e04f8df9a5c3a7c6265.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-d6b7525085dcb48434608739f4d2494da6f1d17780f1eb6146c5b55c8311bc2a.yml
openapi_spec_hash: d786bf9a6956b2e85340b6869646ee38
-config_hash: a5d275d7da5c3f027497d7559f02427e
+config_hash: e46017fb365c17ba7eb4f1266065432a
From 70c3559c6f6ee137cbae449697f3f165d4e3b610 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 8 May 2026 02:36:06 +0000
Subject: [PATCH 03/11] chore: redact api-key headers in debug logs
---
option/middleware.go | 46 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/option/middleware.go b/option/middleware.go
index 8ec9dd6..3b5213c 100644
--- a/option/middleware.go
+++ b/option/middleware.go
@@ -8,6 +8,10 @@ import (
"net/http/httputil"
)
+// sensitiveLogHeaders are redacted before request and response content is
+// written to the debug logger.
+var sensitiveLogHeaders = []string{"authorization", "api-key", "x-api-key", "cookie", "set-cookie", "x-sapient-api-key"}
+
// WithDebugLog logs the HTTP request and response content.
// If the logger parameter is nil, it uses the default logger.
//
@@ -20,7 +24,7 @@ func WithDebugLog(logger *log.Logger) RequestOption {
logger = log.Default()
}
- if reqBytes, err := httputil.DumpRequest(req, true); err == nil {
+ if reqBytes, err := dumpRedactedRequest(req); err == nil {
logger.Printf("Request Content:\n%s\n", reqBytes)
}
@@ -29,10 +33,48 @@ func WithDebugLog(logger *log.Logger) RequestOption {
return resp, err
}
- if respBytes, err := httputil.DumpResponse(resp, true); err == nil {
+ if respBytes, err := dumpRedactedResponse(resp); err == nil {
logger.Printf("Response Content:\n%s\n", respBytes)
}
return resp, err
})
}
+
+// dumpRedactedRequest dumps req with sensitive headers replaced. The
+// original headers are restored via defer so a panic in DumpRequest cannot
+// leak the placeholder map into the live request sent downstream.
+func dumpRedactedRequest(req *http.Request) ([]byte, error) {
+ origHeaders := req.Header
+ req.Header = redactDebugHeaders(origHeaders)
+ defer func() { req.Header = origHeaders }()
+ return httputil.DumpRequest(req, true)
+}
+
+func dumpRedactedResponse(resp *http.Response) ([]byte, error) {
+ origHeaders := resp.Header
+ resp.Header = redactDebugHeaders(origHeaders)
+ defer func() { resp.Header = origHeaders }()
+ return httputil.DumpResponse(resp, true)
+}
+
+func redactDebugHeaders(headers http.Header) http.Header {
+ var redacted http.Header
+ for _, name := range sensitiveLogHeaders {
+ values := headers.Values(name)
+ if len(values) == 0 {
+ continue
+ }
+ if redacted == nil {
+ redacted = headers.Clone()
+ }
+ redacted.Del(name)
+ for range values {
+ redacted.Add(name, "***")
+ }
+ }
+ if redacted == nil {
+ return headers
+ }
+ return redacted
+}
From 2e82dd9138032133a11d34e1aa61fd3ac76b2c65 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 8 May 2026 02:37:01 +0000
Subject: [PATCH 04/11] fix(go): avoid panic when http.DefaultTransport is
wrapped
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
defaultHTTPClient performed an unchecked type assertion on
http.DefaultTransport, which panicked for any caller that had wrapped
the global transport (e.g. otelhttp.NewTransport for distributed
tracing). When the assertion fails, fall back to the wrapped
RoundTripper as-is — preserving the caller's wrapping at the cost of
ResponseHeaderTimeout, which is strictly better than panicking.
---
default_http_client.go | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/default_http_client.go b/default_http_client.go
index 86056ef..5729f5d 100644
--- a/default_http_client.go
+++ b/default_http_client.go
@@ -14,11 +14,17 @@ import (
const defaultResponseHeaderTimeout = 10 * time.Minute
// defaultHTTPClient returns an [*http.Client] used when the caller does not
-// supply one via [option.WithHTTPClient]. It clones [http.DefaultTransport]
-// and adds a [http.Transport.ResponseHeaderTimeout] so stuck connections
-// fail fast instead of compounding across retries.
+// supply one via [option.WithHTTPClient]. When [http.DefaultTransport] is the
+// stdlib [*http.Transport], it is cloned and a [http.Transport.ResponseHeaderTimeout]
+// is set so stuck connections fail fast instead of compounding across retries.
+// If [http.DefaultTransport] has been wrapped (for example by otelhttp for
+// distributed tracing), the wrapping is preserved and the header timeout is
+// skipped.
func defaultHTTPClient() *http.Client {
- transport := http.DefaultTransport.(*http.Transport).Clone()
- transport.ResponseHeaderTimeout = defaultResponseHeaderTimeout
- return &http.Client{Transport: transport}
+ if t, ok := http.DefaultTransport.(*http.Transport); ok {
+ t = t.Clone()
+ t.ResponseHeaderTimeout = defaultResponseHeaderTimeout
+ return &http.Client{Transport: t}
+ }
+ return &http.Client{Transport: http.DefaultTransport}
}
From f4eae78c9d21762ac802aa49fc31bc02c2c61019 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 13 May 2026 02:14:06 +0000
Subject: [PATCH 05/11] ci: pin GitHub Actions to commit SHAs
Pin all GitHub Actions referenced in generated workflows (both
first-party `actions/*` and third-party) to immutable commit SHAs.
Updating pinned actions is now a deliberate codegen-side bump rather
than implicit on every workflow run.
---
.github/workflows/ci.yml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 753e601..92657be 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -26,14 +26,14 @@ jobs:
github.repository == 'stainless-sdks/sapient-go' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/sapient-go' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
- uses: actions/github-script@v8
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());
@@ -53,10 +53,10 @@ jobs:
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup go
- uses: actions/setup-go@v5
+ uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: ./go.mod
@@ -68,10 +68,10 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/sapient-go' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup go
- uses: actions/setup-go@v5
+ uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: ./go.mod
From c4a2fe9b93fcbd3a913cfd6d1063629d5151967d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 14 May 2026 02:25:24 +0000
Subject: [PATCH 06/11] feat(client): optimize json encoder for internal types
---
internal/encoding/json/encode.go | 21 ++--
internal/encoding/json/indent.go | 17 ++-
internal/encoding/json/opt.go | 24 +++++
internal/encoding/json/stream.go | 53 +++++-----
internal/encoding/json/time.go | 2 +-
packages/param/encoder.go | 4 +-
packages/param/encoder_test.go | 176 +++++++++++++++++++++++++++++++
7 files changed, 260 insertions(+), 37 deletions(-)
create mode 100644 internal/encoding/json/opt.go
diff --git a/internal/encoding/json/encode.go b/internal/encoding/json/encode.go
index d6dc83e..b3b969c 100644
--- a/internal/encoding/json/encode.go
+++ b/internal/encoding/json/encode.go
@@ -173,15 +173,21 @@ import (
// JSON cannot represent cyclic data structures and Marshal does not
// handle them. Passing cyclic structures to Marshal will result in
// an error.
-func Marshal(v any) ([]byte, error) {
+// EDIT(begin): add optimization options
+func Marshal(v any, opts ...Option) ([]byte, error) {
+ // EDIT(end): add optimization options
e := newEncodeState()
defer encodeStatePool.Put(e)
- // SHIM(begin): don't escape HTML by default
- err := e.marshal(v, encOpts{escapeHTML: shims.EscapeHTMLByDefault})
+ // EDIT(begin): don't escape HTML by default, and apply options
+ encOpts := encOpts{escapeHTML: shims.EscapeHTMLByDefault}
+ if opts != nil {
+ encOpts = encOpts.apply(opts...)
+ }
+ err := e.marshal(v, encOpts)
// ORIGINAL:
// err := e.marshal(v, encOpts{escapeHTML: true})
- // SHIM(end)
+ // EDIT(end)
if err != nil {
return nil, err
}
@@ -352,6 +358,9 @@ type encOpts struct {
// EDIT(begin): save the timefmt
timefmt string
// EDIT(end)
+ // EDIT(begin): add optimization to skip compaction
+ skipCompaction bool
+ // EDIT(end)
}
type encoderFunc func(e *encodeState, v reflect.Value, opts encOpts)
@@ -483,7 +492,7 @@ func marshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
if err == nil {
e.Grow(len(b))
out := e.AvailableBuffer()
- out, err = appendCompact(out, b, opts.escapeHTML)
+ out, err = appendCompact(out, b, opts)
e.Buffer.Write(out)
}
if err != nil {
@@ -509,7 +518,7 @@ func addrMarshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
if err == nil {
e.Grow(len(b))
out := e.AvailableBuffer()
- out, err = appendCompact(out, b, opts.escapeHTML)
+ out, err = appendCompact(out, b, opts)
e.Buffer.Write(out)
}
if err != nil {
diff --git a/internal/encoding/json/indent.go b/internal/encoding/json/indent.go
index 01bfdf6..c9d6ca5 100644
--- a/internal/encoding/json/indent.go
+++ b/internal/encoding/json/indent.go
@@ -4,7 +4,9 @@
package json
-import "bytes"
+import (
+ "bytes"
+)
// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029
@@ -41,12 +43,21 @@ func appendHTMLEscape(dst, src []byte) []byte {
func Compact(dst *bytes.Buffer, src []byte) error {
dst.Grow(len(src))
b := dst.AvailableBuffer()
- b, err := appendCompact(b, src, false)
+ b, err := appendCompact(b, src, encOpts{})
dst.Write(b)
return err
}
-func appendCompact(dst, src []byte, escape bool) ([]byte, error) {
+func appendCompact(dst, src []byte, opts encOpts) ([]byte, error) {
+ // EDIT(begin): optimize for skipCompaction
+ if opts.skipCompaction {
+ dst = append(dst, src...)
+ return dst, nil
+ }
+
+ escape := opts.escapeHTML
+ // EDIT(end)
+
origLen := len(dst)
scan := newScanner()
defer freeScanner(scan)
diff --git a/internal/encoding/json/opt.go b/internal/encoding/json/opt.go
new file mode 100644
index 0000000..fd6f8d2
--- /dev/null
+++ b/internal/encoding/json/opt.go
@@ -0,0 +1,24 @@
+// EDIT(begin): add custom options for JSON encoding
+package json
+
+type Option func(*encOpts)
+
+// Every time a sub-type of [json.Marshaler] is encountered,
+// skip a redundant and costly compaction step, trust it to self-compact.
+//
+// This is a divergence from the standard library behavior, and is only guaranteed
+// safe with SDK types.
+func WithSkipCompaction(b bool) Option {
+ return func(eos *encOpts) {
+ eos.skipCompaction = true
+ }
+}
+
+func (eos encOpts) apply(opts ...Option) encOpts {
+ for _, opt := range opts {
+ opt(&eos)
+ }
+ return eos
+}
+
+// EDIT(end)
diff --git a/internal/encoding/json/stream.go b/internal/encoding/json/stream.go
index e2d9470..652522c 100644
--- a/internal/encoding/json/stream.go
+++ b/internal/encoding/json/stream.go
@@ -6,7 +6,6 @@ package json
import (
"bytes"
- "errors"
"io"
)
@@ -253,30 +252,34 @@ func (enc *Encoder) SetEscapeHTML(on bool) {
enc.escapeHTML = on
}
-// RawMessage is a raw encoded JSON value.
-// It implements [Marshaler] and [Unmarshaler] and can
-// be used to delay JSON decoding or precompute a JSON encoding.
-type RawMessage []byte
-
-// MarshalJSON returns m as the JSON encoding of m.
-func (m RawMessage) MarshalJSON() ([]byte, error) {
- if m == nil {
- return []byte("null"), nil
- }
- return m, nil
-}
-
-// UnmarshalJSON sets *m to a copy of data.
-func (m *RawMessage) UnmarshalJSON(data []byte) error {
- if m == nil {
- return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
- }
- *m = append((*m)[0:0], data...)
- return nil
-}
-
-var _ Marshaler = (*RawMessage)(nil)
-var _ Unmarshaler = (*RawMessage)(nil)
+// EDIT(begin): remove RawMessage
+//
+// // RawMessage is a raw encoded JSON value.
+// // It implements [Marshaler] and [Unmarshaler] and can
+// // be used to delay JSON decoding or precompute a JSON encoding.
+// type RawMessage []byte
+//
+// // MarshalJSON returns m as the JSON encoding of m.
+// func (m RawMessage) MarshalJSON() ([]byte, error) {
+// if m == nil {
+// return []byte("null"), nil
+// }
+// return m, nil
+// }
+//
+// // UnmarshalJSON sets *m to a copy of data.
+// func (m *RawMessage) UnmarshalJSON(data []byte) error {
+// if m == nil {
+// return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
+// }
+// *m = append((*m)[0:0], data...)
+// return nil
+// }
+//
+// var _ Marshaler = (*RawMessage)(nil)
+// var _ Unmarshaler = (*RawMessage)(nil)
+//
+// EDIT(end)
// A Token holds a value of one of these types:
//
diff --git a/internal/encoding/json/time.go b/internal/encoding/json/time.go
index 094ee7d..d7a542a 100644
--- a/internal/encoding/json/time.go
+++ b/internal/encoding/json/time.go
@@ -50,7 +50,7 @@ func timeMarshalEncoder(e *encodeState, v reflect.Value, opts encOpts) bool {
if b != nil {
e.Grow(len(b))
out := e.AvailableBuffer()
- out, _ = appendCompact(out, b, opts.escapeHTML)
+ out, _ = appendCompact(out, b, opts)
e.Buffer.Write(out)
return true
}
diff --git a/packages/param/encoder.go b/packages/param/encoder.go
index 0ce95b3..2074d2b 100644
--- a/packages/param/encoder.go
+++ b/packages/param/encoder.go
@@ -66,7 +66,7 @@ func MarshalWithExtras[T ParamStruct, R any](f T, underlying any, extras map[str
} else if ovr, ok := f.Overrides(); ok {
return shimjson.Marshal(ovr)
} else {
- return shimjson.Marshal(underlying)
+ return shimjson.Marshal(underlying, shimjson.WithSkipCompaction(true))
}
}
@@ -96,7 +96,7 @@ func MarshalUnion[T ParamStruct](metadata T, variants ...any) ([]byte, error) {
Err: fmt.Errorf("expected union to have only one present variant, got %d", nPresent),
}
}
- return shimjson.Marshal(variants[presentIdx])
+ return shimjson.Marshal(variants[presentIdx], shimjson.WithSkipCompaction(true))
}
// typeFor is shimmed from Go 1.23 "reflect" package
diff --git a/packages/param/encoder_test.go b/packages/param/encoder_test.go
index bc8740a..8bb6f3f 100644
--- a/packages/param/encoder_test.go
+++ b/packages/param/encoder_test.go
@@ -1,10 +1,13 @@
package param_test
import (
+ "bytes"
"encoding/json"
+ "reflect"
"testing"
"time"
+ shimjson "github.com/usesapient/go-sdk/internal/encoding/json"
"github.com/usesapient/go-sdk/packages/param"
)
@@ -375,3 +378,176 @@ func TestNullStructUnion(t *testing.T) {
t.Fatalf("expected null, received %s", string(b))
}
}
+
+//
+// Compaction optimization
+//
+
+type NonCompactedDoubleParent struct {
+ Prop string `json:"prop"`
+ Parent NonCompactedParent `json:"parent"`
+
+ param.APIObject
+}
+
+type NonCompactedParent struct {
+ BadChild NonCompacted `json:"bad_child"`
+
+ param.APIObject
+}
+
+type NonCompacted struct {
+ Raw string
+
+ param.APIObject
+}
+
+func (a NonCompactedDoubleParent) MarshalJSON() ([]byte, error) {
+ type shadow NonCompactedDoubleParent
+ return param.MarshalObject(a, (*shadow)(&a))
+}
+
+func (a NonCompactedParent) MarshalJSON() ([]byte, error) {
+ type shadow NonCompactedParent
+ return param.MarshalObject(a, (*shadow)(&a))
+}
+
+func (a NonCompacted) MarshalJSON() ([]byte, error) {
+ if a.Raw == "" {
+ a.Raw = nonCompactedRaw
+ }
+ return []byte(a.Raw), nil
+}
+
+var nonCompactedRaw string = ` { "foo": "bar" } `
+
+func TestAppendCompactBroken(t *testing.T) {
+ tests := map[string]struct {
+ value json.Marshaler
+ }{
+ "red/illegal-json": {
+ NonCompacted{Raw: `{ "broken": "json" `},
+ },
+ "red/nested-with-illegal-json": {
+ NonCompactedParent{BadChild: NonCompacted{
+ Raw: `{ "broken": "json" `,
+ }},
+ },
+ }
+
+ for name, test := range tests {
+ t.Run(name, func(t *testing.T) {
+ v, err := json.Marshal(test.value)
+ if err == nil {
+ t.Fatal("expected error got", v)
+ }
+ })
+ }
+}
+
+// TestAppendCompact validates an optimization for internal SDK types to
+// avoid O(keys^2) iteration over each JSON object.
+//
+// It's possible to intentionally trigger this behavior as both a user and
+// SDK developer. However, the edge case is quite pathological and requires
+// calling [json.Marshaler.MarshalJSON] rather than [json.Marshal].
+func TestAppendCompact(t *testing.T) {
+
+ tests := map[string]struct {
+ value json.Marshaler
+ expected string
+ }{
+ //
+ // Non-compacted cases
+ //
+ // Note this is how to exploit the compacter to fail, you must call [json.Marshaler.MarshalJSON] rather than [json.Marshal].
+ // The type must also embed [param.APIObject] and return non-compacted JSON.
+ //
+
+ "no-compact/fails-compaction": {
+ NonCompacted{Raw: nonCompactedRaw},
+ nonCompactedRaw,
+ },
+ "no-compact/nested-with-bad-child": {
+ NonCompactedParent{BadChild: NonCompacted{
+ Raw: nonCompactedRaw,
+ }},
+ `{"bad_child":` + nonCompactedRaw + `}`,
+ },
+ "no-compact/double-nested-with-bad-child": {
+ NonCompactedDoubleParent{Prop: "1", Parent: NonCompactedParent{BadChild: NonCompacted{
+ Raw: nonCompactedRaw,
+ }}},
+ `{"prop":"1","parent":{"bad_child":` + nonCompactedRaw + `}}`,
+ },
+
+ //
+ // Compacted cases
+ //
+
+ "override/spaces-within": {
+ param.Override[NonCompactedDoubleParent](json.RawMessage(`{"com": "pact"}`)),
+ `{"com":"pact"}`,
+ },
+ "override/spaces-after": {
+ param.Override[NonCompactedDoubleParent](json.RawMessage(`{"com":"pact"} `)),
+ `{"com":"pact"}`,
+ },
+ "override/spaces-before": {
+ param.Override[NonCompactedDoubleParent](json.RawMessage(` {"com":"pact"}`)),
+ `{"com":"pact"}`,
+ },
+ "override/spaces-around": {
+ param.Override[NonCompactedDoubleParent](json.RawMessage(` { "com": "pact" }`)),
+ `{"com":"pact"}`,
+ },
+ "override/override-with-nested": {
+ param.Override[NonCompactedDoubleParent](NonCompactedParent{}),
+ `{"bad_child":{"foo":"bar"}}`,
+ },
+ "override/override-with-non-compacted": {
+ param.Override[NonCompactedDoubleParent](NonCompacted{}),
+ `{"foo":"bar"}`,
+ },
+ }
+
+ for name, test := range tests {
+ t.Run(name+"/marshal-json", func(t *testing.T) {
+ b, err := test.value.MarshalJSON()
+ if err != nil {
+ t.Fatalf("didn't expect error %v, expected %s", err, test.expected)
+ }
+ if string(b) != test.expected {
+ t.Fatalf("expected %s (%s), received %s", test.expected, reflect.TypeOf(test.value), string(b))
+ }
+ })
+
+ t.Run(name+"/json-marshal", func(t *testing.T) {
+ b, err := json.Marshal(test.value)
+ if err != nil {
+ t.Fatalf("didn't expect error %v, expected %s", err, test.expected)
+ }
+
+ // expected output of JSON Marshal should always be compacted
+ var compactedExpected bytes.Buffer
+ err = json.Compact(&compactedExpected, []byte(test.expected))
+ if err != nil {
+ t.Fatalf("didn't expect error %v, expected %s", err, test.expected)
+ }
+
+ if string(b) != compactedExpected.String() {
+ t.Fatalf("expected %s (%s), received %s", test.expected, reflect.TypeOf(test.value), string(b))
+ }
+ })
+
+ t.Run(name+"/shimjson-marshal", func(t *testing.T) {
+ b, err := shimjson.Marshal(test.value)
+ if err != nil {
+ t.Fatalf("didn't expect error %v, expected %s", err, test.expected)
+ }
+ if string(b) != test.expected {
+ t.Logf("expected %s (%s), received %s", test.expected, reflect.TypeOf(test.value), string(b))
+ }
+ })
+ }
+}
From 1244e4fa9f72055fe47d674631447eecbd6de491 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 18:07:48 +0000
Subject: [PATCH 07/11] feat(api): manual updates
---
.stats.yml | 4 ++--
option/requestoption.go | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index ee8064e..a99343b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 17
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-d6b7525085dcb48434608739f4d2494da6f1d17780f1eb6146c5b55c8311bc2a.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-0f510a2a26053a241863147d2e6a4476bf1f156a5c4ce30f5f84e4c48a08066c.yml
openapi_spec_hash: d786bf9a6956b2e85340b6869646ee38
-config_hash: e46017fb365c17ba7eb4f1266065432a
+config_hash: 094881541750eb76e7067c1316a56ccc
diff --git a/option/requestoption.go b/option/requestoption.go
index 57986d1..2778b13 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -263,7 +263,7 @@ func WithRequestTimeout(dur time.Duration) RequestOption {
// environment to be the "production" environment. An environment specifies which base URL
// to use by default.
func WithEnvironmentProduction() RequestOption {
- return requestconfig.WithDefaultBaseURL("https://api.example.com/")
+ return requestconfig.WithDefaultBaseURL("https://public-api.usesapient.com/")
}
// WithBearerToken returns a RequestOption that sets the client setting "bearer_token".
From 9006fc392d874ccb73467b5af2c8a604b137264d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 18:08:13 +0000
Subject: [PATCH 08/11] feat(api): manual updates
---
.stats.yml | 4 +-
README.md | 38 ++++++-------
aliases.go | 2 +-
api.go | 2 +-
api.md | 100 +++++++++++++++++-----------------
apiapiperformance.go | 2 +-
apiapiperformance_test.go | 18 +++---
apijob.go | 2 +-
apijob_test.go | 34 ++++++------
apileaderboard.go | 2 +-
apileaderboard_test.go | 12 ++--
apileaderboardcompany.go | 2 +-
apileaderboardcompany_test.go | 12 ++--
apiprompt.go | 2 +-
apiprompt_test.go | 18 +++---
auth.go | 2 +-
auth_test.go | 10 ++--
client.go | 2 +-
client_test.go | 18 +++---
context.go | 2 +-
context_test.go | 26 ++++-----
default_http_client.go | 2 +-
evalrun.go | 2 +-
evalrun_test.go | 30 +++++-----
field.go | 2 +-
prompt.go | 2 +-
prompt_test.go | 26 ++++-----
status.go | 2 +-
status_test.go | 10 ++--
usage_test.go | 4 +-
workflow.go | 2 +-
workflow_test.go | 24 ++++----
workflowrun.go | 2 +-
workflowrun_test.go | 6 +-
34 files changed, 212 insertions(+), 212 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index a99343b..7490357 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 17
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-0f510a2a26053a241863147d2e6a4476bf1f156a5c4ce30f5f84e4c48a08066c.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-19772e79be7e030ebf8bd823aae76ff7e366c8f873aab056487dcc912ea5a6b4.yml
openapi_spec_hash: d786bf9a6956b2e85340b6869646ee38
-config_hash: 094881541750eb76e7067c1316a56ccc
+config_hash: aa8a070cfe69cecc0fe6f03da5935bd3
diff --git a/README.md b/README.md
index b027e4f..8ba132c 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ It is generated with [Stainless](https://www.stainless.com/).
```go
import (
- "github.com/usesapient/go-sdk" // imported as sapient
+ "github.com/usesapient/go-sdk" // imported as githubcomusesapientgosdk
)
```
@@ -53,7 +53,7 @@ import (
)
func main() {
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("SAPIENT_API_KEY")
)
status, err := client.Status.Get(context.TODO())
@@ -67,13 +67,13 @@ func main() {
### Request fields
-The sapient library uses the [`omitzero`](https://tip.golang.org/doc/go1.24#encodingjsonpkgencodingjson)
+The githubcomusesapientgosdk library uses the [`omitzero`](https://tip.golang.org/doc/go1.24#encodingjsonpkgencodingjson)
semantics from the Go 1.24+ `encoding/json` release for request fields.
Required primitive fields (`int64`, `string`, etc.) feature the tag \`api:"required"\`. These
fields are always serialized, even their zero values.
-Optional primitive types are wrapped in a `param.Opt[T]`. These fields can be set with the provided constructors, `sapient.String(string)`, `sapient.Int(int64)`, etc.
+Optional primitive types are wrapped in a `param.Opt[T]`. These fields can be set with the provided constructors, `githubcomusesapientgosdk.String(string)`, `githubcomusesapientgosdk.Int(int64)`, etc.
Any `param.Opt[T]`, map, slice, struct or string enum uses the
tag \`json:"...,omitzero"\`. Its zero value is considered omitted.
@@ -81,17 +81,17 @@ tag \`json:"...,omitzero"\`. Its zero value is considered omitted.
The `param.IsOmitted(any)` function can confirm the presence of any `omitzero` field.
```go
-p := sapient.ExampleParams{
- ID: "id_xxx", // required property
- Name: sapient.String("..."), // optional property
+p := githubcomusesapientgosdk.ExampleParams{
+ ID: "id_xxx", // required property
+ Name: githubcomusesapientgosdk.String("..."), // optional property
- Point: sapient.Point{
- X: 0, // required field will serialize as 0
- Y: sapient.Int(1), // optional field will serialize as 1
+ Point: githubcomusesapientgosdk.Point{
+ X: 0, // required field will serialize as 0
+ Y: githubcomusesapientgosdk.Int(1), // optional field will serialize as 1
// ... omitted non-required fields will not be serialized
},
- Origin: sapient.Origin{}, // the zero value of [Origin] is considered omitted
+ Origin: githubcomusesapientgosdk.Origin{}, // the zero value of [Origin] is considered omitted
}
```
@@ -120,7 +120,7 @@ p.SetExtraFields(map[string]any{
})
// Send a number instead of an object
-custom := param.Override[sapient.FooParams](12)
+custom := param.Override[githubcomusesapientgosdk.FooParams](12)
```
### Request unions
@@ -261,7 +261,7 @@ This library uses the functional options pattern. Functions defined in the
requests. For example:
```go
-client := sapient.NewClient(
+client := githubcomusesapientgosdk.NewClient(
// Adds a header to every request made by the client
option.WithHeader("X-Some-Header", "custom_header_info"),
)
@@ -290,7 +290,7 @@ with additional helper methods like `.GetNextPage()`, e.g.:
### Errors
When the API returns a non-success status code, we return an error with type
-`*sapient.Error`. This contains the `StatusCode`, `*http.Request`, and
+`*githubcomusesapientgosdk.Error`. This contains the `StatusCode`, `*http.Request`, and
`*http.Response` values of the request, as well as the JSON of the error body
(much like other response objects in the SDK).
@@ -299,7 +299,7 @@ To handle errors, we recommend that you use the `errors.As` pattern:
```go
_, err := client.Status.Get(context.TODO())
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request
println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
@@ -339,7 +339,7 @@ The file name and content-type can be customized by implementing `Name() string`
string` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a
file returned by `os.Open` will be sent with the file name on disk.
-We also provide a helper `sapient.File(reader io.Reader, filename string, contentType string)`
+We also provide a helper `githubcomusesapientgosdk.File(reader io.Reader, filename string, contentType string)`
which can be used to wrap any `io.Reader` with the appropriate file name and content type.
### Retries
@@ -352,7 +352,7 @@ You can use the `WithMaxRetries` option to configure or disable this:
```go
// Configure the default for all requests:
-client := sapient.NewClient(
+client := githubcomusesapientgosdk.NewClient(
option.WithMaxRetries(0), // default is 2
)
@@ -413,7 +413,7 @@ or the `option.WithJSONSet()` methods.
params := FooNewParams{
ID: "id_xxxx",
Data: FooNewParamsData{
- FirstName: sapient.String("John"),
+ FirstName: githubcomusesapientgosdk.String("John"),
},
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
@@ -448,7 +448,7 @@ func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response,
return res, err
}
-client := sapient.NewClient(
+client := githubcomusesapientgosdk.NewClient(
option.WithMiddleware(Logger),
)
```
diff --git a/aliases.go b/aliases.go
index 32062c8..4d65e5c 100644
--- a/aliases.go
+++ b/aliases.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"github.com/usesapient/go-sdk/internal/apierror"
diff --git a/api.go b/api.go
index 3fe2c61..810e9c5 100644
--- a/api.go
+++ b/api.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"github.com/usesapient/go-sdk/option"
diff --git a/api.md b/api.md
index 7b125f9..2a3918a 100644
--- a/api.md
+++ b/api.md
@@ -2,89 +2,89 @@
Response Types:
-- sapient.StatusGetResponse
-- sapient.StatusGetResponse
+- githubcomusesapientgosdk.StatusGetResponse
+- githubcomusesapientgosdk.StatusGetResponse
Methods:
-- client.Status.Get(ctx context.Context) (\*sapient.StatusGetResponse, error)
-- client.Status.Get(ctx context.Context) (\*sapient.StatusGetResponse, error)
+- client.Status.Get(ctx context.Context) (\*githubcomusesapientgosdk.StatusGetResponse, error)
+- client.Status.Get(ctx context.Context) (\*githubcomusesapientgosdk.StatusGetResponse, error)
# Auth
Response Types:
-- sapient.AuthGetStatusResponse
-- sapient.AuthStatusResponse
+- githubcomusesapientgosdk.AuthGetStatusResponse
+- githubcomusesapientgosdk.AuthStatusResponse
Methods:
-- client.Auth.GetStatus(ctx context.Context) (\*sapient.AuthGetStatusResponse, error)
-- client.Auth.Status(ctx context.Context) (\*sapient.AuthStatusResponse, error)
+- client.Auth.GetStatus(ctx context.Context) (\*githubcomusesapientgosdk.AuthGetStatusResponse, error)
+- client.Auth.Status(ctx context.Context) (\*githubcomusesapientgosdk.AuthStatusResponse, error)
# Context
Response Types:
-- sapient.EvalRunSummary
-- sapient.PublicCompany
-- sapient.PublicEndpoint
-- sapient.ContextGetCompanyResponse
-- sapient.ContextCompanyResponse
+- githubcomusesapientgosdk.EvalRunSummary
+- githubcomusesapientgosdk.PublicCompany
+- githubcomusesapientgosdk.PublicEndpoint
+- githubcomusesapientgosdk.ContextGetCompanyResponse
+- githubcomusesapientgosdk.ContextCompanyResponse
Methods:
-- client.Context.GetCompany(ctx context.Context, company string, query sapient.ContextGetCompanyParams) (\*sapient.ContextGetCompanyResponse, error)
-- client.Context.Company(ctx context.Context, company string, query sapient.ContextCompanyParams) (\*sapient.ContextCompanyResponse, error)
+- client.Context.GetCompany(ctx context.Context, company string, query githubcomusesapientgosdk.ContextGetCompanyParams) (\*githubcomusesapientgosdk.ContextGetCompanyResponse, error)
+- client.Context.Company(ctx context.Context, company string, query githubcomusesapientgosdk.ContextCompanyParams) (\*githubcomusesapientgosdk.ContextCompanyResponse, error)
# EvalRuns
Response Types:
-- sapient.EvalRunDetail
-- sapient.PublicListMeta
-- sapient.EvalRunGetResponse
-- sapient.EvalRunListResponse
-- sapient.EvalRunDiagnoseResponse
+- githubcomusesapientgosdk.EvalRunDetail
+- githubcomusesapientgosdk.PublicListMeta
+- githubcomusesapientgosdk.EvalRunGetResponse
+- githubcomusesapientgosdk.EvalRunListResponse
+- githubcomusesapientgosdk.EvalRunDiagnoseResponse
Methods:
-- client.EvalRuns.Get(ctx context.Context, runID string) (\*sapient.EvalRunGetResponse, error)
-- client.EvalRuns.List(ctx context.Context, query sapient.EvalRunListParams) (\*sapient.EvalRunListResponse, error)
-- client.EvalRuns.Diagnose(ctx context.Context, body sapient.EvalRunDiagnoseParams) (\*sapient.EvalRunDiagnoseResponse, error)
+- client.EvalRuns.Get(ctx context.Context, runID string) (\*githubcomusesapientgosdk.EvalRunGetResponse, error)
+- client.EvalRuns.List(ctx context.Context, query githubcomusesapientgosdk.EvalRunListParams) (\*githubcomusesapientgosdk.EvalRunListResponse, error)
+- client.EvalRuns.Diagnose(ctx context.Context, body githubcomusesapientgosdk.EvalRunDiagnoseParams) (\*githubcomusesapientgosdk.EvalRunDiagnoseResponse, error)
# Prompts
Response Types:
-- sapient.PromptGenerateFromListResponse
+- githubcomusesapientgosdk.PromptGenerateFromListResponse
Methods:
-- client.Prompts.GenerateFromList(ctx context.Context, body sapient.PromptGenerateFromListParams) (\*sapient.PromptGenerateFromListResponse, error)
+- client.Prompts.GenerateFromList(ctx context.Context, body githubcomusesapientgosdk.PromptGenerateFromListParams) (\*githubcomusesapientgosdk.PromptGenerateFromListResponse, error)
# Workflows
Response Types:
-- sapient.WorkflowResponse
-- sapient.WorkflowRunResponse
+- githubcomusesapientgosdk.WorkflowResponse
+- githubcomusesapientgosdk.WorkflowRunResponse
Methods:
-- client.Workflows.New(ctx context.Context, body sapient.WorkflowNewParams) (\*sapient.WorkflowResponse, error)
-- client.Workflows.Get(ctx context.Context, workflowID string) (\*sapient.WorkflowResponse, error)
-- client.Workflows.Run(ctx context.Context, workflowID string, body sapient.WorkflowRunParams) (\*sapient.WorkflowRunResponse, error)
+- client.Workflows.New(ctx context.Context, body githubcomusesapientgosdk.WorkflowNewParams) (\*githubcomusesapientgosdk.WorkflowResponse, error)
+- client.Workflows.Get(ctx context.Context, workflowID string) (\*githubcomusesapientgosdk.WorkflowResponse, error)
+- client.Workflows.Run(ctx context.Context, workflowID string, body githubcomusesapientgosdk.WorkflowRunParams) (\*githubcomusesapientgosdk.WorkflowRunResponse, error)
# WorkflowRuns
Response Types:
-- sapient.PublicJob
+- githubcomusesapientgosdk.PublicJob
Methods:
-- client.WorkflowRuns.Get(ctx context.Context, runID string) (\*sapient.PublicJob, error)
+- client.WorkflowRuns.Get(ctx context.Context, runID string) (\*githubcomusesapientgosdk.PublicJob, error)
# API
@@ -92,56 +92,56 @@ Methods:
Response Types:
-- sapient.APILeaderboardListCompaniesResponse
+- githubcomusesapientgosdk.APILeaderboardListCompaniesResponse
Methods:
-- client.API.Leaderboard.ListCompanies(ctx context.Context, query sapient.APILeaderboardListCompaniesParams) (\*sapient.APILeaderboardListCompaniesResponse, error)
+- client.API.Leaderboard.ListCompanies(ctx context.Context, query githubcomusesapientgosdk.APILeaderboardListCompaniesParams) (\*githubcomusesapientgosdk.APILeaderboardListCompaniesResponse, error)
### Companies
Response Types:
-- sapient.APILeaderboardCompanyListResponse
+- githubcomusesapientgosdk.APILeaderboardCompanyListResponse
Methods:
-- client.API.Leaderboard.Companies.List(ctx context.Context, query sapient.APILeaderboardCompanyListParams) (\*sapient.APILeaderboardCompanyListResponse, error)
+- client.API.Leaderboard.Companies.List(ctx context.Context, query githubcomusesapientgosdk.APILeaderboardCompanyListParams) (\*githubcomusesapientgosdk.APILeaderboardCompanyListResponse, error)
## APIPerformance
Response Types:
-- sapient.FailureAnalysisSnapshot
-- sapient.ApiapiPerformanceLatestRunsResponse
+- githubcomusesapientgosdk.FailureAnalysisSnapshot
+- githubcomusesapientgosdk.ApiapiPerformanceLatestRunsResponse
Methods:
-- client.API.APIPerformance.FailureAnalysis(ctx context.Context, brandID string, query sapient.APIAPIPerformanceFailureAnalysisParams) (\*sapient.FailureAnalysisSnapshot, error)
-- client.API.APIPerformance.LatestRuns(ctx context.Context, brandID string, query sapient.APIAPIPerformanceLatestRunsParams) (\*sapient.ApiapiPerformanceLatestRunsResponse, error)
+- client.API.APIPerformance.FailureAnalysis(ctx context.Context, brandID string, query githubcomusesapientgosdk.APIAPIPerformanceFailureAnalysisParams) (\*githubcomusesapientgosdk.FailureAnalysisSnapshot, error)
+- client.API.APIPerformance.LatestRuns(ctx context.Context, brandID string, query githubcomusesapientgosdk.APIAPIPerformanceLatestRunsParams) (\*githubcomusesapientgosdk.ApiapiPerformanceLatestRunsResponse, error)
## Prompts
Response Types:
-- sapient.APIPromptNewBatchResponse
-- sapient.APIPromptBatchResponse
+- githubcomusesapientgosdk.APIPromptNewBatchResponse
+- githubcomusesapientgosdk.APIPromptBatchResponse
Methods:
-- client.API.Prompts.NewBatch(ctx context.Context, body sapient.APIPromptNewBatchParams) (\*sapient.APIPromptNewBatchResponse, error)
-- client.API.Prompts.Batch(ctx context.Context, body sapient.APIPromptBatchParams) (\*sapient.APIPromptBatchResponse, error)
+- client.API.Prompts.NewBatch(ctx context.Context, body githubcomusesapientgosdk.APIPromptNewBatchParams) (\*githubcomusesapientgosdk.APIPromptNewBatchResponse, error)
+- client.API.Prompts.Batch(ctx context.Context, body githubcomusesapientgosdk.APIPromptBatchParams) (\*githubcomusesapientgosdk.APIPromptBatchResponse, error)
## Jobs
Response Types:
-- sapient.APIJobListJobsResponse
-- sapient.APIJobListResponse
+- githubcomusesapientgosdk.APIJobListJobsResponse
+- githubcomusesapientgosdk.APIJobListResponse
Methods:
-- client.API.Jobs.ListJobs(ctx context.Context, query sapient.APIJobListJobsParams) (\*sapient.APIJobListJobsResponse, error)
-- client.API.Jobs.GetJob(ctx context.Context, jobID string) (\*sapient.PublicJob, error)
-- client.API.Jobs.List(ctx context.Context, query sapient.APIJobListParams) (\*sapient.APIJobListResponse, error)
-- client.API.Jobs.Get(ctx context.Context, jobID string) (\*sapient.PublicJob, error)
+- client.API.Jobs.ListJobs(ctx context.Context, query githubcomusesapientgosdk.APIJobListJobsParams) (\*githubcomusesapientgosdk.APIJobListJobsResponse, error)
+- client.API.Jobs.GetJob(ctx context.Context, jobID string) (\*githubcomusesapientgosdk.PublicJob, error)
+- client.API.Jobs.List(ctx context.Context, query githubcomusesapientgosdk.APIJobListParams) (\*githubcomusesapientgosdk.APIJobListResponse, error)
+- client.API.Jobs.Get(ctx context.Context, jobID string) (\*githubcomusesapientgosdk.PublicJob, error)
diff --git a/apiapiperformance.go b/apiapiperformance.go
index 704d08f..0ddf591 100644
--- a/apiapiperformance.go
+++ b/apiapiperformance.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/apiapiperformance_test.go b/apiapiperformance_test.go
index d05d5de..8cd24fa 100644
--- a/apiapiperformance_test.go
+++ b/apiapiperformance_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,7 +22,7 @@ func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
@@ -30,12 +30,12 @@ func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
_, err := client.API.APIPerformance.FailureAnalysis(
context.TODO(),
"brand_id",
- sapient.APIAPIPerformanceFailureAnalysisParams{
- IntegrationID: sapient.String("integration_id"),
+ githubcomusesapientgosdk.APIAPIPerformanceFailureAnalysisParams{
+ IntegrationID: githubcomusesapientgosdk.String("integration_id"),
},
)
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -52,7 +52,7 @@ func TestAPIAPIPerformanceLatestRunsWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
@@ -60,12 +60,12 @@ func TestAPIAPIPerformanceLatestRunsWithOptionalParams(t *testing.T) {
_, err := client.API.APIPerformance.LatestRuns(
context.TODO(),
"brand_id",
- sapient.APIAPIPerformanceLatestRunsParams{
- Limit: sapient.Int(1),
+ githubcomusesapientgosdk.APIAPIPerformanceLatestRunsParams{
+ Limit: githubcomusesapientgosdk.Int(1),
},
)
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/apijob.go b/apijob.go
index 89687d0..87cccca 100644
--- a/apijob.go
+++ b/apijob.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/apijob_test.go b/apijob_test.go
index 4180ffc..d022bfa 100644
--- a/apijob_test.go
+++ b/apijob_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,18 +22,18 @@ func TestAPIJobListJobsWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Jobs.ListJobs(context.TODO(), sapient.APIJobListJobsParams{
- Limit: sapient.Int(1),
- Status: sapient.String("status"),
- Type: sapient.String("type"),
+ _, err := client.API.Jobs.ListJobs(context.TODO(), githubcomusesapientgosdk.APIJobListJobsParams{
+ Limit: githubcomusesapientgosdk.Int(1),
+ Status: githubcomusesapientgosdk.String("status"),
+ Type: githubcomusesapientgosdk.String("type"),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -50,14 +50,14 @@ func TestAPIJobGetJob(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Jobs.GetJob(context.TODO(), "job_id")
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -74,18 +74,18 @@ func TestAPIJobListWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Jobs.List(context.TODO(), sapient.APIJobListParams{
- Limit: sapient.Int(1),
- Status: sapient.String("status"),
- Type: sapient.String("type"),
+ _, err := client.API.Jobs.List(context.TODO(), githubcomusesapientgosdk.APIJobListParams{
+ Limit: githubcomusesapientgosdk.Int(1),
+ Status: githubcomusesapientgosdk.String("status"),
+ Type: githubcomusesapientgosdk.String("type"),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -102,14 +102,14 @@ func TestAPIJobGet(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Jobs.Get(context.TODO(), "job_id")
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/apileaderboard.go b/apileaderboard.go
index 4fca089..7ac2289 100644
--- a/apileaderboard.go
+++ b/apileaderboard.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/apileaderboard_test.go b/apileaderboard_test.go
index 7c53aa1..af243d6 100644
--- a/apileaderboard_test.go
+++ b/apileaderboard_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,17 +22,17 @@ func TestAPILeaderboardListCompaniesWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Leaderboard.ListCompanies(context.TODO(), sapient.APILeaderboardListCompaniesParams{
- Category: sapient.String("category"),
- Limit: sapient.Int(1),
+ _, err := client.API.Leaderboard.ListCompanies(context.TODO(), githubcomusesapientgosdk.APILeaderboardListCompaniesParams{
+ Category: githubcomusesapientgosdk.String("category"),
+ Limit: githubcomusesapientgosdk.Int(1),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/apileaderboardcompany.go b/apileaderboardcompany.go
index 7da0236..299778d 100644
--- a/apileaderboardcompany.go
+++ b/apileaderboardcompany.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/apileaderboardcompany_test.go b/apileaderboardcompany_test.go
index e37d3fe..fc8a3d5 100644
--- a/apileaderboardcompany_test.go
+++ b/apileaderboardcompany_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,17 +22,17 @@ func TestAPILeaderboardCompanyListWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Leaderboard.Companies.List(context.TODO(), sapient.APILeaderboardCompanyListParams{
- Category: sapient.String("category"),
- Limit: sapient.Int(1),
+ _, err := client.API.Leaderboard.Companies.List(context.TODO(), githubcomusesapientgosdk.APILeaderboardCompanyListParams{
+ Category: githubcomusesapientgosdk.String("category"),
+ Limit: githubcomusesapientgosdk.Int(1),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/apiprompt.go b/apiprompt.go
index 5f318c9..afd65ab 100644
--- a/apiprompt.go
+++ b/apiprompt.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/apiprompt_test.go b/apiprompt_test.go
index dd8511d..05c321c 100644
--- a/apiprompt_test.go
+++ b/apiprompt_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,13 +22,13 @@ func TestAPIPromptNewBatch(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Prompts.NewBatch(context.TODO(), sapient.APIPromptNewBatchParams{
- Prompts: []sapient.APIPromptNewBatchParamsPrompt{{
+ _, err := client.API.Prompts.NewBatch(context.TODO(), githubcomusesapientgosdk.APIPromptNewBatchParams{
+ Prompts: []githubcomusesapientgosdk.APIPromptNewBatchParamsPrompt{{
LanguageID: "language_id",
RegionID: "region_id",
Text: "text",
@@ -37,7 +37,7 @@ func TestAPIPromptNewBatch(t *testing.T) {
}},
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -54,13 +54,13 @@ func TestAPIPromptBatch(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Prompts.Batch(context.TODO(), sapient.APIPromptBatchParams{
- Prompts: []sapient.APIPromptBatchParamsPrompt{{
+ _, err := client.API.Prompts.Batch(context.TODO(), githubcomusesapientgosdk.APIPromptBatchParams{
+ Prompts: []githubcomusesapientgosdk.APIPromptBatchParamsPrompt{{
LanguageID: "language_id",
RegionID: "region_id",
Text: "text",
@@ -69,7 +69,7 @@ func TestAPIPromptBatch(t *testing.T) {
}},
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/auth.go b/auth.go
index 3657f38..9273082 100644
--- a/auth.go
+++ b/auth.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/auth_test.go b/auth_test.go
index 1386c6c..5798d1c 100644
--- a/auth_test.go
+++ b/auth_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,14 +22,14 @@ func TestAuthGetStatus(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Auth.GetStatus(context.TODO())
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -46,14 +46,14 @@ func TestAuthStatus(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Auth.Status(context.TODO())
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/client.go b/client.go
index 624fb19..3d7aaf7 100644
--- a/client.go
+++ b/client.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/client_test.go b/client_test.go
index 8d8840d..a93667b 100644
--- a/client_test.go
+++ b/client_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -25,7 +25,7 @@ func (t *closureTransport) RoundTrip(req *http.Request) (*http.Response, error)
func TestUserAgentHeader(t *testing.T) {
var userAgent string
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -46,7 +46,7 @@ func TestUserAgentHeader(t *testing.T) {
func TestRetryAfter(t *testing.T) {
retryCountHeaders := make([]string, 0)
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -80,7 +80,7 @@ func TestRetryAfter(t *testing.T) {
func TestDeleteRetryCountHeader(t *testing.T) {
retryCountHeaders := make([]string, 0)
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -110,7 +110,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
func TestOverwriteRetryCountHeader(t *testing.T) {
retryCountHeaders := make([]string, 0)
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -140,7 +140,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
func TestRetryAfterMs(t *testing.T) {
attempts := 0
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -166,7 +166,7 @@ func TestRetryAfterMs(t *testing.T) {
}
func TestContextCancel(t *testing.T) {
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -186,7 +186,7 @@ func TestContextCancel(t *testing.T) {
}
func TestContextCancelDelay(t *testing.T) {
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
@@ -214,7 +214,7 @@ func TestContextDeadline(t *testing.T) {
defer cancel()
go func() {
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
diff --git a/context.go b/context.go
index c760d17..6187a54 100644
--- a/context.go
+++ b/context.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/context_test.go b/context_test.go
index 00fd1ba..31db0ea 100644
--- a/context_test.go
+++ b/context_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,7 +22,7 @@ func TestContextGetCompanyWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
@@ -30,14 +30,14 @@ func TestContextGetCompanyWithOptionalParams(t *testing.T) {
_, err := client.Context.GetCompany(
context.TODO(),
"company",
- sapient.ContextGetCompanyParams{
- For: sapient.String("for"),
- Format: sapient.ContextGetCompanyParamsFormatJson,
- Since: sapient.String("since"),
+ githubcomusesapientgosdk.ContextGetCompanyParams{
+ For: githubcomusesapientgosdk.String("for"),
+ Format: githubcomusesapientgosdk.ContextGetCompanyParamsFormatJson,
+ Since: githubcomusesapientgosdk.String("since"),
},
)
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -54,7 +54,7 @@ func TestContextCompanyWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
@@ -62,14 +62,14 @@ func TestContextCompanyWithOptionalParams(t *testing.T) {
_, err := client.Context.Company(
context.TODO(),
"company",
- sapient.ContextCompanyParams{
- For: sapient.String("for"),
- Format: sapient.ContextCompanyParamsFormatJson,
- Since: sapient.String("since"),
+ githubcomusesapientgosdk.ContextCompanyParams{
+ For: githubcomusesapientgosdk.String("for"),
+ Format: githubcomusesapientgosdk.ContextCompanyParamsFormatJson,
+ Since: githubcomusesapientgosdk.String("since"),
},
)
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/default_http_client.go b/default_http_client.go
index 5729f5d..e519c0c 100644
--- a/default_http_client.go
+++ b/default_http_client.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"net/http"
diff --git a/evalrun.go b/evalrun.go
index 215c469..1a1cdcc 100644
--- a/evalrun.go
+++ b/evalrun.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/evalrun_test.go b/evalrun_test.go
index cf8d349..fdc8fba 100644
--- a/evalrun_test.go
+++ b/evalrun_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,14 +22,14 @@ func TestEvalRunGet(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.EvalRuns.Get(context.TODO(), "run_id")
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -46,18 +46,18 @@ func TestEvalRunListWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.EvalRuns.List(context.TODO(), sapient.EvalRunListParams{
+ _, err := client.EvalRuns.List(context.TODO(), githubcomusesapientgosdk.EvalRunListParams{
Company: "company",
- Limit: sapient.Int(1),
- Since: sapient.String("since"),
+ Limit: githubcomusesapientgosdk.Int(1),
+ Since: githubcomusesapientgosdk.String("since"),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -74,20 +74,20 @@ func TestEvalRunDiagnoseWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.EvalRuns.Diagnose(context.TODO(), sapient.EvalRunDiagnoseParams{
+ _, err := client.EvalRuns.Diagnose(context.TODO(), githubcomusesapientgosdk.EvalRunDiagnoseParams{
Company: "company",
- Format: sapient.EvalRunDiagnoseParamsFormatJson,
- IncludeExamples: sapient.Bool(true),
- MaxExamples: sapient.Int(1),
- Since: sapient.String("since"),
+ Format: githubcomusesapientgosdk.EvalRunDiagnoseParamsFormatJson,
+ IncludeExamples: githubcomusesapientgosdk.Bool(true),
+ MaxExamples: githubcomusesapientgosdk.Int(1),
+ Since: githubcomusesapientgosdk.String("since"),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/field.go b/field.go
index 9a84921..5ca907f 100644
--- a/field.go
+++ b/field.go
@@ -1,4 +1,4 @@
-package sapient
+package githubcomusesapientgosdk
import (
"github.com/usesapient/go-sdk/packages/param"
diff --git a/prompt.go b/prompt.go
index 8f48c76..c5643be 100644
--- a/prompt.go
+++ b/prompt.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/prompt_test.go b/prompt_test.go
index 7c3f0ad..fbc0d71 100644
--- a/prompt_test.go
+++ b/prompt_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,26 +22,26 @@ func TestPromptGenerateFromListWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.Prompts.GenerateFromList(context.TODO(), sapient.PromptGenerateFromListParams{
- Items: []sapient.PromptGenerateFromListParamsItem{{
+ _, err := client.Prompts.GenerateFromList(context.TODO(), githubcomusesapientgosdk.PromptGenerateFromListParams{
+ Items: []githubcomusesapientgosdk.PromptGenerateFromListParamsItem{{
Name: "name",
- Category: sapient.String("category"),
- Domain: sapient.String("domain"),
- Notes: sapient.String("notes"),
+ Category: githubcomusesapientgosdk.String("category"),
+ Domain: githubcomusesapientgosdk.String("domain"),
+ Notes: githubcomusesapientgosdk.String("notes"),
}},
- CountPerItem: sapient.Int(1),
- Goal: sapient.String("goal"),
- IncludeAgentTasks: sapient.Bool(true),
- Language: sapient.String("language"),
- Region: sapient.String("region"),
+ CountPerItem: githubcomusesapientgosdk.Int(1),
+ Goal: githubcomusesapientgosdk.String("goal"),
+ IncludeAgentTasks: githubcomusesapientgosdk.Bool(true),
+ Language: githubcomusesapientgosdk.String("language"),
+ Region: githubcomusesapientgosdk.String("region"),
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/status.go b/status.go
index f013377..dc2e5f0 100644
--- a/status.go
+++ b/status.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/status_test.go b/status_test.go
index 1270fe1..0a1d611 100644
--- a/status_test.go
+++ b/status_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,13 +22,13 @@ func TestStatusGet(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Status.Get(context.TODO())
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -45,13 +45,13 @@ func TestStatusGet(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Status.Get(context.TODO())
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/usage_test.go b/usage_test.go
index f324924..02f83b1 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -21,7 +21,7 @@ func TestUsage(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
diff --git a/workflow.go b/workflow.go
index 670a6e0..1d3e5c1 100644
--- a/workflow.go
+++ b/workflow.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/workflow_test.go b/workflow_test.go
index 598d029..67b131d 100644
--- a/workflow_test.go
+++ b/workflow_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,14 +22,14 @@ func TestWorkflowNewWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
- _, err := client.Workflows.New(context.TODO(), sapient.WorkflowNewParams{
+ _, err := client.Workflows.New(context.TODO(), githubcomusesapientgosdk.WorkflowNewParams{
Name: "name",
- Description: sapient.String("description"),
+ Description: githubcomusesapientgosdk.String("description"),
Metadata: map[string]any{
"foo": "bar",
},
@@ -38,7 +38,7 @@ func TestWorkflowNewWithOptionalParams(t *testing.T) {
}},
})
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -55,14 +55,14 @@ func TestWorkflowGet(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Workflows.Get(context.TODO(), "workflow_id")
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
@@ -79,7 +79,7 @@ func TestWorkflowRunWithOptionalParams(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
@@ -87,16 +87,16 @@ func TestWorkflowRunWithOptionalParams(t *testing.T) {
_, err := client.Workflows.Run(
context.TODO(),
"workflow_id",
- sapient.WorkflowRunParams{
+ githubcomusesapientgosdk.WorkflowRunParams{
Input: map[string]any{
"foo": "bar",
},
- Watch: sapient.Bool(true),
- WorkflowID: sapient.String("workflow_id"),
+ Watch: githubcomusesapientgosdk.Bool(true),
+ WorkflowID: githubcomusesapientgosdk.String("workflow_id"),
},
)
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
diff --git a/workflowrun.go b/workflowrun.go
index 3e6ccc4..8065549 100644
--- a/workflowrun.go
+++ b/workflowrun.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient
+package githubcomusesapientgosdk
import (
"context"
diff --git a/workflowrun_test.go b/workflowrun_test.go
index b505a93..45296f0 100644
--- a/workflowrun_test.go
+++ b/workflowrun_test.go
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package sapient_test
+package githubcomusesapientgosdk_test
import (
"context"
@@ -22,14 +22,14 @@ func TestWorkflowRunGet(t *testing.T) {
if !testutil.CheckTestServer(t, baseURL) {
return
}
- client := sapient.NewClient(
+ client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.WorkflowRuns.Get(context.TODO(), "run_id")
if err != nil {
- var apierr *sapient.Error
+ var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
t.Log(string(apierr.DumpRequest(true)))
}
From 81040cae143638e659bd7f46e915834389621b73 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 15 May 2026 18:30:18 +0000
Subject: [PATCH 09/11] feat(api): api update
---
.stats.yml | 2 +-
apiapiperformance_test.go | 2 --
apijob_test.go | 4 ----
apileaderboard_test.go | 1 -
apileaderboardcompany_test.go | 1 -
apiprompt_test.go | 2 --
auth_test.go | 2 --
context_test.go | 2 --
evalrun_test.go | 3 ---
option/requestoption.go | 2 +-
prompt_test.go | 1 -
workflow_test.go | 3 ---
workflowrun_test.go | 1 -
13 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 7490357..724aeae 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 17
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-19772e79be7e030ebf8bd823aae76ff7e366c8f873aab056487dcc912ea5a6b4.yml
-openapi_spec_hash: d786bf9a6956b2e85340b6869646ee38
+openapi_spec_hash: 66991f689a0b4d5212ca02ce34c24260
config_hash: aa8a070cfe69cecc0fe6f03da5935bd3
diff --git a/apiapiperformance_test.go b/apiapiperformance_test.go
index 8cd24fa..105b308 100644
--- a/apiapiperformance_test.go
+++ b/apiapiperformance_test.go
@@ -24,7 +24,6 @@ func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.APIPerformance.FailureAnalysis(
@@ -54,7 +53,6 @@ func TestAPIAPIPerformanceLatestRunsWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.APIPerformance.LatestRuns(
diff --git a/apijob_test.go b/apijob_test.go
index d022bfa..564c136 100644
--- a/apijob_test.go
+++ b/apijob_test.go
@@ -24,7 +24,6 @@ func TestAPIJobListJobsWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Jobs.ListJobs(context.TODO(), githubcomusesapientgosdk.APIJobListJobsParams{
@@ -52,7 +51,6 @@ func TestAPIJobGetJob(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Jobs.GetJob(context.TODO(), "job_id")
@@ -76,7 +74,6 @@ func TestAPIJobListWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Jobs.List(context.TODO(), githubcomusesapientgosdk.APIJobListParams{
@@ -104,7 +101,6 @@ func TestAPIJobGet(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Jobs.Get(context.TODO(), "job_id")
diff --git a/apileaderboard_test.go b/apileaderboard_test.go
index af243d6..b308c34 100644
--- a/apileaderboard_test.go
+++ b/apileaderboard_test.go
@@ -24,7 +24,6 @@ func TestAPILeaderboardListCompaniesWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Leaderboard.ListCompanies(context.TODO(), githubcomusesapientgosdk.APILeaderboardListCompaniesParams{
diff --git a/apileaderboardcompany_test.go b/apileaderboardcompany_test.go
index fc8a3d5..d22e71f 100644
--- a/apileaderboardcompany_test.go
+++ b/apileaderboardcompany_test.go
@@ -24,7 +24,6 @@ func TestAPILeaderboardCompanyListWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Leaderboard.Companies.List(context.TODO(), githubcomusesapientgosdk.APILeaderboardCompanyListParams{
diff --git a/apiprompt_test.go b/apiprompt_test.go
index 05c321c..93a7e49 100644
--- a/apiprompt_test.go
+++ b/apiprompt_test.go
@@ -24,7 +24,6 @@ func TestAPIPromptNewBatch(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Prompts.NewBatch(context.TODO(), githubcomusesapientgosdk.APIPromptNewBatchParams{
@@ -56,7 +55,6 @@ func TestAPIPromptBatch(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.API.Prompts.Batch(context.TODO(), githubcomusesapientgosdk.APIPromptBatchParams{
diff --git a/auth_test.go b/auth_test.go
index 5798d1c..15d3eb4 100644
--- a/auth_test.go
+++ b/auth_test.go
@@ -24,7 +24,6 @@ func TestAuthGetStatus(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Auth.GetStatus(context.TODO())
@@ -48,7 +47,6 @@ func TestAuthStatus(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Auth.Status(context.TODO())
diff --git a/context_test.go b/context_test.go
index 31db0ea..4152509 100644
--- a/context_test.go
+++ b/context_test.go
@@ -24,7 +24,6 @@ func TestContextGetCompanyWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Context.GetCompany(
@@ -56,7 +55,6 @@ func TestContextCompanyWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Context.Company(
diff --git a/evalrun_test.go b/evalrun_test.go
index fdc8fba..18145bc 100644
--- a/evalrun_test.go
+++ b/evalrun_test.go
@@ -24,7 +24,6 @@ func TestEvalRunGet(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.EvalRuns.Get(context.TODO(), "run_id")
@@ -48,7 +47,6 @@ func TestEvalRunListWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.EvalRuns.List(context.TODO(), githubcomusesapientgosdk.EvalRunListParams{
@@ -76,7 +74,6 @@ func TestEvalRunDiagnoseWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.EvalRuns.Diagnose(context.TODO(), githubcomusesapientgosdk.EvalRunDiagnoseParams{
diff --git a/option/requestoption.go b/option/requestoption.go
index 2778b13..26f81a7 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -270,7 +270,7 @@ func WithEnvironmentProduction() RequestOption {
func WithBearerToken(value string) RequestOption {
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
r.BearerToken = value
- return r.Apply(WithHeader("authorization", fmt.Sprintf("Bearer %s", r.BearerToken)))
+ return nil
})
}
diff --git a/prompt_test.go b/prompt_test.go
index fbc0d71..fb712fb 100644
--- a/prompt_test.go
+++ b/prompt_test.go
@@ -24,7 +24,6 @@ func TestPromptGenerateFromListWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Prompts.GenerateFromList(context.TODO(), githubcomusesapientgosdk.PromptGenerateFromListParams{
diff --git a/workflow_test.go b/workflow_test.go
index 67b131d..4a2dfc3 100644
--- a/workflow_test.go
+++ b/workflow_test.go
@@ -24,7 +24,6 @@ func TestWorkflowNewWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Workflows.New(context.TODO(), githubcomusesapientgosdk.WorkflowNewParams{
@@ -57,7 +56,6 @@ func TestWorkflowGet(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Workflows.Get(context.TODO(), "workflow_id")
@@ -81,7 +79,6 @@ func TestWorkflowRunWithOptionalParams(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.Workflows.Run(
diff --git a/workflowrun_test.go b/workflowrun_test.go
index 45296f0..039874e 100644
--- a/workflowrun_test.go
+++ b/workflowrun_test.go
@@ -24,7 +24,6 @@ func TestWorkflowRunGet(t *testing.T) {
}
client := githubcomusesapientgosdk.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
option.WithAPIKey("My API Key"),
)
_, err := client.WorkflowRuns.Get(context.TODO(), "run_id")
From 08e2481a51e0c9078c6116ec07a2808a97d854f2 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:18:37 +0000
Subject: [PATCH 10/11] feat: Update Sapient public OpenAPI spec
---
.stats.yml | 6 +-
README.md | 2 +-
SECURITY.md | 4 +
api.go | 34 --
api.md | 138 +++--
apiapiperformance.go | 168 ------
apijob.go | 110 ----
apileaderboard.go | 61 --
apileaderboard_test.go | 40 --
apileaderboardcompany.go | 59 --
apiperformance.go | 42 ++
apiperformanceevaluationconfig.go | 142 +++++
apiperformanceevaluationconfig_test.go | 73 +++
apiperformanceinterface.go | 81 +++
...test.go => apiperformanceinterface_test.go | 7 +-
apiperformanceoperation.go | 353 +++++++++++
apiperformanceoperation_test.go | 152 +++++
apiperformanceoperationprompt.go | 141 +++++
...o => apiperformanceoperationprompt_test.go | 30 +-
apiperformanceplatform.go | 158 +++++
..._test.go => apiperformanceplatform_test.go | 25 +-
apiperformanceprompt.go | 155 +++++
...ow_test.go => apiperformanceprompt_test.go | 43 +-
apiperformancerun.go | 346 +++++++++++
...rompt_test.go => apiperformancerun_test.go | 26 +-
apiperformanceusecase.go | 304 ++++++++++
apiperformanceusecase_test.go | 141 +++++
apiprompt.go | 148 -----
auth.go | 18 +-
auth_test.go | 23 -
client.go | 38 +-
context.go | 312 ----------
evalrun.go | 319 ----------
evalrun_test.go | 93 ---
internal/requestconfig/requestconfig.go | 2 -
option/requestoption.go | 12 +-
prompt.go | 569 ++++++++++++++++--
prompt_test.go | 128 +++-
promptplatform.go | 41 ++
workflowrun_test.go => promptplatform_test.go | 4 +-
prompttopic.go | 170 ++++++
apijob_test.go => prompttopic_test.go | 30 +-
status.go | 16 +-
status_test.go | 23 -
workflow.go | 149 -----
workflowrun.go | 82 ---
46 files changed, 3114 insertions(+), 1904 deletions(-)
delete mode 100644 api.go
delete mode 100644 apiapiperformance.go
delete mode 100644 apijob.go
delete mode 100644 apileaderboard.go
delete mode 100644 apileaderboard_test.go
delete mode 100644 apileaderboardcompany.go
create mode 100644 apiperformance.go
create mode 100644 apiperformanceevaluationconfig.go
create mode 100644 apiperformanceevaluationconfig_test.go
create mode 100644 apiperformanceinterface.go
rename apileaderboardcompany_test.go => apiperformanceinterface_test.go (73%)
create mode 100644 apiperformanceoperation.go
create mode 100644 apiperformanceoperation_test.go
create mode 100644 apiperformanceoperationprompt.go
rename context_test.go => apiperformanceoperationprompt_test.go (66%)
create mode 100644 apiperformanceplatform.go
rename apiapiperformance_test.go => apiperformanceplatform_test.go (70%)
create mode 100644 apiperformanceprompt.go
rename workflow_test.go => apiperformanceprompt_test.go (71%)
create mode 100644 apiperformancerun.go
rename apiprompt_test.go => apiperformancerun_test.go (64%)
create mode 100644 apiperformanceusecase.go
create mode 100644 apiperformanceusecase_test.go
delete mode 100644 apiprompt.go
delete mode 100644 context.go
delete mode 100644 evalrun.go
delete mode 100644 evalrun_test.go
create mode 100644 promptplatform.go
rename workflowrun_test.go => promptplatform_test.go (89%)
create mode 100644 prompttopic.go
rename apijob_test.go => prompttopic_test.go (75%)
delete mode 100644 workflow.go
delete mode 100644 workflowrun.go
diff --git a/.stats.yml b/.stats.yml
index 724aeae..fce9f8a 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 17
+configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sapient/sapient-19772e79be7e030ebf8bd823aae76ff7e366c8f873aab056487dcc912ea5a6b4.yml
-openapi_spec_hash: 66991f689a0b4d5212ca02ce34c24260
-config_hash: aa8a070cfe69cecc0fe6f03da5935bd3
+openapi_spec_hash: 92ead540a4d8d32f4411acf9de7fba21
+config_hash: 67f1164874b1569a9845b46e7bfcc132
diff --git a/README.md b/README.md
index 8ba132c..29766bd 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
-The Sapient Go library provides convenient access to the Sapient REST API
+The Sapient Go library provides convenient access to the [Sapient REST API](https://docs.usesapient.com)
from applications written in Go.
It is generated with [Stainless](https://www.stainless.com/).
diff --git a/SECURITY.md b/SECURITY.md
index e9c1ae4..1970fe7 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -18,6 +18,10 @@ before making any information public.
If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Sapient, please follow the respective company's security reporting guidelines.
+### Sapient Terms and Policies
+
+Please contact support@usesapient.com for any questions or concerns regarding the security of our services.
+
---
Thank you for helping us keep the SDKs and systems they interact with secure.
diff --git a/api.go b/api.go
deleted file mode 100644
index 810e9c5..0000000
--- a/api.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "github.com/usesapient/go-sdk/option"
-)
-
-// APIService contains methods and other services that help with interacting with
-// the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewAPIService] method instead.
-type APIService struct {
- options []option.RequestOption
- Leaderboard APILeaderboardService
- APIPerformance APIAPIPerformanceService
- Prompts APIPromptService
- Jobs APIJobService
-}
-
-// NewAPIService generates a new service that applies the given options to each
-// request. These options are applied after the parent client's options (if there
-// is one), and before any request-specific options.
-func NewAPIService(opts ...option.RequestOption) (r APIService) {
- r = APIService{}
- r.options = opts
- r.Leaderboard = NewAPILeaderboardService(opts...)
- r.APIPerformance = NewAPIAPIPerformanceService(opts...)
- r.Prompts = NewAPIPromptService(opts...)
- r.Jobs = NewAPIJobService(opts...)
- return
-}
diff --git a/api.md b/api.md
index 2a3918a..1bbdd67 100644
--- a/api.md
+++ b/api.md
@@ -2,146 +2,172 @@
Response Types:
-- githubcomusesapientgosdk.StatusGetResponse
- githubcomusesapientgosdk.StatusGetResponse
Methods:
-- client.Status.Get(ctx context.Context) (\*githubcomusesapientgosdk.StatusGetResponse, error)
- client.Status.Get(ctx context.Context) (\*githubcomusesapientgosdk.StatusGetResponse, error)
# Auth
Response Types:
-- githubcomusesapientgosdk.AuthGetStatusResponse
- githubcomusesapientgosdk.AuthStatusResponse
Methods:
-- client.Auth.GetStatus(ctx context.Context) (\*githubcomusesapientgosdk.AuthGetStatusResponse, error)
- client.Auth.Status(ctx context.Context) (\*githubcomusesapientgosdk.AuthStatusResponse, error)
-# Context
+# Prompts
Response Types:
-- githubcomusesapientgosdk.EvalRunSummary
-- githubcomusesapientgosdk.PublicCompany
-- githubcomusesapientgosdk.PublicEndpoint
-- githubcomusesapientgosdk.ContextGetCompanyResponse
-- githubcomusesapientgosdk.ContextCompanyResponse
+- githubcomusesapientgosdk.PromptNewResponse
+- githubcomusesapientgosdk.PromptGetResponse
+- githubcomusesapientgosdk.PromptUpdateResponse
+- githubcomusesapientgosdk.PromptListResponse
+- githubcomusesapientgosdk.PromptDeleteResponse
Methods:
-- client.Context.GetCompany(ctx context.Context, company string, query githubcomusesapientgosdk.ContextGetCompanyParams) (\*githubcomusesapientgosdk.ContextGetCompanyResponse, error)
-- client.Context.Company(ctx context.Context, company string, query githubcomusesapientgosdk.ContextCompanyParams) (\*githubcomusesapientgosdk.ContextCompanyResponse, error)
+- client.Prompts.New(ctx context.Context, body githubcomusesapientgosdk.PromptNewParams) (\*githubcomusesapientgosdk.PromptNewResponse, error)
+- client.Prompts.Get(ctx context.Context, promptID string) (\*githubcomusesapientgosdk.PromptGetResponse, error)
+- 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)
-# EvalRuns
+## Topics
Response Types:
-- githubcomusesapientgosdk.EvalRunDetail
-- githubcomusesapientgosdk.PublicListMeta
-- githubcomusesapientgosdk.EvalRunGetResponse
-- githubcomusesapientgosdk.EvalRunListResponse
-- githubcomusesapientgosdk.EvalRunDiagnoseResponse
+- githubcomusesapientgosdk.PromptTopicNewResponse
+- githubcomusesapientgosdk.PromptTopicUpdateResponse
+- githubcomusesapientgosdk.PromptTopicListResponse
+- githubcomusesapientgosdk.PromptTopicDeleteResponse
Methods:
-- client.EvalRuns.Get(ctx context.Context, runID string) (\*githubcomusesapientgosdk.EvalRunGetResponse, error)
-- client.EvalRuns.List(ctx context.Context, query githubcomusesapientgosdk.EvalRunListParams) (\*githubcomusesapientgosdk.EvalRunListResponse, error)
-- client.EvalRuns.Diagnose(ctx context.Context, body githubcomusesapientgosdk.EvalRunDiagnoseParams) (\*githubcomusesapientgosdk.EvalRunDiagnoseResponse, error)
+- client.Prompts.Topics.New(ctx context.Context, body githubcomusesapientgosdk.PromptTopicNewParams) (\*githubcomusesapientgosdk.PromptTopicNewResponse, error)
+- client.Prompts.Topics.Update(ctx context.Context, topicID string, body githubcomusesapientgosdk.PromptTopicUpdateParams) (\*githubcomusesapientgosdk.PromptTopicUpdateResponse, error)
+- client.Prompts.Topics.List(ctx context.Context) (\*[]githubcomusesapientgosdk.PromptTopicListResponse, error)
+- client.Prompts.Topics.Delete(ctx context.Context, topicID string) (\*githubcomusesapientgosdk.PromptTopicDeleteResponse, error)
-# Prompts
+## Platforms
Response Types:
-- githubcomusesapientgosdk.PromptGenerateFromListResponse
+- githubcomusesapientgosdk.PromptPlatformListResponse
Methods:
-- client.Prompts.GenerateFromList(ctx context.Context, body githubcomusesapientgosdk.PromptGenerateFromListParams) (\*githubcomusesapientgosdk.PromptGenerateFromListResponse, error)
+- client.Prompts.Platforms.List(ctx context.Context) (\*githubcomusesapientgosdk.PromptPlatformListResponse, error)
+
+# APIPerformance
-# Workflows
+## Platforms
Response Types:
-- githubcomusesapientgosdk.WorkflowResponse
-- githubcomusesapientgosdk.WorkflowRunResponse
+- githubcomusesapientgosdk.APIPerformancePlatformListResponse
+- githubcomusesapientgosdk.APIPerformancePlatformEstimateCostResponse
Methods:
-- client.Workflows.New(ctx context.Context, body githubcomusesapientgosdk.WorkflowNewParams) (\*githubcomusesapientgosdk.WorkflowResponse, error)
-- client.Workflows.Get(ctx context.Context, workflowID string) (\*githubcomusesapientgosdk.WorkflowResponse, error)
-- client.Workflows.Run(ctx context.Context, workflowID string, body githubcomusesapientgosdk.WorkflowRunParams) (\*githubcomusesapientgosdk.WorkflowRunResponse, error)
+- client.APIPerformance.Platforms.List(ctx context.Context) (\*githubcomusesapientgosdk.APIPerformancePlatformListResponse, error)
+- client.APIPerformance.Platforms.EstimateCost(ctx context.Context, body githubcomusesapientgosdk.APIPerformancePlatformEstimateCostParams) (\*githubcomusesapientgosdk.APIPerformancePlatformEstimateCostResponse, error)
-# WorkflowRuns
+## Interfaces
Response Types:
-- githubcomusesapientgosdk.PublicJob
+- githubcomusesapientgosdk.APIPerformanceInterfaceListResponse
Methods:
-- client.WorkflowRuns.Get(ctx context.Context, runID string) (\*githubcomusesapientgosdk.PublicJob, error)
+- client.APIPerformance.Interfaces.List(ctx context.Context) (\*githubcomusesapientgosdk.APIPerformanceInterfaceListResponse, error)
+
+## EvaluationConfig
+
+Response Types:
+
+- githubcomusesapientgosdk.APIPerformanceEvaluationConfigGetResponse
+- githubcomusesapientgosdk.APIPerformanceEvaluationConfigUpdateResponse
+
+Methods:
-# API
+- client.APIPerformance.EvaluationConfig.Get(ctx context.Context, query githubcomusesapientgosdk.APIPerformanceEvaluationConfigGetParams) (\*githubcomusesapientgosdk.APIPerformanceEvaluationConfigGetResponse, error)
+- client.APIPerformance.EvaluationConfig.Update(ctx context.Context, body githubcomusesapientgosdk.APIPerformanceEvaluationConfigUpdateParams) (\*githubcomusesapientgosdk.APIPerformanceEvaluationConfigUpdateResponse, error)
-## Leaderboard
+## Operations
Response Types:
-- githubcomusesapientgosdk.APILeaderboardListCompaniesResponse
+- githubcomusesapientgosdk.APIPerformanceOperationNewResponse
+- githubcomusesapientgosdk.APIPerformanceOperationGetResponse
+- githubcomusesapientgosdk.APIPerformanceOperationUpdateResponse
+- githubcomusesapientgosdk.APIPerformanceOperationListResponse
+- githubcomusesapientgosdk.APIPerformanceOperationDeleteResponse
Methods:
-- client.API.Leaderboard.ListCompanies(ctx context.Context, query githubcomusesapientgosdk.APILeaderboardListCompaniesParams) (\*githubcomusesapientgosdk.APILeaderboardListCompaniesResponse, error)
+- client.APIPerformance.Operations.New(ctx context.Context, body githubcomusesapientgosdk.APIPerformanceOperationNewParams) (\*githubcomusesapientgosdk.APIPerformanceOperationNewResponse, error)
+- client.APIPerformance.Operations.Get(ctx context.Context, operationID string) (\*githubcomusesapientgosdk.APIPerformanceOperationGetResponse, error)
+- client.APIPerformance.Operations.Update(ctx context.Context, operationID string, body githubcomusesapientgosdk.APIPerformanceOperationUpdateParams) (\*githubcomusesapientgosdk.APIPerformanceOperationUpdateResponse, error)
+- client.APIPerformance.Operations.List(ctx context.Context, query githubcomusesapientgosdk.APIPerformanceOperationListParams) (\*[]githubcomusesapientgosdk.APIPerformanceOperationListResponse, error)
+- client.APIPerformance.Operations.Delete(ctx context.Context, operationID string) (\*githubcomusesapientgosdk.APIPerformanceOperationDeleteResponse, error)
-### Companies
+## OperationPrompts
Response Types:
-- githubcomusesapientgosdk.APILeaderboardCompanyListResponse
+- githubcomusesapientgosdk.APIPerformanceOperationPromptNewResponse
+- githubcomusesapientgosdk.APIPerformanceOperationPromptListResponse
Methods:
-- client.API.Leaderboard.Companies.List(ctx context.Context, query githubcomusesapientgosdk.APILeaderboardCompanyListParams) (\*githubcomusesapientgosdk.APILeaderboardCompanyListResponse, error)
+- client.APIPerformance.OperationPrompts.New(ctx context.Context, operationID string, body githubcomusesapientgosdk.APIPerformanceOperationPromptNewParams) (\*githubcomusesapientgosdk.APIPerformanceOperationPromptNewResponse, error)
+- client.APIPerformance.OperationPrompts.List(ctx context.Context, operationID string) (\*[]githubcomusesapientgosdk.APIPerformanceOperationPromptListResponse, error)
-## APIPerformance
+## Runs
Response Types:
-- githubcomusesapientgosdk.FailureAnalysisSnapshot
-- githubcomusesapientgosdk.ApiapiPerformanceLatestRunsResponse
+- githubcomusesapientgosdk.APIPerformanceRunGetResponse
+- githubcomusesapientgosdk.APIPerformanceRunListResponse
Methods:
-- client.API.APIPerformance.FailureAnalysis(ctx context.Context, brandID string, query githubcomusesapientgosdk.APIAPIPerformanceFailureAnalysisParams) (\*githubcomusesapientgosdk.FailureAnalysisSnapshot, error)
-- client.API.APIPerformance.LatestRuns(ctx context.Context, brandID string, query githubcomusesapientgosdk.APIAPIPerformanceLatestRunsParams) (\*githubcomusesapientgosdk.ApiapiPerformanceLatestRunsResponse, error)
+- client.APIPerformance.Runs.Get(ctx context.Context, runID string) (\*githubcomusesapientgosdk.APIPerformanceRunGetResponse, error)
+- client.APIPerformance.Runs.List(ctx context.Context, query githubcomusesapientgosdk.APIPerformanceRunListParams) (\*githubcomusesapientgosdk.APIPerformanceRunListResponse, error)
## Prompts
Response Types:
-- githubcomusesapientgosdk.APIPromptNewBatchResponse
-- githubcomusesapientgosdk.APIPromptBatchResponse
+- githubcomusesapientgosdk.APIPerformancePromptGetResponse
+- githubcomusesapientgosdk.APIPerformancePromptUpdateResponse
+- githubcomusesapientgosdk.APIPerformancePromptDeleteResponse
Methods:
-- client.API.Prompts.NewBatch(ctx context.Context, body githubcomusesapientgosdk.APIPromptNewBatchParams) (\*githubcomusesapientgosdk.APIPromptNewBatchResponse, error)
-- client.API.Prompts.Batch(ctx context.Context, body githubcomusesapientgosdk.APIPromptBatchParams) (\*githubcomusesapientgosdk.APIPromptBatchResponse, error)
+- client.APIPerformance.Prompts.Get(ctx context.Context, promptID string) (\*githubcomusesapientgosdk.APIPerformancePromptGetResponse, error)
+- client.APIPerformance.Prompts.Update(ctx context.Context, promptID string, body githubcomusesapientgosdk.APIPerformancePromptUpdateParams) (\*githubcomusesapientgosdk.APIPerformancePromptUpdateResponse, error)
+- client.APIPerformance.Prompts.Delete(ctx context.Context, promptID string) (\*githubcomusesapientgosdk.APIPerformancePromptDeleteResponse, error)
-## Jobs
+## UseCases
Response Types:
-- githubcomusesapientgosdk.APIJobListJobsResponse
-- githubcomusesapientgosdk.APIJobListResponse
+- githubcomusesapientgosdk.APIPerformanceUseCaseNewResponse
+- githubcomusesapientgosdk.APIPerformanceUseCaseGetResponse
+- githubcomusesapientgosdk.APIPerformanceUseCaseUpdateResponse
+- githubcomusesapientgosdk.APIPerformanceUseCaseListResponse
+- githubcomusesapientgosdk.APIPerformanceUseCaseDeleteResponse
Methods:
-- client.API.Jobs.ListJobs(ctx context.Context, query githubcomusesapientgosdk.APIJobListJobsParams) (\*githubcomusesapientgosdk.APIJobListJobsResponse, error)
-- client.API.Jobs.GetJob(ctx context.Context, jobID string) (\*githubcomusesapientgosdk.PublicJob, error)
-- client.API.Jobs.List(ctx context.Context, query githubcomusesapientgosdk.APIJobListParams) (\*githubcomusesapientgosdk.APIJobListResponse, error)
-- client.API.Jobs.Get(ctx context.Context, jobID string) (\*githubcomusesapientgosdk.PublicJob, error)
+- client.APIPerformance.UseCases.New(ctx context.Context, body githubcomusesapientgosdk.APIPerformanceUseCaseNewParams) (\*githubcomusesapientgosdk.APIPerformanceUseCaseNewResponse, error)
+- client.APIPerformance.UseCases.Get(ctx context.Context, useCaseID string) (\*githubcomusesapientgosdk.APIPerformanceUseCaseGetResponse, error)
+- client.APIPerformance.UseCases.Update(ctx context.Context, useCaseID string, body githubcomusesapientgosdk.APIPerformanceUseCaseUpdateParams) (\*githubcomusesapientgosdk.APIPerformanceUseCaseUpdateResponse, error)
+- client.APIPerformance.UseCases.List(ctx context.Context) (\*[]githubcomusesapientgosdk.APIPerformanceUseCaseListResponse, error)
+- client.APIPerformance.UseCases.Delete(ctx context.Context, useCaseID string) (\*githubcomusesapientgosdk.APIPerformanceUseCaseDeleteResponse, error)
diff --git a/apiapiperformance.go b/apiapiperformance.go
deleted file mode 100644
index 0ddf591..0000000
--- a/apiapiperformance.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/usesapient/go-sdk/internal/apijson"
- "github.com/usesapient/go-sdk/internal/apiquery"
- "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"
-)
-
-// APIAPIPerformanceService contains methods and other services that help with
-// interacting with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewAPIAPIPerformanceService] method instead.
-type APIAPIPerformanceService struct {
- options []option.RequestOption
-}
-
-// NewAPIAPIPerformanceService generates a new service that applies the given
-// options to each request. These options are applied after the parent client's
-// options (if there is one), and before any request-specific options.
-func NewAPIAPIPerformanceService(opts ...option.RequestOption) (r APIAPIPerformanceService) {
- r = APIAPIPerformanceService{}
- r.options = opts
- return
-}
-
-// Failure Analysis
-func (r *APIAPIPerformanceService) FailureAnalysis(ctx context.Context, brandID string, query APIAPIPerformanceFailureAnalysisParams, opts ...option.RequestOption) (res *FailureAnalysisSnapshot, err error) {
- opts = slices.Concat(r.options, opts)
- if brandID == "" {
- err = errors.New("missing required brand_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/api/api-performance/failure-analysis/%s", url.PathEscape(brandID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-// Latest Runs
-func (r *APIAPIPerformanceService) LatestRuns(ctx context.Context, brandID string, query APIAPIPerformanceLatestRunsParams, opts ...option.RequestOption) (res *ApiapiPerformanceLatestRunsResponse, err error) {
- opts = slices.Concat(r.options, opts)
- if brandID == "" {
- err = errors.New("missing required brand_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/api/api-performance/latest-runs/%s", url.PathEscape(brandID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-type FailureAnalysisSnapshot struct {
- EndpointsByFailureCount []map[string]any `json:"endpoints_by_failure_count"`
- FailedRuns int64 `json:"failed_runs"`
- FailureRate float64 `json:"failure_rate" api:"nullable"`
- Patterns []FailureAnalysisSnapshotPattern `json:"patterns"`
- TopFailureReasons []map[string]any `json:"top_failure_reasons"`
- TotalRuns int64 `json:"total_runs"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EndpointsByFailureCount respjson.Field
- FailedRuns respjson.Field
- FailureRate respjson.Field
- Patterns respjson.Field
- TopFailureReasons respjson.Field
- TotalRuns respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r FailureAnalysisSnapshot) RawJSON() string { return r.JSON.raw }
-func (r *FailureAnalysisSnapshot) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type FailureAnalysisSnapshotPattern struct {
- Count int64 `json:"count" api:"required"`
- Label string `json:"label" api:"required"`
- Pattern string `json:"pattern" api:"required"`
- AffectedEndpoints []map[string]any `json:"affected_endpoints"`
- AffectedModels []string `json:"affected_models"`
- Description string `json:"description" api:"nullable"`
- ExampleReasons []string `json:"example_reasons"`
- Percentage float64 `json:"percentage" api:"nullable"`
- RunIDs []string `json:"run_ids"`
- Severity string `json:"severity" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Count respjson.Field
- Label respjson.Field
- Pattern respjson.Field
- AffectedEndpoints respjson.Field
- AffectedModels respjson.Field
- Description respjson.Field
- ExampleReasons respjson.Field
- Percentage respjson.Field
- RunIDs respjson.Field
- Severity respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r FailureAnalysisSnapshotPattern) RawJSON() string { return r.JSON.raw }
-func (r *FailureAnalysisSnapshotPattern) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ApiapiPerformanceLatestRunsResponse struct {
- Data []EvalRunSummary `json:"data" api:"required"`
- Meta PublicListMeta `json:"meta" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Data respjson.Field
- Meta respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ApiapiPerformanceLatestRunsResponse) RawJSON() string { return r.JSON.raw }
-func (r *ApiapiPerformanceLatestRunsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type APIAPIPerformanceFailureAnalysisParams struct {
- IntegrationID param.Opt[string] `query:"integration_id,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [APIAPIPerformanceFailureAnalysisParams]'s query parameters
-// as `url.Values`.
-func (r APIAPIPerformanceFailureAnalysisParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
-
-type APIAPIPerformanceLatestRunsParams struct {
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [APIAPIPerformanceLatestRunsParams]'s query parameters as
-// `url.Values`.
-func (r APIAPIPerformanceLatestRunsParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
diff --git a/apijob.go b/apijob.go
deleted file mode 100644
index 87cccca..0000000
--- a/apijob.go
+++ /dev/null
@@ -1,110 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/usesapient/go-sdk/internal/apiquery"
- "github.com/usesapient/go-sdk/internal/requestconfig"
- "github.com/usesapient/go-sdk/option"
- "github.com/usesapient/go-sdk/packages/param"
-)
-
-// APIJobService contains methods and other services that help with interacting
-// with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewAPIJobService] method instead.
-type APIJobService struct {
- options []option.RequestOption
-}
-
-// NewAPIJobService generates a new service that applies the given options to each
-// request. These options are applied after the parent client's options (if there
-// is one), and before any request-specific options.
-func NewAPIJobService(opts ...option.RequestOption) (r APIJobService) {
- r = APIJobService{}
- r.options = opts
- return
-}
-
-// List Jobs
-func (r *APIJobService) ListJobs(ctx context.Context, query APIJobListJobsParams, opts ...option.RequestOption) (res *APIJobListJobsResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/api/jobs"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-// Retrieve Job
-func (r *APIJobService) GetJob(ctx context.Context, jobID string, opts ...option.RequestOption) (res *PublicJob, err error) {
- opts = slices.Concat(r.options, opts)
- if jobID == "" {
- err = errors.New("missing required job_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/api/jobs/%s", url.PathEscape(jobID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
-// List Jobs
-func (r *APIJobService) List(ctx context.Context, query APIJobListParams, opts ...option.RequestOption) (res *APIJobListResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/api/jobs"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-// Retrieve Job
-func (r *APIJobService) Get(ctx context.Context, jobID string, opts ...option.RequestOption) (res *PublicJob, err error) {
- opts = slices.Concat(r.options, opts)
- if jobID == "" {
- err = errors.New("missing required job_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/api/jobs/%s", url.PathEscape(jobID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
-type APIJobListJobsResponse = any
-
-type APIJobListResponse = any
-
-type APIJobListJobsParams struct {
- Status param.Opt[string] `query:"status,omitzero" json:"-"`
- Type param.Opt[string] `query:"type,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [APIJobListJobsParams]'s query parameters as `url.Values`.
-func (r APIJobListJobsParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
-
-type APIJobListParams struct {
- Status param.Opt[string] `query:"status,omitzero" json:"-"`
- Type param.Opt[string] `query:"type,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [APIJobListParams]'s query parameters as `url.Values`.
-func (r APIJobListParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
diff --git a/apileaderboard.go b/apileaderboard.go
deleted file mode 100644
index 7ac2289..0000000
--- a/apileaderboard.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/usesapient/go-sdk/internal/apiquery"
- "github.com/usesapient/go-sdk/internal/requestconfig"
- "github.com/usesapient/go-sdk/option"
- "github.com/usesapient/go-sdk/packages/param"
-)
-
-// APILeaderboardService contains methods and other services that help with
-// interacting with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewAPILeaderboardService] method instead.
-type APILeaderboardService struct {
- options []option.RequestOption
- Companies APILeaderboardCompanyService
-}
-
-// NewAPILeaderboardService generates a new service that applies the given options
-// to each request. These options are applied after the parent client's options (if
-// there is one), and before any request-specific options.
-func NewAPILeaderboardService(opts ...option.RequestOption) (r APILeaderboardService) {
- r = APILeaderboardService{}
- r.options = opts
- r.Companies = NewAPILeaderboardCompanyService(opts...)
- return
-}
-
-// List Companies
-func (r *APILeaderboardService) ListCompanies(ctx context.Context, query APILeaderboardListCompaniesParams, opts ...option.RequestOption) (res *APILeaderboardListCompaniesResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/api/leaderboard/companies"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-type APILeaderboardListCompaniesResponse = any
-
-type APILeaderboardListCompaniesParams struct {
- Category param.Opt[string] `query:"category,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [APILeaderboardListCompaniesParams]'s query parameters as
-// `url.Values`.
-func (r APILeaderboardListCompaniesParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
diff --git a/apileaderboard_test.go b/apileaderboard_test.go
deleted file mode 100644
index b308c34..0000000
--- a/apileaderboard_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk_test
-
-import (
- "context"
- "errors"
- "os"
- "testing"
-
- "github.com/usesapient/go-sdk"
- "github.com/usesapient/go-sdk/internal/testutil"
- "github.com/usesapient/go-sdk/option"
-)
-
-func TestAPILeaderboardListCompaniesWithOptionalParams(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.API.Leaderboard.ListCompanies(context.TODO(), githubcomusesapientgosdk.APILeaderboardListCompaniesParams{
- Category: githubcomusesapientgosdk.String("category"),
- Limit: githubcomusesapientgosdk.Int(1),
- })
- 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/apileaderboardcompany.go b/apileaderboardcompany.go
deleted file mode 100644
index 299778d..0000000
--- a/apileaderboardcompany.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/usesapient/go-sdk/internal/apiquery"
- "github.com/usesapient/go-sdk/internal/requestconfig"
- "github.com/usesapient/go-sdk/option"
- "github.com/usesapient/go-sdk/packages/param"
-)
-
-// APILeaderboardCompanyService contains methods and other services that help with
-// interacting with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewAPILeaderboardCompanyService] method instead.
-type APILeaderboardCompanyService struct {
- options []option.RequestOption
-}
-
-// NewAPILeaderboardCompanyService generates a new service that applies the given
-// options to each request. These options are applied after the parent client's
-// options (if there is one), and before any request-specific options.
-func NewAPILeaderboardCompanyService(opts ...option.RequestOption) (r APILeaderboardCompanyService) {
- r = APILeaderboardCompanyService{}
- r.options = opts
- return
-}
-
-// List Companies
-func (r *APILeaderboardCompanyService) List(ctx context.Context, query APILeaderboardCompanyListParams, opts ...option.RequestOption) (res *APILeaderboardCompanyListResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/api/leaderboard/companies"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-type APILeaderboardCompanyListResponse = any
-
-type APILeaderboardCompanyListParams struct {
- Category param.Opt[string] `query:"category,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [APILeaderboardCompanyListParams]'s query parameters as
-// `url.Values`.
-func (r APILeaderboardCompanyListParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
diff --git a/apiperformance.go b/apiperformance.go
new file mode 100644
index 0000000..66302f1
--- /dev/null
+++ b/apiperformance.go
@@ -0,0 +1,42 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "github.com/usesapient/go-sdk/option"
+)
+
+// APIPerformanceService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceService] method instead.
+type APIPerformanceService struct {
+ Options []option.RequestOption
+ Platforms APIPerformancePlatformService
+ Interfaces APIPerformanceInterfaceService
+ EvaluationConfig APIPerformanceEvaluationConfigService
+ Operations APIPerformanceOperationService
+ OperationPrompts APIPerformanceOperationPromptService
+ Runs APIPerformanceRunService
+ Prompts APIPerformancePromptService
+ UseCases APIPerformanceUseCaseService
+}
+
+// NewAPIPerformanceService generates a new service that applies the given options
+// to each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewAPIPerformanceService(opts ...option.RequestOption) (r APIPerformanceService) {
+ r = APIPerformanceService{}
+ r.Options = opts
+ r.Platforms = NewAPIPerformancePlatformService(opts...)
+ r.Interfaces = NewAPIPerformanceInterfaceService(opts...)
+ r.EvaluationConfig = NewAPIPerformanceEvaluationConfigService(opts...)
+ r.Operations = NewAPIPerformanceOperationService(opts...)
+ r.OperationPrompts = NewAPIPerformanceOperationPromptService(opts...)
+ r.Runs = NewAPIPerformanceRunService(opts...)
+ r.Prompts = NewAPIPerformancePromptService(opts...)
+ r.UseCases = NewAPIPerformanceUseCaseService(opts...)
+ return
+}
diff --git a/apiperformanceevaluationconfig.go b/apiperformanceevaluationconfig.go
new file mode 100644
index 0000000..beaee04
--- /dev/null
+++ b/apiperformanceevaluationconfig.go
@@ -0,0 +1,142 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "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"
+)
+
+// APIPerformanceEvaluationConfigService contains methods and other services that
+// help with interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceEvaluationConfigService] method instead.
+type APIPerformanceEvaluationConfigService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformanceEvaluationConfigService generates a new service that applies
+// the given options to each request. These options are applied after the parent
+// client's options (if there is one), and before any request-specific options.
+func NewAPIPerformanceEvaluationConfigService(opts ...option.RequestOption) (r APIPerformanceEvaluationConfigService) {
+ r = APIPerformanceEvaluationConfigService{}
+ r.Options = opts
+ return
+}
+
+// Retrieve Evaluation Config
+func (r *APIPerformanceEvaluationConfigService) Get(ctx context.Context, query APIPerformanceEvaluationConfigGetParams, opts ...option.RequestOption) (res *APIPerformanceEvaluationConfigGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/evaluation-config"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
+ return res, err
+}
+
+// Update Evaluation Config
+func (r *APIPerformanceEvaluationConfigService) Update(ctx context.Context, body APIPerformanceEvaluationConfigUpdateParams, opts ...option.RequestOption) (res *APIPerformanceEvaluationConfigUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/evaluation-config"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
+ return res, err
+}
+
+type APIPerformanceEvaluationConfigGetResponse struct {
+ OperationIDs []string `json:"operation_ids" api:"required"`
+ APIBaseURL string `json:"api_base_url" api:"nullable"`
+ EnvVarKeys []string `json:"env_var_keys"`
+ EvalTypes []string `json:"eval_types"`
+ Framework string `json:"framework" api:"nullable"`
+ Platforms []string `json:"platforms"`
+ UseCaseIDs []string `json:"use_case_ids"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ OperationIDs respjson.Field
+ APIBaseURL respjson.Field
+ EnvVarKeys respjson.Field
+ EvalTypes respjson.Field
+ Framework respjson.Field
+ Platforms respjson.Field
+ UseCaseIDs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceEvaluationConfigGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceEvaluationConfigGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceEvaluationConfigUpdateResponse struct {
+ OperationIDs []string `json:"operation_ids" api:"required"`
+ APIBaseURL string `json:"api_base_url" api:"nullable"`
+ EnvVarKeys []string `json:"env_var_keys"`
+ EvalTypes []string `json:"eval_types"`
+ Framework string `json:"framework" api:"nullable"`
+ Platforms []string `json:"platforms"`
+ UseCaseIDs []string `json:"use_case_ids"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ OperationIDs respjson.Field
+ APIBaseURL respjson.Field
+ EnvVarKeys respjson.Field
+ EvalTypes respjson.Field
+ Framework respjson.Field
+ Platforms respjson.Field
+ UseCaseIDs respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceEvaluationConfigUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceEvaluationConfigUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceEvaluationConfigGetParams struct {
+ InterfaceID param.Opt[string] `query:"interface_id,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [APIPerformanceEvaluationConfigGetParams]'s query parameters
+// as `url.Values`.
+func (r APIPerformanceEvaluationConfigGetParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type APIPerformanceEvaluationConfigUpdateParams struct {
+ APIBaseURL param.Opt[string] `json:"api_base_url,omitzero"`
+ Framework param.Opt[string] `json:"framework,omitzero"`
+ InterfaceID param.Opt[string] `json:"interface_id,omitzero"`
+ EnvVars map[string]string `json:"env_vars,omitzero"`
+ EvalTypes []string `json:"eval_types,omitzero"`
+ OperationIDs []string `json:"operation_ids,omitzero"`
+ Platforms []string `json:"platforms,omitzero"`
+ UseCaseIDs []string `json:"use_case_ids,omitzero"`
+ paramObj
+}
+
+func (r APIPerformanceEvaluationConfigUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformanceEvaluationConfigUpdateParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformanceEvaluationConfigUpdateParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/apiperformanceevaluationconfig_test.go b/apiperformanceevaluationconfig_test.go
new file mode 100644
index 0000000..73b93f7
--- /dev/null
+++ b/apiperformanceevaluationconfig_test.go
@@ -0,0 +1,73 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
+)
+
+func TestAPIPerformanceEvaluationConfigGetWithOptionalParams(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.APIPerformance.EvaluationConfig.Get(context.TODO(), githubcomusesapientgosdk.APIPerformanceEvaluationConfigGetParams{
+ InterfaceID: githubcomusesapientgosdk.String("interface_id"),
+ })
+ 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())
+ }
+}
+
+func TestAPIPerformanceEvaluationConfigUpdateWithOptionalParams(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.APIPerformance.EvaluationConfig.Update(context.TODO(), githubcomusesapientgosdk.APIPerformanceEvaluationConfigUpdateParams{
+ APIBaseURL: githubcomusesapientgosdk.String("api_base_url"),
+ EnvVars: map[string]string{
+ "foo": "string",
+ },
+ EvalTypes: []string{"string"},
+ Framework: githubcomusesapientgosdk.String("framework"),
+ InterfaceID: githubcomusesapientgosdk.String("interface_id"),
+ OperationIDs: []string{"string"},
+ Platforms: []string{"string"},
+ UseCaseIDs: []string{"string"},
+ })
+ 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/apiperformanceinterface.go b/apiperformanceinterface.go
new file mode 100644
index 0000000..cdd7df8
--- /dev/null
+++ b/apiperformanceinterface.go
@@ -0,0 +1,81 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "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"
+)
+
+// APIPerformanceInterfaceService contains methods and other services that help
+// with interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceInterfaceService] method instead.
+type APIPerformanceInterfaceService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformanceInterfaceService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewAPIPerformanceInterfaceService(opts ...option.RequestOption) (r APIPerformanceInterfaceService) {
+ r = APIPerformanceInterfaceService{}
+ r.Options = opts
+ return
+}
+
+// List Interfaces
+func (r *APIPerformanceInterfaceService) List(ctx context.Context, opts ...option.RequestOption) (res *APIPerformanceInterfaceListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/interfaces"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+type APIPerformanceInterfaceListResponse struct {
+ Interfaces []APIPerformanceInterfaceListResponseInterface `json:"interfaces" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Interfaces respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceInterfaceListResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceInterfaceListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceInterfaceListResponseInterface struct {
+ ID string `json:"id" api:"required"`
+ Label string `json:"label" api:"required"`
+ Type string `json:"type" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ OperationCount int64 `json:"operation_count"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Label respjson.Field
+ Type respjson.Field
+ CreatedAt respjson.Field
+ OperationCount respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceInterfaceListResponseInterface) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceInterfaceListResponseInterface) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/apileaderboardcompany_test.go b/apiperformanceinterface_test.go
similarity index 73%
rename from apileaderboardcompany_test.go
rename to apiperformanceinterface_test.go
index d22e71f..bc4daa1 100644
--- a/apileaderboardcompany_test.go
+++ b/apiperformanceinterface_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestAPILeaderboardCompanyListWithOptionalParams(t *testing.T) {
+func TestAPIPerformanceInterfaceList(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,10 +26,7 @@ func TestAPILeaderboardCompanyListWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Leaderboard.Companies.List(context.TODO(), githubcomusesapientgosdk.APILeaderboardCompanyListParams{
- Category: githubcomusesapientgosdk.String("category"),
- Limit: githubcomusesapientgosdk.Int(1),
- })
+ _, err := client.APIPerformance.Interfaces.List(context.TODO())
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
diff --git a/apiperformanceoperation.go b/apiperformanceoperation.go
new file mode 100644
index 0000000..46b0984
--- /dev/null
+++ b/apiperformanceoperation.go
@@ -0,0 +1,353 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "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"
+)
+
+// APIPerformanceOperationService contains methods and other services that help
+// with interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceOperationService] method instead.
+type APIPerformanceOperationService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformanceOperationService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewAPIPerformanceOperationService(opts ...option.RequestOption) (r APIPerformanceOperationService) {
+ r = APIPerformanceOperationService{}
+ r.Options = opts
+ return
+}
+
+// Create Operation
+func (r *APIPerformanceOperationService) New(ctx context.Context, body APIPerformanceOperationNewParams, opts ...option.RequestOption) (res *APIPerformanceOperationNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/operations"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return res, err
+}
+
+// Retrieve Operation
+func (r *APIPerformanceOperationService) Get(ctx context.Context, operationID string, opts ...option.RequestOption) (res *APIPerformanceOperationGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if operationID == "" {
+ err = errors.New("missing required operation_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/operations/%s", operationID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Update Operation
+func (r *APIPerformanceOperationService) Update(ctx context.Context, operationID string, body APIPerformanceOperationUpdateParams, opts ...option.RequestOption) (res *APIPerformanceOperationUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if operationID == "" {
+ err = errors.New("missing required operation_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/operations/%s", operationID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ return res, err
+}
+
+// List Operations
+func (r *APIPerformanceOperationService) List(ctx context.Context, query APIPerformanceOperationListParams, opts ...option.RequestOption) (res *[]APIPerformanceOperationListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/operations"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
+ return res, err
+}
+
+// Delete Operation
+func (r *APIPerformanceOperationService) Delete(ctx context.Context, operationID string, opts ...option.RequestOption) (res *APIPerformanceOperationDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if operationID == "" {
+ err = errors.New("missing required operation_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/operations/%s", operationID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return res, err
+}
+
+type APIPerformanceOperationNewResponse struct {
+ ID string `json:"id" api:"required"`
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ Category APIPerformanceOperationNewResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ InterfaceID string `json:"interface_id" api:"nullable"`
+ OpenAPIOperationID string `json:"openapi_operation_id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Method respjson.Field
+ Path respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ InterfaceID respjson.Field
+ OpenAPIOperationID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationNewResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationNewResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationNewResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationNewResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationGetResponse struct {
+ ID string `json:"id" api:"required"`
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ Category APIPerformanceOperationGetResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ InterfaceID string `json:"interface_id" api:"nullable"`
+ OpenAPIOperationID string `json:"openapi_operation_id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Method respjson.Field
+ Path respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ InterfaceID respjson.Field
+ OpenAPIOperationID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationGetResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationGetResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationGetResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationUpdateResponse struct {
+ ID string `json:"id" api:"required"`
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ Category APIPerformanceOperationUpdateResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ InterfaceID string `json:"interface_id" api:"nullable"`
+ OpenAPIOperationID string `json:"openapi_operation_id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Method respjson.Field
+ Path respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ InterfaceID respjson.Field
+ OpenAPIOperationID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationUpdateResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationUpdateResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationUpdateResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationListResponse struct {
+ ID string `json:"id" api:"required"`
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ Category APIPerformanceOperationListResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ InterfaceID string `json:"interface_id" api:"nullable"`
+ OpenAPIOperationID string `json:"openapi_operation_id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Method respjson.Field
+ Path respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ InterfaceID respjson.Field
+ OpenAPIOperationID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationListResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationListResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationListResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationListResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationDeleteResponse = any
+
+type APIPerformanceOperationNewParams struct {
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ CategoryName param.Opt[string] `json:"category_name,omitzero"`
+ CategorySlug param.Opt[string] `json:"category_slug,omitzero"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ InterfaceID param.Opt[string] `json:"interface_id,omitzero"`
+ OpenAPIOperationID param.Opt[string] `json:"openapi_operation_id,omitzero"`
+ paramObj
+}
+
+func (r APIPerformanceOperationNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformanceOperationNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformanceOperationNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationUpdateParams struct {
+ CategoryName param.Opt[string] `json:"category_name,omitzero"`
+ CategorySlug param.Opt[string] `json:"category_slug,omitzero"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ InterfaceID param.Opt[string] `json:"interface_id,omitzero"`
+ Method param.Opt[string] `json:"method,omitzero"`
+ OpenAPIOperationID param.Opt[string] `json:"openapi_operation_id,omitzero"`
+ Path param.Opt[string] `json:"path,omitzero"`
+ paramObj
+}
+
+func (r APIPerformanceOperationUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformanceOperationUpdateParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformanceOperationUpdateParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationListParams struct {
+ CategoryID param.Opt[string] `query:"category_id,omitzero" json:"-"`
+ InterfaceID param.Opt[string] `query:"interface_id,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [APIPerformanceOperationListParams]'s query parameters as
+// `url.Values`.
+func (r APIPerformanceOperationListParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
diff --git a/apiperformanceoperation_test.go b/apiperformanceoperation_test.go
new file mode 100644
index 0000000..e533f81
--- /dev/null
+++ b/apiperformanceoperation_test.go
@@ -0,0 +1,152 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
+)
+
+func TestAPIPerformanceOperationNewWithOptionalParams(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.APIPerformance.Operations.New(context.TODO(), githubcomusesapientgosdk.APIPerformanceOperationNewParams{
+ Method: "x",
+ Path: "x",
+ CategoryName: githubcomusesapientgosdk.String("category_name"),
+ CategorySlug: githubcomusesapientgosdk.String("category_slug"),
+ Description: githubcomusesapientgosdk.String("description"),
+ InterfaceID: githubcomusesapientgosdk.String("interface_id"),
+ OpenAPIOperationID: githubcomusesapientgosdk.String("openapi_operation_id"),
+ })
+ 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())
+ }
+}
+
+func TestAPIPerformanceOperationGet(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.APIPerformance.Operations.Get(context.TODO(), "operation_id")
+ 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())
+ }
+}
+
+func TestAPIPerformanceOperationUpdateWithOptionalParams(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.APIPerformance.Operations.Update(
+ context.TODO(),
+ "operation_id",
+ githubcomusesapientgosdk.APIPerformanceOperationUpdateParams{
+ CategoryName: githubcomusesapientgosdk.String("category_name"),
+ CategorySlug: githubcomusesapientgosdk.String("category_slug"),
+ Description: githubcomusesapientgosdk.String("description"),
+ InterfaceID: githubcomusesapientgosdk.String("interface_id"),
+ Method: githubcomusesapientgosdk.String("x"),
+ OpenAPIOperationID: githubcomusesapientgosdk.String("openapi_operation_id"),
+ Path: githubcomusesapientgosdk.String("x"),
+ },
+ )
+ 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())
+ }
+}
+
+func TestAPIPerformanceOperationListWithOptionalParams(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.APIPerformance.Operations.List(context.TODO(), githubcomusesapientgosdk.APIPerformanceOperationListParams{
+ CategoryID: githubcomusesapientgosdk.String("category_id"),
+ InterfaceID: githubcomusesapientgosdk.String("interface_id"),
+ })
+ 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())
+ }
+}
+
+func TestAPIPerformanceOperationDelete(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.APIPerformance.Operations.Delete(context.TODO(), "operation_id")
+ 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/apiperformanceoperationprompt.go b/apiperformanceoperationprompt.go
new file mode 100644
index 0000000..02fb1dc
--- /dev/null
+++ b/apiperformanceoperationprompt.go
@@ -0,0 +1,141 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "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/param"
+ "github.com/usesapient/go-sdk/packages/respjson"
+)
+
+// APIPerformanceOperationPromptService contains methods and other services that
+// help with interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceOperationPromptService] method instead.
+type APIPerformanceOperationPromptService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformanceOperationPromptService generates a new service that applies the
+// given options to each request. These options are applied after the parent
+// client's options (if there is one), and before any request-specific options.
+func NewAPIPerformanceOperationPromptService(opts ...option.RequestOption) (r APIPerformanceOperationPromptService) {
+ r = APIPerformanceOperationPromptService{}
+ r.Options = opts
+ return
+}
+
+// Create Operation Prompt
+func (r *APIPerformanceOperationPromptService) New(ctx context.Context, operationID string, body APIPerformanceOperationPromptNewParams, opts ...option.RequestOption) (res *APIPerformanceOperationPromptNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if operationID == "" {
+ err = errors.New("missing required operation_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/operations/%s/prompts", operationID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return res, err
+}
+
+// List Operation Prompts
+func (r *APIPerformanceOperationPromptService) List(ctx context.Context, operationID string, opts ...option.RequestOption) (res *[]APIPerformanceOperationPromptListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if operationID == "" {
+ err = errors.New("missing required operation_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/operations/%s/prompts", operationID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+type APIPerformanceOperationPromptNewResponse struct {
+ ID string `json:"id" api:"required"`
+ EvalType string `json:"eval_type" api:"required"`
+ OperationID string `json:"operation_id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Enabled bool `json:"enabled"`
+ ExpectedBehavior string `json:"expected_behavior" api:"nullable"`
+ Graders []map[string]any `json:"graders"`
+ ReferenceAnswer string `json:"reference_answer" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ EvalType respjson.Field
+ OperationID respjson.Field
+ Prompt respjson.Field
+ CreatedAt respjson.Field
+ Enabled respjson.Field
+ ExpectedBehavior respjson.Field
+ Graders respjson.Field
+ ReferenceAnswer respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationPromptNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationPromptNewResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationPromptListResponse struct {
+ ID string `json:"id" api:"required"`
+ EvalType string `json:"eval_type" api:"required"`
+ OperationID string `json:"operation_id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Enabled bool `json:"enabled"`
+ ExpectedBehavior string `json:"expected_behavior" api:"nullable"`
+ Graders []map[string]any `json:"graders"`
+ ReferenceAnswer string `json:"reference_answer" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ EvalType respjson.Field
+ OperationID respjson.Field
+ Prompt respjson.Field
+ CreatedAt respjson.Field
+ Enabled respjson.Field
+ ExpectedBehavior respjson.Field
+ Graders respjson.Field
+ ReferenceAnswer respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceOperationPromptListResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceOperationPromptListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceOperationPromptNewParams struct {
+ Prompt string `json:"prompt" api:"required"`
+ ExpectedBehavior param.Opt[string] `json:"expected_behavior,omitzero"`
+ ReferenceAnswer param.Opt[string] `json:"reference_answer,omitzero"`
+ EvalType param.Opt[string] `json:"eval_type,omitzero"`
+ Graders []map[string]any `json:"graders,omitzero"`
+ paramObj
+}
+
+func (r APIPerformanceOperationPromptNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformanceOperationPromptNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformanceOperationPromptNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/context_test.go b/apiperformanceoperationprompt_test.go
similarity index 66%
rename from context_test.go
rename to apiperformanceoperationprompt_test.go
index 4152509..2bad2f2 100644
--- a/context_test.go
+++ b/apiperformanceoperationprompt_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestContextGetCompanyWithOptionalParams(t *testing.T) {
+func TestAPIPerformanceOperationPromptNewWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,13 +26,17 @@ func TestContextGetCompanyWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Context.GetCompany(
+ _, err := client.APIPerformance.OperationPrompts.New(
context.TODO(),
- "company",
- githubcomusesapientgosdk.ContextGetCompanyParams{
- For: githubcomusesapientgosdk.String("for"),
- Format: githubcomusesapientgosdk.ContextGetCompanyParamsFormatJson,
- Since: githubcomusesapientgosdk.String("since"),
+ "operation_id",
+ githubcomusesapientgosdk.APIPerformanceOperationPromptNewParams{
+ Prompt: "x",
+ EvalType: githubcomusesapientgosdk.String("x"),
+ ExpectedBehavior: githubcomusesapientgosdk.String("expected_behavior"),
+ Graders: []map[string]any{{
+ "foo": "bar",
+ }},
+ ReferenceAnswer: githubcomusesapientgosdk.String("reference_answer"),
},
)
if err != nil {
@@ -44,7 +48,7 @@ func TestContextGetCompanyWithOptionalParams(t *testing.T) {
}
}
-func TestContextCompanyWithOptionalParams(t *testing.T) {
+func TestAPIPerformanceOperationPromptList(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -57,15 +61,7 @@ func TestContextCompanyWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Context.Company(
- context.TODO(),
- "company",
- githubcomusesapientgosdk.ContextCompanyParams{
- For: githubcomusesapientgosdk.String("for"),
- Format: githubcomusesapientgosdk.ContextCompanyParamsFormatJson,
- Since: githubcomusesapientgosdk.String("since"),
- },
- )
+ _, err := client.APIPerformance.OperationPrompts.List(context.TODO(), "operation_id")
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
diff --git a/apiperformanceplatform.go b/apiperformanceplatform.go
new file mode 100644
index 0000000..5cb2159
--- /dev/null
+++ b/apiperformanceplatform.go
@@ -0,0 +1,158 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "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/param"
+ "github.com/usesapient/go-sdk/packages/respjson"
+)
+
+// APIPerformancePlatformService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformancePlatformService] method instead.
+type APIPerformancePlatformService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformancePlatformService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewAPIPerformancePlatformService(opts ...option.RequestOption) (r APIPerformancePlatformService) {
+ r = APIPerformancePlatformService{}
+ r.Options = opts
+ return
+}
+
+// List Platforms
+func (r *APIPerformancePlatformService) List(ctx context.Context, opts ...option.RequestOption) (res *APIPerformancePlatformListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/platforms"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Estimate Platform Cost
+func (r *APIPerformancePlatformService) EstimateCost(ctx context.Context, body APIPerformancePlatformEstimateCostParams, 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...)
+ return res, err
+}
+
+type APIPerformancePlatformListResponse struct {
+ AgentPlatforms []APIPerformancePlatformListResponseAgentPlatform `json:"agent_platforms" api:"required"`
+ TextPlatforms []APIPerformancePlatformListResponseTextPlatform `json:"text_platforms" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ AgentPlatforms respjson.Field
+ TextPlatforms respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformancePlatformListResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformancePlatformListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+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"`
+ // 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
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformancePlatformListResponseAgentPlatform) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformancePlatformListResponseAgentPlatform) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+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"`
+ // 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
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformancePlatformListResponseTextPlatform) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformancePlatformListResponseTextPlatform) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformancePlatformEstimateCostResponse struct {
+ Costs map[string]float64 `json:"costs" api:"required"`
+ EvalCount int64 `json:"eval_count" 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
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformancePlatformEstimateCostResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformancePlatformEstimateCostResponse) UnmarshalJSON(data []byte) error {
+ 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
+}
+
+func (r APIPerformancePlatformEstimateCostParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformancePlatformEstimateCostParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformancePlatformEstimateCostParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/apiapiperformance_test.go b/apiperformanceplatform_test.go
similarity index 70%
rename from apiapiperformance_test.go
rename to apiperformanceplatform_test.go
index 105b308..909ce8b 100644
--- a/apiapiperformance_test.go
+++ b/apiperformanceplatform_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
+func TestAPIPerformancePlatformList(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,13 +26,7 @@ func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.APIPerformance.FailureAnalysis(
- context.TODO(),
- "brand_id",
- githubcomusesapientgosdk.APIAPIPerformanceFailureAnalysisParams{
- IntegrationID: githubcomusesapientgosdk.String("integration_id"),
- },
- )
+ _, err := client.APIPerformance.Platforms.List(context.TODO())
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
@@ -42,7 +36,7 @@ func TestAPIAPIPerformanceFailureAnalysisWithOptionalParams(t *testing.T) {
}
}
-func TestAPIAPIPerformanceLatestRunsWithOptionalParams(t *testing.T) {
+func TestAPIPerformancePlatformEstimateCostWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -55,13 +49,12 @@ func TestAPIAPIPerformanceLatestRunsWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.APIPerformance.LatestRuns(
- context.TODO(),
- "brand_id",
- githubcomusesapientgosdk.APIAPIPerformanceLatestRunsParams{
- Limit: githubcomusesapientgosdk.Int(1),
- },
- )
+ _, err := client.APIPerformance.Platforms.EstimateCost(context.TODO(), githubcomusesapientgosdk.APIPerformancePlatformEstimateCostParams{
+ EvalCount: 1,
+ PlatformIDs: []string{"string"},
+ InputTokens: githubcomusesapientgosdk.Int(0),
+ OutputTokens: githubcomusesapientgosdk.Int(0),
+ })
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
diff --git a/apiperformanceprompt.go b/apiperformanceprompt.go
new file mode 100644
index 0000000..9f554bc
--- /dev/null
+++ b/apiperformanceprompt.go
@@ -0,0 +1,155 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "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/param"
+ "github.com/usesapient/go-sdk/packages/respjson"
+)
+
+// APIPerformancePromptService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformancePromptService] method instead.
+type APIPerformancePromptService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformancePromptService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewAPIPerformancePromptService(opts ...option.RequestOption) (r APIPerformancePromptService) {
+ r = APIPerformancePromptService{}
+ r.Options = opts
+ return
+}
+
+// Retrieve Operation Prompt
+func (r *APIPerformancePromptService) Get(ctx context.Context, promptID string, opts ...option.RequestOption) (res *APIPerformancePromptGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if promptID == "" {
+ err = errors.New("missing required prompt_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/prompts/%s", promptID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Update Operation Prompt
+func (r *APIPerformancePromptService) Update(ctx context.Context, promptID string, body APIPerformancePromptUpdateParams, opts ...option.RequestOption) (res *APIPerformancePromptUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if promptID == "" {
+ err = errors.New("missing required prompt_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/prompts/%s", promptID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ return res, err
+}
+
+// Delete Operation Prompt
+func (r *APIPerformancePromptService) Delete(ctx context.Context, promptID string, opts ...option.RequestOption) (res *APIPerformancePromptDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if promptID == "" {
+ err = errors.New("missing required prompt_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/prompts/%s", promptID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return res, err
+}
+
+type APIPerformancePromptGetResponse struct {
+ ID string `json:"id" api:"required"`
+ EvalType string `json:"eval_type" api:"required"`
+ OperationID string `json:"operation_id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Enabled bool `json:"enabled"`
+ ExpectedBehavior string `json:"expected_behavior" api:"nullable"`
+ Graders []map[string]any `json:"graders"`
+ ReferenceAnswer string `json:"reference_answer" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ EvalType respjson.Field
+ OperationID respjson.Field
+ Prompt respjson.Field
+ CreatedAt respjson.Field
+ Enabled respjson.Field
+ ExpectedBehavior respjson.Field
+ Graders respjson.Field
+ ReferenceAnswer respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformancePromptGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformancePromptGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformancePromptUpdateResponse struct {
+ ID string `json:"id" api:"required"`
+ EvalType string `json:"eval_type" api:"required"`
+ OperationID string `json:"operation_id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Enabled bool `json:"enabled"`
+ ExpectedBehavior string `json:"expected_behavior" api:"nullable"`
+ Graders []map[string]any `json:"graders"`
+ ReferenceAnswer string `json:"reference_answer" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ EvalType respjson.Field
+ OperationID respjson.Field
+ Prompt respjson.Field
+ CreatedAt respjson.Field
+ Enabled respjson.Field
+ ExpectedBehavior respjson.Field
+ Graders respjson.Field
+ ReferenceAnswer respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformancePromptUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformancePromptUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformancePromptDeleteResponse = any
+
+type APIPerformancePromptUpdateParams struct {
+ Enabled param.Opt[bool] `json:"enabled,omitzero"`
+ ExpectedBehavior param.Opt[string] `json:"expected_behavior,omitzero"`
+ Prompt param.Opt[string] `json:"prompt,omitzero"`
+ ReferenceAnswer param.Opt[string] `json:"reference_answer,omitzero"`
+ Graders []map[string]any `json:"graders,omitzero"`
+ paramObj
+}
+
+func (r APIPerformancePromptUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformancePromptUpdateParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformancePromptUpdateParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/workflow_test.go b/apiperformanceprompt_test.go
similarity index 71%
rename from workflow_test.go
rename to apiperformanceprompt_test.go
index 4a2dfc3..bb97b21 100644
--- a/workflow_test.go
+++ b/apiperformanceprompt_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestWorkflowNewWithOptionalParams(t *testing.T) {
+func TestAPIPerformancePromptGet(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,16 +26,7 @@ func TestWorkflowNewWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Workflows.New(context.TODO(), githubcomusesapientgosdk.WorkflowNewParams{
- Name: "name",
- Description: githubcomusesapientgosdk.String("description"),
- Metadata: map[string]any{
- "foo": "bar",
- },
- Steps: []map[string]any{{
- "foo": "bar",
- }},
- })
+ _, err := client.APIPerformance.Prompts.Get(context.TODO(), "prompt_id")
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
@@ -45,7 +36,7 @@ func TestWorkflowNewWithOptionalParams(t *testing.T) {
}
}
-func TestWorkflowGet(t *testing.T) {
+func TestAPIPerformancePromptUpdateWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -58,7 +49,19 @@ func TestWorkflowGet(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Workflows.Get(context.TODO(), "workflow_id")
+ _, err := client.APIPerformance.Prompts.Update(
+ context.TODO(),
+ "prompt_id",
+ githubcomusesapientgosdk.APIPerformancePromptUpdateParams{
+ Enabled: githubcomusesapientgosdk.Bool(true),
+ ExpectedBehavior: githubcomusesapientgosdk.String("expected_behavior"),
+ Graders: []map[string]any{{
+ "foo": "bar",
+ }},
+ Prompt: githubcomusesapientgosdk.String("x"),
+ ReferenceAnswer: githubcomusesapientgosdk.String("reference_answer"),
+ },
+ )
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
@@ -68,7 +71,7 @@ func TestWorkflowGet(t *testing.T) {
}
}
-func TestWorkflowRunWithOptionalParams(t *testing.T) {
+func TestAPIPerformancePromptDelete(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -81,17 +84,7 @@ func TestWorkflowRunWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Workflows.Run(
- context.TODO(),
- "workflow_id",
- githubcomusesapientgosdk.WorkflowRunParams{
- Input: map[string]any{
- "foo": "bar",
- },
- Watch: githubcomusesapientgosdk.Bool(true),
- WorkflowID: githubcomusesapientgosdk.String("workflow_id"),
- },
- )
+ _, err := client.APIPerformance.Prompts.Delete(context.TODO(), "prompt_id")
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
diff --git a/apiperformancerun.go b/apiperformancerun.go
new file mode 100644
index 0000000..9619376
--- /dev/null
+++ b/apiperformancerun.go
@@ -0,0 +1,346 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
+ "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"
+)
+
+// APIPerformanceRunService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceRunService] method instead.
+type APIPerformanceRunService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformanceRunService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewAPIPerformanceRunService(opts ...option.RequestOption) (r APIPerformanceRunService) {
+ r = APIPerformanceRunService{}
+ r.Options = opts
+ return
+}
+
+// Retrieve Run
+func (r *APIPerformanceRunService) Get(ctx context.Context, runID string, opts ...option.RequestOption) (res *APIPerformanceRunGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if runID == "" {
+ err = errors.New("missing required run_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/runs/%s", runID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// List Operation Runs
+func (r *APIPerformanceRunService) List(ctx context.Context, query APIPerformanceRunListParams, opts ...option.RequestOption) (res *APIPerformanceRunListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/runs"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
+ return res, err
+}
+
+type APIPerformanceRunGetResponse struct {
+ Data APIPerformanceRunGetResponseData `json:"data" api:"required"`
+ Operation APIPerformanceRunGetResponseOperation `json:"operation" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ Operation respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+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"`
+ EvalType string `json:"eval_type" api:"nullable"`
+ ExecutionStderr string `json:"execution_stderr" api:"nullable"`
+ ExecutionStdout string `json:"execution_stdout" api:"nullable"`
+ ExitCode int64 `json:"exit_code" 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"`
+ 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"`
+ ToolCalls []map[string]any `json:"tool_calls" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ APICallLog respjson.Field
+ ConversationTurns respjson.Field
+ CostUsd respjson.Field
+ CreatedAt respjson.Field
+ ErrorMessage respjson.Field
+ EvalID respjson.Field
+ EvalType respjson.Field
+ ExecutionStderr respjson.Field
+ ExecutionStdout respjson.Field
+ ExitCode respjson.Field
+ FailureReasons respjson.Field
+ GeneratedFiles respjson.Field
+ GraderResults 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
+ ToolCalls respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunGetResponseData) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunGetResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceRunGetResponseOperation struct {
+ ID string `json:"id" api:"required"`
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ Category APIPerformanceRunGetResponseOperationCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ InterfaceID string `json:"interface_id" api:"nullable"`
+ OpenAPIOperationID string `json:"openapi_operation_id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Method respjson.Field
+ Path respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ InterfaceID respjson.Field
+ OpenAPIOperationID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunGetResponseOperation) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunGetResponseOperation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceRunGetResponseOperationCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunGetResponseOperationCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunGetResponseOperationCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceRunListResponse struct {
+ Data []APIPerformanceRunListResponseData `json:"data" api:"required"`
+ Meta APIPerformanceRunListResponseMeta `json:"meta" api:"required"`
+ Operation APIPerformanceRunListResponseOperation `json:"operation" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ Meta respjson.Field
+ Operation respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunListResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+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"`
+ // 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
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunListResponseData) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunListResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceRunListResponseMeta struct {
+ Count int64 `json:"count" api:"required"`
+ Limit int64 `json:"limit" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Count respjson.Field
+ Limit respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunListResponseMeta) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunListResponseMeta) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceRunListResponseOperation struct {
+ ID string `json:"id" api:"required"`
+ Method string `json:"method" api:"required"`
+ Path string `json:"path" api:"required"`
+ Category APIPerformanceRunListResponseOperationCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ InterfaceID string `json:"interface_id" api:"nullable"`
+ OpenAPIOperationID string `json:"openapi_operation_id" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Method respjson.Field
+ Path respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ InterfaceID respjson.Field
+ OpenAPIOperationID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunListResponseOperation) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunListResponseOperation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceRunListResponseOperationCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceRunListResponseOperationCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceRunListResponseOperationCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+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
+}
+
+// URLQuery serializes [APIPerformanceRunListParams]'s query parameters as
+// `url.Values`.
+func (r APIPerformanceRunListParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
diff --git a/apiprompt_test.go b/apiperformancerun_test.go
similarity index 64%
rename from apiprompt_test.go
rename to apiperformancerun_test.go
index 93a7e49..16241fb 100644
--- a/apiprompt_test.go
+++ b/apiperformancerun_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestAPIPromptNewBatch(t *testing.T) {
+func TestAPIPerformanceRunGet(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,15 +26,7 @@ func TestAPIPromptNewBatch(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Prompts.NewBatch(context.TODO(), githubcomusesapientgosdk.APIPromptNewBatchParams{
- Prompts: []githubcomusesapientgosdk.APIPromptNewBatchParamsPrompt{{
- LanguageID: "language_id",
- RegionID: "region_id",
- Text: "text",
- TopicID: "topic_id",
- PlatformIDs: []string{"string"},
- }},
- })
+ _, err := client.APIPerformance.Runs.Get(context.TODO(), "run_id")
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
@@ -44,7 +36,7 @@ func TestAPIPromptNewBatch(t *testing.T) {
}
}
-func TestAPIPromptBatch(t *testing.T) {
+func TestAPIPerformanceRunListWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -57,14 +49,10 @@ func TestAPIPromptBatch(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Prompts.Batch(context.TODO(), githubcomusesapientgosdk.APIPromptBatchParams{
- Prompts: []githubcomusesapientgosdk.APIPromptBatchParamsPrompt{{
- LanguageID: "language_id",
- RegionID: "region_id",
- Text: "text",
- TopicID: "topic_id",
- PlatformIDs: []string{"string"},
- }},
+ _, err := client.APIPerformance.Runs.List(context.TODO(), githubcomusesapientgosdk.APIPerformanceRunListParams{
+ OperationID: "x",
+ IncludeRaw: githubcomusesapientgosdk.Bool(true),
+ Limit: githubcomusesapientgosdk.Int(1),
})
if err != nil {
var apierr *githubcomusesapientgosdk.Error
diff --git a/apiperformanceusecase.go b/apiperformanceusecase.go
new file mode 100644
index 0000000..e8027d2
--- /dev/null
+++ b/apiperformanceusecase.go
@@ -0,0 +1,304 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "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/param"
+ "github.com/usesapient/go-sdk/packages/respjson"
+)
+
+// APIPerformanceUseCaseService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewAPIPerformanceUseCaseService] method instead.
+type APIPerformanceUseCaseService struct {
+ Options []option.RequestOption
+}
+
+// NewAPIPerformanceUseCaseService generates a new service that applies the given
+// options to each request. These options are applied after the parent client's
+// options (if there is one), and before any request-specific options.
+func NewAPIPerformanceUseCaseService(opts ...option.RequestOption) (r APIPerformanceUseCaseService) {
+ r = APIPerformanceUseCaseService{}
+ r.Options = opts
+ return
+}
+
+// Create Use Case
+func (r *APIPerformanceUseCaseService) New(ctx context.Context, body APIPerformanceUseCaseNewParams, opts ...option.RequestOption) (res *APIPerformanceUseCaseNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/use-cases"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return res, err
+}
+
+// Retrieve Use Case
+func (r *APIPerformanceUseCaseService) Get(ctx context.Context, useCaseID string, opts ...option.RequestOption) (res *APIPerformanceUseCaseGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if useCaseID == "" {
+ err = errors.New("missing required use_case_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/use-cases/%s", useCaseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Update Use Case
+func (r *APIPerformanceUseCaseService) Update(ctx context.Context, useCaseID string, body APIPerformanceUseCaseUpdateParams, opts ...option.RequestOption) (res *APIPerformanceUseCaseUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if useCaseID == "" {
+ err = errors.New("missing required use_case_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/use-cases/%s", useCaseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ return res, err
+}
+
+// List Use Cases
+func (r *APIPerformanceUseCaseService) List(ctx context.Context, opts ...option.RequestOption) (res *[]APIPerformanceUseCaseListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/api-performance/use-cases"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Delete Use Case
+func (r *APIPerformanceUseCaseService) Delete(ctx context.Context, useCaseID string, opts ...option.RequestOption) (res *APIPerformanceUseCaseDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if useCaseID == "" {
+ err = errors.New("missing required use_case_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/api-performance/use-cases/%s", useCaseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return res, err
+}
+
+type APIPerformanceUseCaseNewResponse struct {
+ ID string `json:"id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ Category APIPerformanceUseCaseNewResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Prompt respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseNewResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseNewResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseNewResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseNewResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseGetResponse struct {
+ ID string `json:"id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ Category APIPerformanceUseCaseGetResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Prompt respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseGetResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseGetResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseGetResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseUpdateResponse struct {
+ ID string `json:"id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ Category APIPerformanceUseCaseUpdateResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Prompt respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseUpdateResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseUpdateResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseUpdateResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseListResponse struct {
+ ID string `json:"id" api:"required"`
+ Prompt string `json:"prompt" api:"required"`
+ Category APIPerformanceUseCaseListResponseCategory `json:"category" api:"nullable"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ Description string `json:"description" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Prompt respjson.Field
+ Category respjson.Field
+ CreatedAt respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseListResponse) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseListResponseCategory struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ Slug string `json:"slug" api:"required"`
+ SortOrder int64 `json:"sort_order"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ Slug respjson.Field
+ SortOrder respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r APIPerformanceUseCaseListResponseCategory) RawJSON() string { return r.JSON.raw }
+func (r *APIPerformanceUseCaseListResponseCategory) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseDeleteResponse = any
+
+type APIPerformanceUseCaseNewParams struct {
+ Prompt string `json:"prompt" api:"required"`
+ CategoryName param.Opt[string] `json:"category_name,omitzero"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ paramObj
+}
+
+func (r APIPerformanceUseCaseNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformanceUseCaseNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformanceUseCaseNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type APIPerformanceUseCaseUpdateParams struct {
+ CategoryName param.Opt[string] `json:"category_name,omitzero"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ Prompt param.Opt[string] `json:"prompt,omitzero"`
+ paramObj
+}
+
+func (r APIPerformanceUseCaseUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow APIPerformanceUseCaseUpdateParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *APIPerformanceUseCaseUpdateParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/apiperformanceusecase_test.go b/apiperformanceusecase_test.go
new file mode 100644
index 0000000..0c0493c
--- /dev/null
+++ b/apiperformanceusecase_test.go
@@ -0,0 +1,141 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/usesapient/go-sdk"
+ "github.com/usesapient/go-sdk/internal/testutil"
+ "github.com/usesapient/go-sdk/option"
+)
+
+func TestAPIPerformanceUseCaseNewWithOptionalParams(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.APIPerformance.UseCases.New(context.TODO(), githubcomusesapientgosdk.APIPerformanceUseCaseNewParams{
+ Prompt: "x",
+ CategoryName: githubcomusesapientgosdk.String("category_name"),
+ Description: githubcomusesapientgosdk.String("description"),
+ })
+ 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())
+ }
+}
+
+func TestAPIPerformanceUseCaseGet(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.APIPerformance.UseCases.Get(context.TODO(), "use_case_id")
+ 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())
+ }
+}
+
+func TestAPIPerformanceUseCaseUpdateWithOptionalParams(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.APIPerformance.UseCases.Update(
+ context.TODO(),
+ "use_case_id",
+ githubcomusesapientgosdk.APIPerformanceUseCaseUpdateParams{
+ CategoryName: githubcomusesapientgosdk.String("category_name"),
+ Description: githubcomusesapientgosdk.String("description"),
+ Prompt: githubcomusesapientgosdk.String("x"),
+ },
+ )
+ 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())
+ }
+}
+
+func TestAPIPerformanceUseCaseList(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.APIPerformance.UseCases.List(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())
+ }
+}
+
+func TestAPIPerformanceUseCaseDelete(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.APIPerformance.UseCases.Delete(context.TODO(), "use_case_id")
+ 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/apiprompt.go b/apiprompt.go
deleted file mode 100644
index afd65ab..0000000
--- a/apiprompt.go
+++ /dev/null
@@ -1,148 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "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/param"
- "github.com/usesapient/go-sdk/packages/respjson"
-)
-
-// APIPromptService contains methods and other services that help with interacting
-// with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewAPIPromptService] method instead.
-type APIPromptService struct {
- options []option.RequestOption
-}
-
-// NewAPIPromptService generates a new service that applies the given options to
-// each request. These options are applied after the parent client's options (if
-// there is one), and before any request-specific options.
-func NewAPIPromptService(opts ...option.RequestOption) (r APIPromptService) {
- r = APIPromptService{}
- r.options = opts
- return
-}
-
-// Create Prompt Batch
-func (r *APIPromptService) NewBatch(ctx context.Context, body APIPromptNewBatchParams, opts ...option.RequestOption) (res *APIPromptNewBatchResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/api/prompts/batch"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return res, err
-}
-
-// Create Prompt Batch
-func (r *APIPromptService) Batch(ctx context.Context, body APIPromptBatchParams, opts ...option.RequestOption) (res *APIPromptBatchResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/api/prompts/batch"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return res, err
-}
-
-type APIPromptNewBatchResponse struct {
- Count int64 `json:"count" api:"required"`
- Created []map[string]any `json:"created" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Count respjson.Field
- Created respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r APIPromptNewBatchResponse) RawJSON() string { return r.JSON.raw }
-func (r *APIPromptNewBatchResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type APIPromptBatchResponse struct {
- Count int64 `json:"count" api:"required"`
- Created []map[string]any `json:"created" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Count respjson.Field
- Created respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r APIPromptBatchResponse) RawJSON() string { return r.JSON.raw }
-func (r *APIPromptBatchResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type APIPromptNewBatchParams struct {
- Prompts []APIPromptNewBatchParamsPrompt `json:"prompts,omitzero" api:"required"`
- paramObj
-}
-
-func (r APIPromptNewBatchParams) MarshalJSON() (data []byte, err error) {
- type shadow APIPromptNewBatchParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *APIPromptNewBatchParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// The properties LanguageID, RegionID, Text, TopicID are required.
-type APIPromptNewBatchParamsPrompt struct {
- LanguageID string `json:"language_id" api:"required"`
- RegionID string `json:"region_id" api:"required"`
- Text string `json:"text" api:"required"`
- TopicID string `json:"topic_id" api:"required"`
- PlatformIDs []string `json:"platform_ids,omitzero"`
- paramObj
-}
-
-func (r APIPromptNewBatchParamsPrompt) MarshalJSON() (data []byte, err error) {
- type shadow APIPromptNewBatchParamsPrompt
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *APIPromptNewBatchParamsPrompt) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type APIPromptBatchParams struct {
- Prompts []APIPromptBatchParamsPrompt `json:"prompts,omitzero" api:"required"`
- paramObj
-}
-
-func (r APIPromptBatchParams) MarshalJSON() (data []byte, err error) {
- type shadow APIPromptBatchParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *APIPromptBatchParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// The properties LanguageID, RegionID, Text, TopicID are required.
-type APIPromptBatchParamsPrompt struct {
- LanguageID string `json:"language_id" api:"required"`
- RegionID string `json:"region_id" api:"required"`
- Text string `json:"text" api:"required"`
- TopicID string `json:"topic_id" api:"required"`
- PlatformIDs []string `json:"platform_ids,omitzero"`
- paramObj
-}
-
-func (r APIPromptBatchParamsPrompt) MarshalJSON() (data []byte, err error) {
- type shadow APIPromptBatchParamsPrompt
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *APIPromptBatchParamsPrompt) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
diff --git a/auth.go b/auth.go
index 9273082..4c71b21 100644
--- a/auth.go
+++ b/auth.go
@@ -12,13 +12,13 @@ import (
)
// AuthService contains methods and other services that help with interacting with
-// the sapient API.
+// the Sapient API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewAuthService] method instead.
type AuthService struct {
- options []option.RequestOption
+ Options []option.RequestOption
}
// NewAuthService generates a new service that applies the given options to each
@@ -26,26 +26,16 @@ type AuthService struct {
// is one), and before any request-specific options.
func NewAuthService(opts ...option.RequestOption) (r AuthService) {
r = AuthService{}
- r.options = opts
+ r.Options = opts
return
}
-// Get Auth Status
-func (r *AuthService) GetStatus(ctx context.Context, opts ...option.RequestOption) (res *AuthGetStatusResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/auth/status"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
// Get Auth Status
func (r *AuthService) Status(ctx context.Context, opts ...option.RequestOption) (res *AuthStatusResponse, err error) {
- opts = slices.Concat(r.options, opts)
+ opts = slices.Concat(r.Options, opts)
path := "v1/auth/status"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
-type AuthGetStatusResponse = any
-
type AuthStatusResponse = any
diff --git a/auth_test.go b/auth_test.go
index 15d3eb4..c91ffa4 100644
--- a/auth_test.go
+++ b/auth_test.go
@@ -13,29 +13,6 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestAuthGetStatus(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.Auth.GetStatus(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())
- }
-}
-
func TestAuthStatus(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
diff --git a/client.go b/client.go
index 3d7aaf7..b05c933 100644
--- a/client.go
+++ b/client.go
@@ -14,31 +14,23 @@ import (
)
// Client creates a struct with services and top level methods that help with
-// interacting with the sapient API. You should not instantiate this client
+// interacting with the Sapient API. You should not instantiate this client
// directly, and instead use the [NewClient] method instead.
type Client struct {
- options []option.RequestOption
- Status StatusService
- Auth AuthService
- Context ContextService
- EvalRuns EvalRunService
- Prompts PromptService
- Workflows WorkflowService
- WorkflowRuns WorkflowRunService
- API APIService
+ Options []option.RequestOption
+ Status StatusService
+ Auth AuthService
+ Prompts PromptService
+ APIPerformance APIPerformanceService
}
// DefaultClientOptions read from the environment (SAPIENT_API_KEY,
-// SAPIENT_BEARER_TOKEN, SAPIENT_BASE_URL). This should be used to initialize new
-// clients.
+// SAPIENT_BASE_URL). This should be used to initialize new clients.
func DefaultClientOptions() []option.RequestOption {
defaults := []option.RequestOption{option.WithHTTPClient(defaultHTTPClient()), option.WithEnvironmentProduction()}
if o, ok := os.LookupEnv("SAPIENT_BASE_URL"); ok {
defaults = append(defaults, option.WithBaseURL(o))
}
- if o, ok := os.LookupEnv("SAPIENT_BEARER_TOKEN"); ok {
- defaults = append(defaults, option.WithBearerToken(o))
- }
if o, ok := os.LookupEnv("SAPIENT_API_KEY"); ok {
defaults = append(defaults, option.WithAPIKey(o))
}
@@ -54,22 +46,18 @@ func DefaultClientOptions() []option.RequestOption {
}
// NewClient generates a new client with the default option read from the
-// environment (SAPIENT_API_KEY, SAPIENT_BEARER_TOKEN, SAPIENT_BASE_URL). The
-// option passed in as arguments are applied after these default arguments, and all
-// option will be passed down to the services and requests that this client makes.
+// environment (SAPIENT_API_KEY, SAPIENT_BASE_URL). The option passed in as
+// arguments are applied after these default arguments, and all option will be
+// passed down to the services and requests that this client makes.
func NewClient(opts ...option.RequestOption) (r Client) {
opts = append(DefaultClientOptions(), opts...)
- r = Client{options: opts}
+ r = Client{Options: opts}
r.Status = NewStatusService(opts...)
r.Auth = NewAuthService(opts...)
- r.Context = NewContextService(opts...)
- r.EvalRuns = NewEvalRunService(opts...)
r.Prompts = NewPromptService(opts...)
- r.Workflows = NewWorkflowService(opts...)
- r.WorkflowRuns = NewWorkflowRunService(opts...)
- r.API = NewAPIService(opts...)
+ r.APIPerformance = NewAPIPerformanceService(opts...)
return
}
@@ -106,7 +94,7 @@ func NewClient(opts ...option.RequestOption) (r Client) {
// For even greater flexibility, see [option.WithResponseInto] and
// [option.WithResponseBodyInto].
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error {
- opts = slices.Concat(r.options, opts)
+ opts = slices.Concat(r.Options, opts)
return requestconfig.ExecuteNewRequest(ctx, method, path, params, res, opts...)
}
diff --git a/context.go b/context.go
deleted file mode 100644
index 6187a54..0000000
--- a/context.go
+++ /dev/null
@@ -1,312 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/usesapient/go-sdk/internal/apijson"
- "github.com/usesapient/go-sdk/internal/apiquery"
- "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"
-)
-
-// ContextService contains methods and other services that help with interacting
-// with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewContextService] method instead.
-type ContextService struct {
- options []option.RequestOption
-}
-
-// NewContextService generates a new service that applies the given options to each
-// request. These options are applied after the parent client's options (if there
-// is one), and before any request-specific options.
-func NewContextService(opts ...option.RequestOption) (r ContextService) {
- r = ContextService{}
- r.options = opts
- return
-}
-
-// Get Company Context
-func (r *ContextService) GetCompany(ctx context.Context, company string, query ContextGetCompanyParams, opts ...option.RequestOption) (res *ContextGetCompanyResponse, err error) {
- opts = slices.Concat(r.options, opts)
- if company == "" {
- err = errors.New("missing required company parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/context/company/%s", url.PathEscape(company))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-// Get Company Context
-func (r *ContextService) Company(ctx context.Context, company string, query ContextCompanyParams, opts ...option.RequestOption) (res *ContextCompanyResponse, err error) {
- opts = slices.Concat(r.options, opts)
- if company == "" {
- err = errors.New("missing required company parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/context/company/%s", url.PathEscape(company))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-type EvalRunSummary struct {
- ID string `json:"id" api:"required"`
- Endpoint EvalRunSummaryEndpointUnion `json:"endpoint" 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"`
- RunAt string `json:"run_at" api:"nullable"`
- Score float64 `json:"score" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Endpoint respjson.Field
- EvalType respjson.Field
- FailureReasons respjson.Field
- LatencyMs respjson.Field
- Model respjson.Field
- ModelType respjson.Field
- Passed respjson.Field
- Platform respjson.Field
- RunAt respjson.Field
- Score respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EvalRunSummary) RawJSON() string { return r.JSON.raw }
-func (r *EvalRunSummary) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// EvalRunSummaryEndpointUnion contains all possible properties and values from
-// [PublicEndpoint], [map[string]any].
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-//
-// If the underlying value is not a json object, one of the following properties
-// will be valid: OfEvalRunSummaryEndpointMapItem]
-type EvalRunSummaryEndpointUnion struct {
- // This field will be present if the value is a [any] instead of an object.
- OfEvalRunSummaryEndpointMapItem any `json:",inline"`
- // This field is from variant [PublicEndpoint].
- ID string `json:"id"`
- // This field is from variant [PublicEndpoint].
- Category map[string]any `json:"category"`
- // This field is from variant [PublicEndpoint].
- Description string `json:"description"`
- // This field is from variant [PublicEndpoint].
- Method string `json:"method"`
- // This field is from variant [PublicEndpoint].
- Path string `json:"path"`
- JSON struct {
- OfEvalRunSummaryEndpointMapItem respjson.Field
- ID respjson.Field
- Category respjson.Field
- Description respjson.Field
- Method respjson.Field
- Path respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u EvalRunSummaryEndpointUnion) AsPublicEndpoint() (v PublicEndpoint) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u EvalRunSummaryEndpointUnion) AsAnyMap() (v map[string]any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u EvalRunSummaryEndpointUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *EvalRunSummaryEndpointUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type PublicCompany struct {
- // Sapient brand ID.
- BrandID string `json:"brand_id" api:"required"`
- Name string `json:"name" api:"required"`
- Domain string `json:"domain" api:"nullable"`
- LogoURL string `json:"logo_url" api:"nullable"`
- // Organization-scoped brand relationship ID.
- OrgBrandID string `json:"org_brand_id" api:"nullable"`
- Relationship string `json:"relationship" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- BrandID respjson.Field
- Name respjson.Field
- Domain respjson.Field
- LogoURL respjson.Field
- OrgBrandID respjson.Field
- Relationship respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r PublicCompany) RawJSON() string { return r.JSON.raw }
-func (r *PublicCompany) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type PublicEndpoint struct {
- ID string `json:"id" api:"required"`
- Category map[string]any `json:"category" api:"nullable"`
- Description string `json:"description" api:"nullable"`
- Method string `json:"method" api:"nullable"`
- Path string `json:"path" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Category respjson.Field
- Description respjson.Field
- Method respjson.Field
- Path respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r PublicEndpoint) RawJSON() string { return r.JSON.raw }
-func (r *PublicEndpoint) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ContextGetCompanyResponse struct {
- Company PublicCompany `json:"company" api:"required"`
- Endpoints []PublicEndpoint `json:"endpoints"`
- FailureAnalysis FailureAnalysisSnapshot `json:"failure_analysis" api:"nullable"`
- LatestRuns []EvalRunSummary `json:"latest_runs"`
- Markdown string `json:"markdown" api:"nullable"`
- // Requested context use case.
- Purpose string `json:"purpose" api:"nullable"`
- // Requested lookback window.
- Since string `json:"since" api:"nullable"`
- Summary map[string]any `json:"summary"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Company respjson.Field
- Endpoints respjson.Field
- FailureAnalysis respjson.Field
- LatestRuns respjson.Field
- Markdown respjson.Field
- Purpose respjson.Field
- Since respjson.Field
- Summary respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ContextGetCompanyResponse) RawJSON() string { return r.JSON.raw }
-func (r *ContextGetCompanyResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ContextCompanyResponse struct {
- Company PublicCompany `json:"company" api:"required"`
- Endpoints []PublicEndpoint `json:"endpoints"`
- FailureAnalysis FailureAnalysisSnapshot `json:"failure_analysis" api:"nullable"`
- LatestRuns []EvalRunSummary `json:"latest_runs"`
- Markdown string `json:"markdown" api:"nullable"`
- // Requested context use case.
- Purpose string `json:"purpose" api:"nullable"`
- // Requested lookback window.
- Since string `json:"since" api:"nullable"`
- Summary map[string]any `json:"summary"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Company respjson.Field
- Endpoints respjson.Field
- FailureAnalysis respjson.Field
- LatestRuns respjson.Field
- Markdown respjson.Field
- Purpose respjson.Field
- Since respjson.Field
- Summary respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ContextCompanyResponse) RawJSON() string { return r.JSON.raw }
-func (r *ContextCompanyResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ContextGetCompanyParams struct {
- For param.Opt[string] `query:"for,omitzero" json:"-"`
- Since param.Opt[string] `query:"since,omitzero" json:"-"`
- // Any of "json", "markdown", "md".
- Format ContextGetCompanyParamsFormat `query:"format,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [ContextGetCompanyParams]'s query parameters as
-// `url.Values`.
-func (r ContextGetCompanyParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
-
-type ContextGetCompanyParamsFormat string
-
-const (
- ContextGetCompanyParamsFormatJson ContextGetCompanyParamsFormat = "json"
- ContextGetCompanyParamsFormatMarkdown ContextGetCompanyParamsFormat = "markdown"
- ContextGetCompanyParamsFormatMd ContextGetCompanyParamsFormat = "md"
-)
-
-type ContextCompanyParams struct {
- For param.Opt[string] `query:"for,omitzero" json:"-"`
- Since param.Opt[string] `query:"since,omitzero" json:"-"`
- // Any of "json", "markdown", "md".
- Format ContextCompanyParamsFormat `query:"format,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [ContextCompanyParams]'s query parameters as `url.Values`.
-func (r ContextCompanyParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
-
-type ContextCompanyParamsFormat string
-
-const (
- ContextCompanyParamsFormatJson ContextCompanyParamsFormat = "json"
- ContextCompanyParamsFormatMarkdown ContextCompanyParamsFormat = "markdown"
- ContextCompanyParamsFormatMd ContextCompanyParamsFormat = "md"
-)
diff --git a/evalrun.go b/evalrun.go
deleted file mode 100644
index 1a1cdcc..0000000
--- a/evalrun.go
+++ /dev/null
@@ -1,319 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/usesapient/go-sdk/internal/apijson"
- "github.com/usesapient/go-sdk/internal/apiquery"
- "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"
-)
-
-// EvalRunService contains methods and other services that help with interacting
-// with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewEvalRunService] method instead.
-type EvalRunService struct {
- options []option.RequestOption
-}
-
-// NewEvalRunService generates a new service that applies the given options to each
-// request. These options are applied after the parent client's options (if there
-// is one), and before any request-specific options.
-func NewEvalRunService(opts ...option.RequestOption) (r EvalRunService) {
- r = EvalRunService{}
- r.options = opts
- return
-}
-
-// Retrieve Eval Run
-func (r *EvalRunService) Get(ctx context.Context, runID string, opts ...option.RequestOption) (res *EvalRunGetResponse, err error) {
- opts = slices.Concat(r.options, opts)
- if runID == "" {
- err = errors.New("missing required run_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/eval-runs/%s", url.PathEscape(runID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
-// List Eval Runs
-func (r *EvalRunService) List(ctx context.Context, query EvalRunListParams, opts ...option.RequestOption) (res *EvalRunListResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/eval-runs"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return res, err
-}
-
-// Diagnose Eval Runs
-func (r *EvalRunService) Diagnose(ctx context.Context, body EvalRunDiagnoseParams, opts ...option.RequestOption) (res *EvalRunDiagnoseResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/eval-runs/diagnose"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return res, err
-}
-
-type EvalRunDetail struct {
- ID string `json:"id" api:"required"`
- Endpoint EvalRunDetailEndpointUnion `json:"endpoint" api:"nullable"`
- EvalType string `json:"eval_type" api:"nullable"`
- ExecutionStderr string `json:"execution_stderr" api:"nullable"`
- ExecutionStdout string `json:"execution_stdout" api:"nullable"`
- ExitCode int64 `json:"exit_code" 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"`
- PromptSent string `json:"prompt_sent" api:"nullable"`
- Raw map[string]any `json:"raw" api:"nullable"`
- ResponseText string `json:"response_text" api:"nullable"`
- RunAt string `json:"run_at" api:"nullable"`
- Score float64 `json:"score" api:"nullable"`
- ToolCalls []map[string]any `json:"tool_calls" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Endpoint respjson.Field
- EvalType respjson.Field
- ExecutionStderr respjson.Field
- ExecutionStdout respjson.Field
- ExitCode respjson.Field
- FailureReasons respjson.Field
- LatencyMs respjson.Field
- Model respjson.Field
- ModelType respjson.Field
- Passed respjson.Field
- Platform respjson.Field
- PromptSent respjson.Field
- Raw respjson.Field
- ResponseText respjson.Field
- RunAt respjson.Field
- Score respjson.Field
- ToolCalls respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EvalRunDetail) RawJSON() string { return r.JSON.raw }
-func (r *EvalRunDetail) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// EvalRunDetailEndpointUnion contains all possible properties and values from
-// [PublicEndpoint], [map[string]any].
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-//
-// If the underlying value is not a json object, one of the following properties
-// will be valid: OfEvalRunDetailEndpointMapItem]
-type EvalRunDetailEndpointUnion struct {
- // This field will be present if the value is a [any] instead of an object.
- OfEvalRunDetailEndpointMapItem any `json:",inline"`
- // This field is from variant [PublicEndpoint].
- ID string `json:"id"`
- // This field is from variant [PublicEndpoint].
- Category map[string]any `json:"category"`
- // This field is from variant [PublicEndpoint].
- Description string `json:"description"`
- // This field is from variant [PublicEndpoint].
- Method string `json:"method"`
- // This field is from variant [PublicEndpoint].
- Path string `json:"path"`
- JSON struct {
- OfEvalRunDetailEndpointMapItem respjson.Field
- ID respjson.Field
- Category respjson.Field
- Description respjson.Field
- Method respjson.Field
- Path respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u EvalRunDetailEndpointUnion) AsPublicEndpoint() (v PublicEndpoint) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u EvalRunDetailEndpointUnion) AsAnyMap() (v map[string]any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u EvalRunDetailEndpointUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *EvalRunDetailEndpointUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type PublicListMeta struct {
- Count int64 `json:"count" api:"required"`
- Limit int64 `json:"limit" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Count respjson.Field
- Limit respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r PublicListMeta) RawJSON() string { return r.JSON.raw }
-func (r *PublicListMeta) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type EvalRunGetResponse struct {
- Data EvalRunDetail `json:"data" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Data respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EvalRunGetResponse) RawJSON() string { return r.JSON.raw }
-func (r *EvalRunGetResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type EvalRunListResponse struct {
- Company PublicCompany `json:"company" api:"required"`
- Data []EvalRunSummary `json:"data" api:"required"`
- Meta PublicListMeta `json:"meta" api:"required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Company respjson.Field
- Data respjson.Field
- Meta respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EvalRunListResponse) RawJSON() string { return r.JSON.raw }
-func (r *EvalRunListResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type EvalRunDiagnoseResponse struct {
- Company PublicCompany `json:"company" api:"required"`
- FailureAnalysis FailureAnalysisSnapshot `json:"failure_analysis" api:"required"`
- Since string `json:"since" api:"required"`
- Summary EvalRunDiagnoseResponseSummary `json:"summary" api:"required"`
- Examples []EvalRunDetail `json:"examples"`
- Markdown string `json:"markdown" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Company respjson.Field
- FailureAnalysis respjson.Field
- Since respjson.Field
- Summary respjson.Field
- Examples respjson.Field
- Markdown respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EvalRunDiagnoseResponse) RawJSON() string { return r.JSON.raw }
-func (r *EvalRunDiagnoseResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type EvalRunDiagnoseResponseSummary struct {
- FailedRuns int64 `json:"failed_runs"`
- FailureRate float64 `json:"failure_rate" api:"nullable"`
- PassedRuns int64 `json:"passed_runs"`
- TopFailedEndpoints []map[string]any `json:"top_failed_endpoints"`
- TopFailedModels []map[string]any `json:"top_failed_models"`
- TopFailureReasons []map[string]any `json:"top_failure_reasons"`
- TotalRuns int64 `json:"total_runs"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- FailedRuns respjson.Field
- FailureRate respjson.Field
- PassedRuns respjson.Field
- TopFailedEndpoints respjson.Field
- TopFailedModels respjson.Field
- TopFailureReasons respjson.Field
- TotalRuns respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EvalRunDiagnoseResponseSummary) RawJSON() string { return r.JSON.raw }
-func (r *EvalRunDiagnoseResponseSummary) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type EvalRunListParams struct {
- Company string `query:"company" api:"required" json:"-"`
- Since param.Opt[string] `query:"since,omitzero" json:"-"`
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [EvalRunListParams]'s query parameters as `url.Values`.
-func (r EvalRunListParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
-
-type EvalRunDiagnoseParams struct {
- // Company name, domain, brand ID, or org brand ID.
- Company string `json:"company" api:"required"`
- IncludeExamples param.Opt[bool] `json:"include_examples,omitzero"`
- MaxExamples param.Opt[int64] `json:"max_examples,omitzero"`
- // Lookback window, such as 20d, 72h, or an ISO timestamp.
- Since param.Opt[string] `json:"since,omitzero"`
- // Report format to include in the response.
- //
- // Any of "json", "markdown", "md".
- Format EvalRunDiagnoseParamsFormat `json:"format,omitzero"`
- paramObj
-}
-
-func (r EvalRunDiagnoseParams) MarshalJSON() (data []byte, err error) {
- type shadow EvalRunDiagnoseParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *EvalRunDiagnoseParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Report format to include in the response.
-type EvalRunDiagnoseParamsFormat string
-
-const (
- EvalRunDiagnoseParamsFormatJson EvalRunDiagnoseParamsFormat = "json"
- EvalRunDiagnoseParamsFormatMarkdown EvalRunDiagnoseParamsFormat = "markdown"
- EvalRunDiagnoseParamsFormatMd EvalRunDiagnoseParamsFormat = "md"
-)
diff --git a/evalrun_test.go b/evalrun_test.go
deleted file mode 100644
index 18145bc..0000000
--- a/evalrun_test.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk_test
-
-import (
- "context"
- "errors"
- "os"
- "testing"
-
- "github.com/usesapient/go-sdk"
- "github.com/usesapient/go-sdk/internal/testutil"
- "github.com/usesapient/go-sdk/option"
-)
-
-func TestEvalRunGet(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.EvalRuns.Get(context.TODO(), "run_id")
- 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())
- }
-}
-
-func TestEvalRunListWithOptionalParams(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.EvalRuns.List(context.TODO(), githubcomusesapientgosdk.EvalRunListParams{
- Company: "company",
- Limit: githubcomusesapientgosdk.Int(1),
- Since: githubcomusesapientgosdk.String("since"),
- })
- 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())
- }
-}
-
-func TestEvalRunDiagnoseWithOptionalParams(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.EvalRuns.Diagnose(context.TODO(), githubcomusesapientgosdk.EvalRunDiagnoseParams{
- Company: "company",
- Format: githubcomusesapientgosdk.EvalRunDiagnoseParamsFormatJson,
- IncludeExamples: githubcomusesapientgosdk.Bool(true),
- MaxExamples: githubcomusesapientgosdk.Int(1),
- Since: githubcomusesapientgosdk.String("since"),
- })
- 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/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index bf8ab63..4862048 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -218,7 +218,6 @@ type RequestConfig struct {
CustomHTTPDoer HTTPDoer
HTTPClient *http.Client
Middlewares []middleware
- BearerToken string
APIKey string
// If ResponseBodyInto not nil, then we will attempt to deserialize into
// ResponseBodyInto. If Destination is a []byte, then it will return the body as
@@ -593,7 +592,6 @@ func (cfg *RequestConfig) Clone(ctx context.Context) *RequestConfig {
BaseURL: cfg.BaseURL,
HTTPClient: cfg.HTTPClient,
Middlewares: cfg.Middlewares,
- BearerToken: cfg.BearerToken,
APIKey: cfg.APIKey,
}
diff --git a/option/requestoption.go b/option/requestoption.go
index 26f81a7..55a179a 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -15,7 +15,7 @@ import (
"github.com/usesapient/go-sdk/internal/requestconfig"
)
-// RequestOption is an option for the requests made by the sapient API Client
+// RequestOption is an option for the requests made by the Sapient API Client
// which can be supplied to clients, services, and methods. You can read more about this functional
// options pattern in our [README].
//
@@ -263,15 +263,7 @@ func WithRequestTimeout(dur time.Duration) RequestOption {
// environment to be the "production" environment. An environment specifies which base URL
// to use by default.
func WithEnvironmentProduction() RequestOption {
- return requestconfig.WithDefaultBaseURL("https://public-api.usesapient.com/")
-}
-
-// WithBearerToken returns a RequestOption that sets the client setting "bearer_token".
-func WithBearerToken(value string) RequestOption {
- return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.BearerToken = value
- return nil
- })
+ return requestconfig.WithDefaultBaseURL("https://api-public.usesapient.com/")
}
// WithAPIKey returns a RequestOption that sets the client setting "api_key".
diff --git a/prompt.go b/prompt.go
index c5643be..1826789 100644
--- a/prompt.go
+++ b/prompt.go
@@ -4,10 +4,14 @@ package githubcomusesapientgosdk
import (
"context"
+ "errors"
+ "fmt"
"net/http"
+ "net/url"
"slices"
"github.com/usesapient/go-sdk/internal/apijson"
+ "github.com/usesapient/go-sdk/internal/apiquery"
"github.com/usesapient/go-sdk/internal/requestconfig"
"github.com/usesapient/go-sdk/option"
"github.com/usesapient/go-sdk/packages/param"
@@ -15,13 +19,15 @@ import (
)
// PromptService contains methods and other services that help with interacting
-// with the sapient API.
+// with the Sapient API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewPromptService] method instead.
type PromptService struct {
- options []option.RequestOption
+ Options []option.RequestOption
+ Topics PromptTopicService
+ Platforms PromptPlatformService
}
// NewPromptService generates a new service that applies the given options to each
@@ -29,92 +35,559 @@ type PromptService struct {
// is one), and before any request-specific options.
func NewPromptService(opts ...option.RequestOption) (r PromptService) {
r = PromptService{}
- r.options = opts
+ r.Options = opts
+ r.Topics = NewPromptTopicService(opts...)
+ r.Platforms = NewPromptPlatformService(opts...)
return
}
-// Generate From List
-func (r *PromptService) GenerateFromList(ctx context.Context, body PromptGenerateFromListParams, opts ...option.RequestOption) (res *PromptGenerateFromListResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/prompts/generate-from-list"
+// Create Prompt
+func (r *PromptService) New(ctx context.Context, body PromptNewParams, opts ...option.RequestOption) (res *PromptNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/prompts"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
-type PromptGenerateFromListResponse struct {
- Count int64 `json:"count" api:"required"`
- Prompts []PromptGenerateFromListResponsePrompt `json:"prompts" api:"required"`
+// Retrieve Prompt
+func (r *PromptService) Get(ctx context.Context, promptID string, opts ...option.RequestOption) (res *PromptGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if promptID == "" {
+ err = errors.New("missing required prompt_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/prompts/%s", promptID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Update Prompt
+func (r *PromptService) Update(ctx context.Context, promptID string, body PromptUpdateParams, opts ...option.RequestOption) (res *PromptUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if promptID == "" {
+ err = errors.New("missing required prompt_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/prompts/%s", promptID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ return res, err
+}
+
+// List Prompts
+func (r *PromptService) List(ctx context.Context, query PromptListParams, opts ...option.RequestOption) (res *PromptListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/prompts"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
+ return res, err
+}
+
+// Delete Prompt
+func (r *PromptService) Delete(ctx context.Context, promptID string, opts ...option.RequestOption) (res *PromptDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if promptID == "" {
+ err = errors.New("missing required prompt_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/prompts/%s", promptID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return res, err
+}
+
+type PromptNewResponse struct {
+ ID string `json:"id" api:"required"`
+ Text string `json:"text" api:"required"`
+ TopicID string `json:"topic_id" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ IsActive bool `json:"is_active"`
+ LanguageID string `json:"language_id" api:"nullable"`
+ Platforms []PromptNewResponsePlatform `json:"platforms"`
+ RegionID string `json:"region_id" api:"nullable"`
+ // Any of "active", "inactive", "archived".
+ Status PromptNewResponseStatus `json:"status" api:"nullable"`
+ Tags []PromptNewResponseTag `json:"tags"`
+ Topic PromptNewResponseTopic `json:"topic" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Text respjson.Field
+ TopicID respjson.Field
+ CreatedAt respjson.Field
+ IsActive respjson.Field
+ LanguageID respjson.Field
+ Platforms respjson.Field
+ RegionID respjson.Field
+ Status respjson.Field
+ Tags respjson.Field
+ Topic respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptNewResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptNewResponsePlatform struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptNewResponsePlatform) RawJSON() string { return r.JSON.raw }
+func (r *PromptNewResponsePlatform) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptNewResponseStatus string
+
+const (
+ PromptNewResponseStatusActive PromptNewResponseStatus = "active"
+ PromptNewResponseStatusInactive PromptNewResponseStatus = "inactive"
+ PromptNewResponseStatusArchived PromptNewResponseStatus = "archived"
+)
+
+type PromptNewResponseTag struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptNewResponseTag) RawJSON() string { return r.JSON.raw }
+func (r *PromptNewResponseTag) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptNewResponseTopic struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptNewResponseTopic) RawJSON() string { return r.JSON.raw }
+func (r *PromptNewResponseTopic) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptGetResponse struct {
+ ID string `json:"id" api:"required"`
+ Text string `json:"text" api:"required"`
+ TopicID string `json:"topic_id" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ IsActive bool `json:"is_active"`
+ LanguageID string `json:"language_id" api:"nullable"`
+ Platforms []PromptGetResponsePlatform `json:"platforms"`
+ RegionID string `json:"region_id" api:"nullable"`
+ // Any of "active", "inactive", "archived".
+ Status PromptGetResponseStatus `json:"status" api:"nullable"`
+ Tags []PromptGetResponseTag `json:"tags"`
+ Topic PromptGetResponseTopic `json:"topic" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Text respjson.Field
+ TopicID respjson.Field
+ CreatedAt respjson.Field
+ IsActive respjson.Field
+ LanguageID respjson.Field
+ Platforms respjson.Field
+ RegionID respjson.Field
+ Status respjson.Field
+ Tags respjson.Field
+ Topic respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptGetResponsePlatform struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptGetResponsePlatform) RawJSON() string { return r.JSON.raw }
+func (r *PromptGetResponsePlatform) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptGetResponseStatus string
+
+const (
+ PromptGetResponseStatusActive PromptGetResponseStatus = "active"
+ PromptGetResponseStatusInactive PromptGetResponseStatus = "inactive"
+ PromptGetResponseStatusArchived PromptGetResponseStatus = "archived"
+)
+
+type PromptGetResponseTag struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptGetResponseTag) RawJSON() string { return r.JSON.raw }
+func (r *PromptGetResponseTag) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptGetResponseTopic struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptGetResponseTopic) RawJSON() string { return r.JSON.raw }
+func (r *PromptGetResponseTopic) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptUpdateResponse struct {
+ ID string `json:"id" api:"required"`
+ Text string `json:"text" api:"required"`
+ TopicID string `json:"topic_id" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ IsActive bool `json:"is_active"`
+ LanguageID string `json:"language_id" api:"nullable"`
+ Platforms []PromptUpdateResponsePlatform `json:"platforms"`
+ RegionID string `json:"region_id" api:"nullable"`
+ // Any of "active", "inactive", "archived".
+ Status PromptUpdateResponseStatus `json:"status" api:"nullable"`
+ Tags []PromptUpdateResponseTag `json:"tags"`
+ Topic PromptUpdateResponseTopic `json:"topic" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Text respjson.Field
+ TopicID respjson.Field
+ CreatedAt respjson.Field
+ IsActive respjson.Field
+ LanguageID respjson.Field
+ Platforms respjson.Field
+ RegionID respjson.Field
+ Status respjson.Field
+ Tags respjson.Field
+ Topic respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptUpdateResponsePlatform struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptUpdateResponsePlatform) RawJSON() string { return r.JSON.raw }
+func (r *PromptUpdateResponsePlatform) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptUpdateResponseStatus string
+
+const (
+ PromptUpdateResponseStatusActive PromptUpdateResponseStatus = "active"
+ PromptUpdateResponseStatusInactive PromptUpdateResponseStatus = "inactive"
+ PromptUpdateResponseStatusArchived PromptUpdateResponseStatus = "archived"
+)
+
+type PromptUpdateResponseTag struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptUpdateResponseTag) RawJSON() string { return r.JSON.raw }
+func (r *PromptUpdateResponseTag) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptUpdateResponseTopic struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptUpdateResponseTopic) RawJSON() string { return r.JSON.raw }
+func (r *PromptUpdateResponseTopic) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptListResponse struct {
+ Count int64 `json:"count" api:"required"`
+ Data []PromptListResponseData `json:"data" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Count respjson.Field
- Prompts respjson.Field
+ Data respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptListResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptListResponseData struct {
+ ID string `json:"id" api:"required"`
+ Text string `json:"text" api:"required"`
+ TopicID string `json:"topic_id" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ IsActive bool `json:"is_active"`
+ LanguageID string `json:"language_id" api:"nullable"`
+ Platforms []PromptListResponseDataPlatform `json:"platforms"`
+ RegionID string `json:"region_id" api:"nullable"`
+ // Any of "active", "inactive", "archived".
+ Status string `json:"status" api:"nullable"`
+ Tags []PromptListResponseDataTag `json:"tags"`
+ Topic PromptListResponseDataTopic `json:"topic" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Text respjson.Field
+ TopicID respjson.Field
+ CreatedAt respjson.Field
+ IsActive respjson.Field
+ LanguageID respjson.Field
+ Platforms respjson.Field
+ RegionID respjson.Field
+ Status respjson.Field
+ Tags respjson.Field
+ Topic respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptListResponseData) RawJSON() string { return r.JSON.raw }
+func (r *PromptListResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptListResponseDataPlatform struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptListResponseDataPlatform) RawJSON() string { return r.JSON.raw }
+func (r *PromptListResponseDataPlatform) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptListResponseDataTag struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r PromptGenerateFromListResponse) RawJSON() string { return r.JSON.raw }
-func (r *PromptGenerateFromListResponse) UnmarshalJSON(data []byte) error {
+func (r PromptListResponseDataTag) RawJSON() string { return r.JSON.raw }
+func (r *PromptListResponseDataTag) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PromptGenerateFromListResponsePrompt struct {
- SourceName string `json:"source_name" api:"required"`
- Text string `json:"text" api:"required"`
- Goal string `json:"goal" api:"nullable"`
- Metadata map[string]any `json:"metadata"`
- SourceDomain string `json:"source_domain" api:"nullable"`
+type PromptListResponseDataTopic struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- SourceName respjson.Field
- Text respjson.Field
- Goal respjson.Field
- Metadata respjson.Field
- SourceDomain respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r PromptGenerateFromListResponsePrompt) RawJSON() string { return r.JSON.raw }
-func (r *PromptGenerateFromListResponsePrompt) UnmarshalJSON(data []byte) error {
+func (r PromptListResponseDataTopic) RawJSON() string { return r.JSON.raw }
+func (r *PromptListResponseDataTopic) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PromptGenerateFromListParams struct {
- Items []PromptGenerateFromListParamsItem `json:"items,omitzero" api:"required"`
- // Prompt goal or evaluation theme.
- Goal param.Opt[string] `json:"goal,omitzero"`
- CountPerItem param.Opt[int64] `json:"count_per_item,omitzero"`
- IncludeAgentTasks param.Opt[bool] `json:"include_agent_tasks,omitzero"`
- Language param.Opt[string] `json:"language,omitzero"`
- Region param.Opt[string] `json:"region,omitzero"`
+type PromptDeleteResponse = any
+
+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"`
paramObj
}
-func (r PromptGenerateFromListParams) MarshalJSON() (data []byte, err error) {
- type shadow PromptGenerateFromListParams
+func (r PromptNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow PromptNewParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PromptGenerateFromListParams) UnmarshalJSON(data []byte) error {
+func (r *PromptNewParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The property Name is required.
-type PromptGenerateFromListParamsItem struct {
- Name string `json:"name" api:"required"`
- Category param.Opt[string] `json:"category,omitzero"`
- Domain param.Opt[string] `json:"domain,omitzero"`
- Notes param.Opt[string] `json:"notes,omitzero"`
+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"`
paramObj
}
-func (r PromptGenerateFromListParamsItem) MarshalJSON() (data []byte, err error) {
- type shadow PromptGenerateFromListParamsItem
+func (r PromptUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow PromptUpdateParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PromptGenerateFromListParamsItem) UnmarshalJSON(data []byte) error {
+func (r *PromptUpdateParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+
+type PromptListParams struct {
+ IsActive param.Opt[bool] `query:"is_active,omitzero" json:"-"`
+ Status param.Opt[string] `query:"status,omitzero" json:"-"`
+ TopicID param.Opt[string] `query:"topic_id,omitzero" json:"-"`
+ IncludeArchived param.Opt[bool] `query:"include_archived,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [PromptListParams]'s query parameters as `url.Values`.
+func (r PromptListParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
diff --git a/prompt_test.go b/prompt_test.go
index fb712fb..a7b927c 100644
--- a/prompt_test.go
+++ b/prompt_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestPromptGenerateFromListWithOptionalParams(t *testing.T) {
+func TestPromptNewWithOptionalParams(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,18 +26,12 @@ func TestPromptGenerateFromListWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Prompts.GenerateFromList(context.TODO(), githubcomusesapientgosdk.PromptGenerateFromListParams{
- Items: []githubcomusesapientgosdk.PromptGenerateFromListParamsItem{{
- Name: "name",
- Category: githubcomusesapientgosdk.String("category"),
- Domain: githubcomusesapientgosdk.String("domain"),
- Notes: githubcomusesapientgosdk.String("notes"),
- }},
- CountPerItem: githubcomusesapientgosdk.Int(1),
- Goal: githubcomusesapientgosdk.String("goal"),
- IncludeAgentTasks: githubcomusesapientgosdk.Bool(true),
- Language: githubcomusesapientgosdk.String("language"),
- Region: githubcomusesapientgosdk.String("region"),
+ _, 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
@@ -47,3 +41,111 @@ func TestPromptGenerateFromListWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestPromptGet(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.Get(context.TODO(), "prompt_id")
+ 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())
+ }
+}
+
+func TestPromptUpdateWithOptionalParams(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.Update(
+ context.TODO(),
+ "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"),
+ },
+ )
+ 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())
+ }
+}
+
+func TestPromptListWithOptionalParams(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.List(context.TODO(), githubcomusesapientgosdk.PromptListParams{
+ IncludeArchived: githubcomusesapientgosdk.Bool(true),
+ IsActive: githubcomusesapientgosdk.Bool(true),
+ Status: githubcomusesapientgosdk.String("archived"),
+ TopicID: githubcomusesapientgosdk.String("topic_id"),
+ })
+ 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())
+ }
+}
+
+func TestPromptDelete(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.Delete(context.TODO(), "prompt_id")
+ 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
new file mode 100644
index 0000000..2f85aaf
--- /dev/null
+++ b/promptplatform.go
@@ -0,0 +1,41 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "net/http"
+ "slices"
+
+ "github.com/usesapient/go-sdk/internal/requestconfig"
+ "github.com/usesapient/go-sdk/option"
+)
+
+// PromptPlatformService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewPromptPlatformService] method instead.
+type PromptPlatformService struct {
+ Options []option.RequestOption
+}
+
+// NewPromptPlatformService generates a new service that applies the given options
+// to each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewPromptPlatformService(opts ...option.RequestOption) (r PromptPlatformService) {
+ r = PromptPlatformService{}
+ r.Options = opts
+ return
+}
+
+// List Platforms
+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
diff --git a/workflowrun_test.go b/promptplatform_test.go
similarity index 89%
rename from workflowrun_test.go
rename to promptplatform_test.go
index 039874e..4d1a9a5 100644
--- a/workflowrun_test.go
+++ b/promptplatform_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestWorkflowRunGet(t *testing.T) {
+func TestPromptPlatformList(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,7 +26,7 @@ func TestWorkflowRunGet(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.WorkflowRuns.Get(context.TODO(), "run_id")
+ _, err := client.Prompts.Platforms.List(context.TODO())
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
diff --git a/prompttopic.go b/prompttopic.go
new file mode 100644
index 0000000..8ea3572
--- /dev/null
+++ b/prompttopic.go
@@ -0,0 +1,170 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package githubcomusesapientgosdk
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "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/param"
+ "github.com/usesapient/go-sdk/packages/respjson"
+)
+
+// PromptTopicService contains methods and other services that help with
+// interacting with the Sapient API.
+//
+// Note, unlike clients, this service does not read variables from the environment
+// automatically. You should not instantiate this service directly, and instead use
+// the [NewPromptTopicService] method instead.
+type PromptTopicService struct {
+ Options []option.RequestOption
+}
+
+// NewPromptTopicService generates a new service that applies the given options to
+// each request. These options are applied after the parent client's options (if
+// there is one), and before any request-specific options.
+func NewPromptTopicService(opts ...option.RequestOption) (r PromptTopicService) {
+ r = PromptTopicService{}
+ r.Options = opts
+ return
+}
+
+// Create Topic
+func (r *PromptTopicService) New(ctx context.Context, body PromptTopicNewParams, opts ...option.RequestOption) (res *PromptTopicNewResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/prompts/topics"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return res, err
+}
+
+// Update Topic
+func (r *PromptTopicService) Update(ctx context.Context, topicID string, body PromptTopicUpdateParams, opts ...option.RequestOption) (res *PromptTopicUpdateResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if topicID == "" {
+ err = errors.New("missing required topic_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/prompts/topics/%s", topicID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ return res, err
+}
+
+// List Topics
+func (r *PromptTopicService) List(ctx context.Context, opts ...option.RequestOption) (res *[]PromptTopicListResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/prompts/topics"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return res, err
+}
+
+// Delete Topic
+func (r *PromptTopicService) Delete(ctx context.Context, topicID string, opts ...option.RequestOption) (res *PromptTopicDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if topicID == "" {
+ err = errors.New("missing required topic_id parameter")
+ return nil, err
+ }
+ path := fmt.Sprintf("v1/prompts/topics/%s", topicID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return res, err
+}
+
+type PromptTopicNewResponse struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptTopicNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptTopicNewResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptTopicUpdateResponse struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptTopicUpdateResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptTopicUpdateResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptTopicListResponse struct {
+ ID string `json:"id" api:"required"`
+ Name string `json:"name" api:"required"`
+ CreatedAt string `json:"created_at" api:"nullable"`
+ UpdatedAt string `json:"updated_at" api:"nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Name respjson.Field
+ CreatedAt respjson.Field
+ UpdatedAt respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r PromptTopicListResponse) RawJSON() string { return r.JSON.raw }
+func (r *PromptTopicListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptTopicDeleteResponse = any
+
+type PromptTopicNewParams struct {
+ Name string `json:"name" api:"required"`
+ paramObj
+}
+
+func (r PromptTopicNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow PromptTopicNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *PromptTopicNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type PromptTopicUpdateParams struct {
+ Name string `json:"name" api:"required"`
+ paramObj
+}
+
+func (r PromptTopicUpdateParams) MarshalJSON() (data []byte, err error) {
+ type shadow PromptTopicUpdateParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *PromptTopicUpdateParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/apijob_test.go b/prompttopic_test.go
similarity index 75%
rename from apijob_test.go
rename to prompttopic_test.go
index 564c136..d984a8d 100644
--- a/apijob_test.go
+++ b/prompttopic_test.go
@@ -13,7 +13,7 @@ import (
"github.com/usesapient/go-sdk/option"
)
-func TestAPIJobListJobsWithOptionalParams(t *testing.T) {
+func TestPromptTopicNew(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -26,10 +26,8 @@ func TestAPIJobListJobsWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Jobs.ListJobs(context.TODO(), githubcomusesapientgosdk.APIJobListJobsParams{
- Limit: githubcomusesapientgosdk.Int(1),
- Status: githubcomusesapientgosdk.String("status"),
- Type: githubcomusesapientgosdk.String("type"),
+ _, err := client.Prompts.Topics.New(context.TODO(), githubcomusesapientgosdk.PromptTopicNewParams{
+ Name: "x",
})
if err != nil {
var apierr *githubcomusesapientgosdk.Error
@@ -40,7 +38,7 @@ func TestAPIJobListJobsWithOptionalParams(t *testing.T) {
}
}
-func TestAPIJobGetJob(t *testing.T) {
+func TestPromptTopicUpdate(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -53,7 +51,13 @@ func TestAPIJobGetJob(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Jobs.GetJob(context.TODO(), "job_id")
+ _, err := client.Prompts.Topics.Update(
+ context.TODO(),
+ "topic_id",
+ githubcomusesapientgosdk.PromptTopicUpdateParams{
+ Name: "x",
+ },
+ )
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
@@ -63,7 +67,7 @@ func TestAPIJobGetJob(t *testing.T) {
}
}
-func TestAPIJobListWithOptionalParams(t *testing.T) {
+func TestPromptTopicList(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -76,11 +80,7 @@ func TestAPIJobListWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Jobs.List(context.TODO(), githubcomusesapientgosdk.APIJobListParams{
- Limit: githubcomusesapientgosdk.Int(1),
- Status: githubcomusesapientgosdk.String("status"),
- Type: githubcomusesapientgosdk.String("type"),
- })
+ _, err := client.Prompts.Topics.List(context.TODO())
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
@@ -90,7 +90,7 @@ func TestAPIJobListWithOptionalParams(t *testing.T) {
}
}
-func TestAPIJobGet(t *testing.T) {
+func TestPromptTopicDelete(t *testing.T) {
t.Skip("Mock server tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -103,7 +103,7 @@ func TestAPIJobGet(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.API.Jobs.Get(context.TODO(), "job_id")
+ _, err := client.Prompts.Topics.Delete(context.TODO(), "topic_id")
if err != nil {
var apierr *githubcomusesapientgosdk.Error
if errors.As(err, &apierr) {
diff --git a/status.go b/status.go
index dc2e5f0..565b6a8 100644
--- a/status.go
+++ b/status.go
@@ -12,13 +12,13 @@ import (
)
// StatusService contains methods and other services that help with interacting
-// with the sapient API.
+// with the Sapient API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewStatusService] method instead.
type StatusService struct {
- options []option.RequestOption
+ Options []option.RequestOption
}
// NewStatusService generates a new service that applies the given options to each
@@ -26,21 +26,13 @@ type StatusService struct {
// is one), and before any request-specific options.
func NewStatusService(opts ...option.RequestOption) (r StatusService) {
r = StatusService{}
- r.options = opts
+ r.Options = opts
return
}
// Get Status
func (r *StatusService) Get(ctx context.Context, opts ...option.RequestOption) (res *StatusGetResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/status"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
-// Get Status
-func (r *StatusService) Get(ctx context.Context, opts ...option.RequestOption) (res *StatusGetResponse, err error) {
- opts = slices.Concat(r.options, opts)
+ opts = slices.Concat(r.Options, opts)
path := "v1/status"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
diff --git a/status_test.go b/status_test.go
index 0a1d611..b994db2 100644
--- a/status_test.go
+++ b/status_test.go
@@ -35,26 +35,3 @@ func TestStatusGet(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
-
-func TestStatusGet(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.Status.Get(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/workflow.go b/workflow.go
deleted file mode 100644
index 1d3e5c1..0000000
--- a/workflow.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "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/param"
- "github.com/usesapient/go-sdk/packages/respjson"
-)
-
-// WorkflowService contains methods and other services that help with interacting
-// with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewWorkflowService] method instead.
-type WorkflowService struct {
- options []option.RequestOption
-}
-
-// NewWorkflowService generates a new service that applies the given options to
-// each request. These options are applied after the parent client's options (if
-// there is one), and before any request-specific options.
-func NewWorkflowService(opts ...option.RequestOption) (r WorkflowService) {
- r = WorkflowService{}
- r.options = opts
- return
-}
-
-// Create Workflow
-func (r *WorkflowService) New(ctx context.Context, body WorkflowNewParams, opts ...option.RequestOption) (res *WorkflowResponse, err error) {
- opts = slices.Concat(r.options, opts)
- path := "v1/workflows"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return res, err
-}
-
-// Retrieve Workflow
-func (r *WorkflowService) Get(ctx context.Context, workflowID string, opts ...option.RequestOption) (res *WorkflowResponse, err error) {
- opts = slices.Concat(r.options, opts)
- if workflowID == "" {
- err = errors.New("missing required workflow_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/workflows/%s", url.PathEscape(workflowID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
-// Run Workflow
-func (r *WorkflowService) Run(ctx context.Context, workflowID string, body WorkflowRunParams, opts ...option.RequestOption) (res *WorkflowRunResponse, err error) {
- opts = slices.Concat(r.options, opts)
- if workflowID == "" {
- err = errors.New("missing required workflow_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/workflows/%s/run", url.PathEscape(workflowID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return res, err
-}
-
-type WorkflowResponse struct {
- ID string `json:"id" api:"required"`
- Name string `json:"name" api:"required"`
- CreatedAt string `json:"created_at" api:"nullable"`
- Description string `json:"description" api:"nullable"`
- Metadata map[string]any `json:"metadata"`
- Steps []map[string]any `json:"steps"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Name respjson.Field
- CreatedAt respjson.Field
- Description respjson.Field
- Metadata respjson.Field
- Steps respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r WorkflowResponse) RawJSON() string { return r.JSON.raw }
-func (r *WorkflowResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type WorkflowRunResponse struct {
- RunID string `json:"run_id" api:"required"`
- Status string `json:"status" api:"required"`
- WorkflowID string `json:"workflow_id" api:"required"`
- Job PublicJob `json:"job" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- RunID respjson.Field
- Status respjson.Field
- WorkflowID respjson.Field
- Job respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r WorkflowRunResponse) RawJSON() string { return r.JSON.raw }
-func (r *WorkflowRunResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type WorkflowNewParams struct {
- Name string `json:"name" api:"required"`
- Description param.Opt[string] `json:"description,omitzero"`
- Metadata map[string]any `json:"metadata,omitzero"`
- Steps []map[string]any `json:"steps,omitzero"`
- paramObj
-}
-
-func (r WorkflowNewParams) MarshalJSON() (data []byte, err error) {
- type shadow WorkflowNewParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *WorkflowNewParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type WorkflowRunParams struct {
- // Workflow ID. Optional when passed in the URL.
- WorkflowID param.Opt[string] `json:"workflow_id,omitzero"`
- Watch param.Opt[bool] `json:"watch,omitzero"`
- Input map[string]any `json:"input,omitzero"`
- paramObj
-}
-
-func (r WorkflowRunParams) MarshalJSON() (data []byte, err error) {
- type shadow WorkflowRunParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *WorkflowRunParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
diff --git a/workflowrun.go b/workflowrun.go
deleted file mode 100644
index 8065549..0000000
--- a/workflowrun.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package githubcomusesapientgosdk
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "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"
-)
-
-// WorkflowRunService contains methods and other services that help with
-// interacting with the sapient API.
-//
-// Note, unlike clients, this service does not read variables from the environment
-// automatically. You should not instantiate this service directly, and instead use
-// the [NewWorkflowRunService] method instead.
-type WorkflowRunService struct {
- options []option.RequestOption
-}
-
-// NewWorkflowRunService generates a new service that applies the given options to
-// each request. These options are applied after the parent client's options (if
-// there is one), and before any request-specific options.
-func NewWorkflowRunService(opts ...option.RequestOption) (r WorkflowRunService) {
- r = WorkflowRunService{}
- r.options = opts
- return
-}
-
-// Retrieve Workflow Run
-func (r *WorkflowRunService) Get(ctx context.Context, runID string, opts ...option.RequestOption) (res *PublicJob, err error) {
- opts = slices.Concat(r.options, opts)
- if runID == "" {
- err = errors.New("missing required run_id parameter")
- return nil, err
- }
- path := fmt.Sprintf("v1/workflow-runs/%s", url.PathEscape(runID))
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return res, err
-}
-
-type PublicJob struct {
- ID string `json:"id" api:"required"`
- Status string `json:"status" api:"required"`
- Type string `json:"type" api:"required"`
- CompletedAt string `json:"completed_at" api:"nullable"`
- Config map[string]any `json:"config"`
- CreatedAt string `json:"created_at" api:"nullable"`
- Error string `json:"error" api:"nullable"`
- Progress map[string]any `json:"progress" api:"nullable"`
- Result map[string]any `json:"result" api:"nullable"`
- StartedAt string `json:"started_at" api:"nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Status respjson.Field
- Type respjson.Field
- CompletedAt respjson.Field
- Config respjson.Field
- CreatedAt respjson.Field
- Error respjson.Field
- Progress respjson.Field
- Result respjson.Field
- StartedAt respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r PublicJob) RawJSON() string { return r.JSON.raw }
-func (r *PublicJob) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
From bc873c19ea4d3f166f39694a39ec22d213a8d296 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:18:54 +0000
Subject: [PATCH 11/11] release: 0.1.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 25 +++++++++++++++++++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 28 insertions(+), 3 deletions(-)
create mode 100644 CHANGELOG.md
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 1332969..3d2ac0b 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.0.1"
+ ".": "0.1.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..1eb8b79
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,25 @@
+# Changelog
+
+## 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)
+
+### Features
+
+* **api:** api update ([81040ca](https://github.com/usesapient/go-sdk/commit/81040cae143638e659bd7f46e915834389621b73))
+* **api:** manual updates ([9006fc3](https://github.com/usesapient/go-sdk/commit/9006fc392d874ccb73467b5af2c8a604b137264d))
+* **api:** manual updates ([1244e4f](https://github.com/usesapient/go-sdk/commit/1244e4fa9f72055fe47d674631447eecbd6de491))
+* **client:** optimize json encoder for internal types ([c4a2fe9](https://github.com/usesapient/go-sdk/commit/c4a2fe9b93fcbd3a913cfd6d1063629d5151967d))
+* Update Sapient public OpenAPI spec ([08e2481](https://github.com/usesapient/go-sdk/commit/08e2481a51e0c9078c6116ec07a2808a97d854f2))
+
+
+### Bug Fixes
+
+* **go:** avoid panic when http.DefaultTransport is wrapped ([2e82dd9](https://github.com/usesapient/go-sdk/commit/2e82dd9138032133a11d34e1aa61fd3ac76b2c65))
+
+
+### Chores
+
+* configure new SDK language ([7e6c8d5](https://github.com/usesapient/go-sdk/commit/7e6c8d56898948fc5d8f4c96122d67a6fd9cae64))
+* redact api-key headers in debug logs ([70c3559](https://github.com/usesapient/go-sdk/commit/70c3559c6f6ee137cbae449697f3f165d4e3b610))
+* update SDK settings ([aaa249d](https://github.com/usesapient/go-sdk/commit/aaa249d20e8fb643d66f48bf567af669ded55b14))
diff --git a/README.md b/README.md
index 29766bd..7e17d80 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.0.1'
+go get -u 'github.com/usesapient/go-sdk@v0.1.0'
```
diff --git a/internal/version.go b/internal/version.go
index ebdd35f..02eac73 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.0.1" // x-release-please-version
+const PackageVersion = "0.1.0" // x-release-please-version