From 06e03be805d93736fcf4f848c5f9888e2871c911 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 22:54:09 +0000
Subject: [PATCH 01/33] feat(api): query_metrics, batches, changes
---
.stats.yml | 4 ++--
file.go | 9 ++++++---
moderation.go | 6 +-----
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index b90091b..db3fa11 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 106
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4f6633567c1a079df49d0cf58f37251a4bb0ee2f2a496ac83c9fee26eb325f9c.yml
-openapi_spec_hash: af5b3d3bbecf48f15c90b982ccac852e
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
+openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
config_hash: ddcbd66d7ac80290da208232a746e30f
diff --git a/file.go b/file.go
index 166eebd..9d16365 100644
--- a/file.go
+++ b/file.go
@@ -153,7 +153,7 @@ type File struct {
Object constant.File `json:"object,required"`
// The intended purpose of the file
//
- // Any of "assistants".
+ // Any of "assistants", "batch".
Purpose FilePurpose `json:"purpose,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
@@ -180,6 +180,7 @@ type FilePurpose string
const (
FilePurposeAssistants FilePurpose = "assistants"
+ FilePurposeBatch FilePurpose = "batch"
)
// Response for listing files in OpenAI Files API.
@@ -218,7 +219,7 @@ type FileNewParams struct {
File io.Reader `json:"file,omitzero,required" format:"binary"`
// Valid purpose values for OpenAI Files API.
//
- // Any of "assistants".
+ // Any of "assistants", "batch".
Purpose FileNewParamsPurpose `json:"purpose,omitzero,required"`
paramObj
}
@@ -246,6 +247,7 @@ type FileNewParamsPurpose string
const (
FileNewParamsPurposeAssistants FileNewParamsPurpose = "assistants"
+ FileNewParamsPurposeBatch FileNewParamsPurpose = "batch"
)
type FileListParams struct {
@@ -264,7 +266,7 @@ type FileListParams struct {
Order FileListParamsOrder `query:"order,omitzero" json:"-"`
// Only return files with the given purpose.
//
- // Any of "assistants".
+ // Any of "assistants", "batch".
Purpose FileListParamsPurpose `query:"purpose,omitzero" json:"-"`
paramObj
}
@@ -291,4 +293,5 @@ type FileListParamsPurpose string
const (
FileListParamsPurposeAssistants FileListParamsPurpose = "assistants"
+ FileListParamsPurposeBatch FileListParamsPurpose = "batch"
)
diff --git a/moderation.go b/moderation.go
index fe54384..47a9b36 100644
--- a/moderation.go
+++ b/moderation.go
@@ -74,11 +74,7 @@ type CreateResponseResult struct {
Categories map[string]bool `json:"categories"`
// A list of the categories along with the input type(s) that the score applies to.
CategoryAppliedInputTypes map[string][]string `json:"category_applied_input_types"`
- // A list of the categories along with their scores as predicted by model. Required
- // set of categories that need to be in response - violence - violence/graphic -
- // harassment - harassment/threatening - hate - hate/threatening - illicit -
- // illicit/violent - sexual - sexual/minors - self-harm - self-harm/intent -
- // self-harm/instructions
+ // A list of the categories along with their scores as predicted by model.
CategoryScores map[string]float64 `json:"category_scores"`
UserMessage string `json:"user_message"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
From 8243d43dfa43bb9ec92d1edbed36f114240a265e Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 23:00:00 +0000
Subject: [PATCH 02/33] feat(api): some updates to query metrics
---
.stats.yml | 4 +-
aliases.go | 10 ---
api.md | 3 +
inference.go | 26 +------
shared/shared.go | 53 +------------
telemetry.go | 188 ++++++++++++++++++++++++++++++++++++++++++++++
telemetry_test.go | 36 +++++++++
7 files changed, 233 insertions(+), 87 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index db3fa11..ef19246 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 106
+configured_endpoints: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: ddcbd66d7ac80290da208232a746e30f
+config_hash: 17fe64b23723fc54f2ee61c80223c3e3
diff --git a/aliases.go b/aliases.go
index 72179d3..4f1f7c1 100644
--- a/aliases.go
+++ b/aliases.go
@@ -99,11 +99,6 @@ type ChatCompletionResponse = shared.ChatCompletionResponse
// This is an alias to an internal type.
type ChatCompletionResponseLogprob = shared.ChatCompletionResponseLogprob
-// A metric value included in API responses.
-//
-// This is an alias to an internal type.
-type ChatCompletionResponseMetric = shared.ChatCompletionResponseMetric
-
// A message containing the model's (assistant) response in a chat conversation.
//
// This is an alias to an internal type.
@@ -551,11 +546,6 @@ const SharedCompletionResponseStopReasonOutOfTokens = shared.SharedCompletionRes
// This is an alias to an internal type.
type SharedCompletionResponseLogprob = shared.SharedCompletionResponseLogprob
-// A metric value included in API responses.
-//
-// This is an alias to an internal type.
-type SharedCompletionResponseMetric = shared.SharedCompletionResponseMetric
-
// Tool definition used in runtime contexts.
//
// This is an alias to an internal type.
diff --git a/api.md b/api.md
index cdc8ff2..0ad6788 100644
--- a/api.md
+++ b/api.md
@@ -465,11 +465,13 @@ Params Types:
Response Types:
+- llamastackclient.Metric
- llamastackclient.QuerySpansResponse
- llamastackclient.SpanWithStatus
- llamastackclient.Trace
- llamastackclient.TelemetryGetSpanResponse
- llamastackclient.TelemetryGetSpanTreeResponse
+- llamastackclient.TelemetryQueryMetricsResponse
Methods:
@@ -477,6 +479,7 @@ Methods:
- client.Telemetry.GetSpanTree(ctx context.Context, spanID string, body llamastackclient.TelemetryGetSpanTreeParams) (llamastackclient.TelemetryGetSpanTreeResponse, error)
- client.Telemetry.GetTrace(ctx context.Context, traceID string) (llamastackclient.Trace, error)
- client.Telemetry.LogEvent(ctx context.Context, body llamastackclient.TelemetryLogEventParams) error
+- client.Telemetry.QueryMetrics(ctx context.Context, metricName string, body llamastackclient.TelemetryQueryMetricsParams) ([]llamastackclient.TelemetryQueryMetricsResponse, error)
- client.Telemetry.QuerySpans(ctx context.Context, body llamastackclient.TelemetryQuerySpansParams) ([]llamastackclient.QuerySpansResponseData, error)
- client.Telemetry.QueryTraces(ctx context.Context, body llamastackclient.TelemetryQueryTracesParams) ([]llamastackclient.Trace, error)
- client.Telemetry.SaveSpansToDataset(ctx context.Context, body llamastackclient.TelemetrySaveSpansToDatasetParams) error
diff --git a/inference.go b/inference.go
index 85c0c62..bc3f560 100644
--- a/inference.go
+++ b/inference.go
@@ -120,7 +120,7 @@ type ChatCompletionResponseStreamChunk struct {
// The event containing the new content
Event ChatCompletionResponseStreamChunkEvent `json:"event,required"`
// (Optional) List of metrics associated with the API response
- Metrics []ChatCompletionResponseStreamChunkMetric `json:"metrics"`
+ Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
@@ -186,30 +186,6 @@ func (r *ChatCompletionResponseStreamChunkEventLogprob) UnmarshalJSON(data []byt
return apijson.UnmarshalRoot(data, r)
}
-// A metric value included in API responses.
-type ChatCompletionResponseStreamChunkMetric struct {
- // The name of the metric
- Metric string `json:"metric,required"`
- // The numeric value of the metric
- Value float64 `json:"value,required"`
- // (Optional) The unit of measurement for the metric value
- Unit string `json:"unit"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Metric respjson.Field
- Value respjson.Field
- Unit respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponseStreamChunkMetric) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponseStreamChunkMetric) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// Response containing generated embeddings.
type EmbeddingsResponse struct {
// List of embedding vectors, one per input content. Each embedding is a list of
diff --git a/shared/shared.go b/shared/shared.go
index 23bf070..c92f92a 100644
--- a/shared/shared.go
+++ b/shared/shared.go
@@ -5,6 +5,7 @@ package shared
import (
"encoding/json"
+ "github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
@@ -443,7 +444,7 @@ type ChatCompletionResponse struct {
// Optional log probabilities for generated tokens
Logprobs []ChatCompletionResponseLogprob `json:"logprobs"`
// (Optional) List of metrics associated with the API response
- Metrics []ChatCompletionResponseMetric `json:"metrics"`
+ Metrics []llamastackclient.Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CompletionMessage respjson.Field
@@ -478,30 +479,6 @@ func (r *ChatCompletionResponseLogprob) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// A metric value included in API responses.
-type ChatCompletionResponseMetric struct {
- // The name of the metric
- Metric string `json:"metric,required"`
- // The numeric value of the metric
- Value float64 `json:"value,required"`
- // (Optional) The unit of measurement for the metric value
- Unit string `json:"unit"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Metric respjson.Field
- Value respjson.Field
- Unit respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponseMetric) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponseMetric) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A message containing the model's (assistant) response in a chat conversation.
type CompletionMessage struct {
// The content of the model's response
@@ -3117,7 +3094,7 @@ type SharedCompletionResponse struct {
// Optional log probabilities for generated tokens
Logprobs []SharedCompletionResponseLogprob `json:"logprobs"`
// (Optional) List of metrics associated with the API response
- Metrics []SharedCompletionResponseMetric `json:"metrics"`
+ Metrics []llamastackclient.Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -3162,30 +3139,6 @@ func (r *SharedCompletionResponseLogprob) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// A metric value included in API responses.
-type SharedCompletionResponseMetric struct {
- // The name of the metric
- Metric string `json:"metric,required"`
- // The numeric value of the metric
- Value float64 `json:"value,required"`
- // (Optional) The unit of measurement for the metric value
- Unit string `json:"unit"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Metric respjson.Field
- Value respjson.Field
- Unit respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r SharedCompletionResponseMetric) RawJSON() string { return r.JSON.raw }
-func (r *SharedCompletionResponseMetric) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// Tool definition used in runtime contexts.
type SharedToolDef struct {
// Name of the tool
diff --git a/telemetry.go b/telemetry.go
index 5349bd8..96536f5 100644
--- a/telemetry.go
+++ b/telemetry.go
@@ -91,6 +91,23 @@ func (r *TelemetryService) LogEvent(ctx context.Context, body TelemetryLogEventP
return
}
+// Query metrics.
+func (r *TelemetryService) QueryMetrics(ctx context.Context, metricName string, body TelemetryQueryMetricsParams, opts ...option.RequestOption) (res *[]TelemetryQueryMetricsResponse, err error) {
+ var env TelemetryQueryMetricsResponseEnvelope
+ opts = append(r.Options[:], opts...)
+ if metricName == "" {
+ err = errors.New("missing required metric_name parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/telemetry/metrics/%s", metricName)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Data
+ return
+}
+
// Query spans.
func (r *TelemetryService) QuerySpans(ctx context.Context, body TelemetryQuerySpansParams, opts ...option.RequestOption) (res *[]QuerySpansResponseData, err error) {
var env QuerySpansResponse
@@ -595,6 +612,30 @@ func (u *EventStructuredLogAttributeUnionParam) asAny() any {
return nil
}
+// A metric value included in API responses.
+type Metric struct {
+ // The name of the metric
+ Metric string `json:"metric,required"`
+ // The numeric value of the metric
+ Value float64 `json:"value,required"`
+ // (Optional) The unit of measurement for the metric value
+ Unit string `json:"unit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Metric respjson.Field
+ Value respjson.Field
+ Unit respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r Metric) RawJSON() string { return r.JSON.raw }
+func (r *Metric) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A condition for filtering query results.
//
// The properties Key, Op, Value are required.
@@ -984,6 +1025,74 @@ func (r *TelemetryGetSpanResponseAttributeUnion) UnmarshalJSON(data []byte) erro
type TelemetryGetSpanTreeResponse map[string]SpanWithStatus
+// A time series of metric data points.
+type TelemetryQueryMetricsResponse struct {
+ // List of labels associated with this metric series
+ Labels []TelemetryQueryMetricsResponseLabel `json:"labels,required"`
+ // The name of the metric
+ Metric string `json:"metric,required"`
+ // List of data points in chronological order
+ Values []TelemetryQueryMetricsResponseValue `json:"values,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Labels respjson.Field
+ Metric respjson.Field
+ Values respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponse) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A label associated with a metric.
+type TelemetryQueryMetricsResponseLabel struct {
+ // The name of the label
+ Name string `json:"name,required"`
+ // The value of the label
+ Value string `json:"value,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponseLabel) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponseLabel) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A single data point in a metric time series.
+type TelemetryQueryMetricsResponseValue struct {
+ // Unix timestamp when the metric value was recorded
+ Timestamp int64 `json:"timestamp,required"`
+ Unit string `json:"unit,required"`
+ // The numeric value of the metric at this timestamp
+ Value float64 `json:"value,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Timestamp respjson.Field
+ Unit respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponseValue) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponseValue) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type TelemetryGetSpanParams struct {
TraceID string `path:"trace_id,required" json:"-"`
paramObj
@@ -1039,6 +1148,85 @@ func (r *TelemetryLogEventParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type TelemetryQueryMetricsParams struct {
+ // The type of query to perform.
+ //
+ // Any of "range", "instant".
+ QueryType TelemetryQueryMetricsParamsQueryType `json:"query_type,omitzero,required"`
+ // The start time of the metric to query.
+ StartTime int64 `json:"start_time,required"`
+ // The end time of the metric to query.
+ EndTime param.Opt[int64] `json:"end_time,omitzero"`
+ // The granularity of the metric to query.
+ Granularity param.Opt[string] `json:"granularity,omitzero"`
+ // The label matchers to apply to the metric.
+ LabelMatchers []TelemetryQueryMetricsParamsLabelMatcher `json:"label_matchers,omitzero"`
+ paramObj
+}
+
+func (r TelemetryQueryMetricsParams) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryQueryMetricsParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *TelemetryQueryMetricsParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The type of query to perform.
+type TelemetryQueryMetricsParamsQueryType string
+
+const (
+ TelemetryQueryMetricsParamsQueryTypeRange TelemetryQueryMetricsParamsQueryType = "range"
+ TelemetryQueryMetricsParamsQueryTypeInstant TelemetryQueryMetricsParamsQueryType = "instant"
+)
+
+// A matcher for filtering metrics by label values.
+//
+// The properties Name, Operator, Value are required.
+type TelemetryQueryMetricsParamsLabelMatcher struct {
+ // The name of the label to match
+ Name string `json:"name,required"`
+ // The comparison operator to use for matching
+ //
+ // Any of "=", "!=", "=~", "!~".
+ Operator string `json:"operator,omitzero,required"`
+ // The value to match against
+ Value string `json:"value,required"`
+ paramObj
+}
+
+func (r TelemetryQueryMetricsParamsLabelMatcher) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryQueryMetricsParamsLabelMatcher
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *TelemetryQueryMetricsParamsLabelMatcher) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[TelemetryQueryMetricsParamsLabelMatcher](
+ "operator", "=", "!=", "=~", "!~",
+ )
+}
+
+// Response containing metric time series data.
+type TelemetryQueryMetricsResponseEnvelope struct {
+ // List of metric series matching the query criteria
+ Data []TelemetryQueryMetricsResponse `json:"data,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 TelemetryQueryMetricsResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type TelemetryQuerySpansParams struct {
// The attribute filters to apply to the spans.
AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero,required"`
diff --git a/telemetry_test.go b/telemetry_test.go
index 924d900..f46cfc7 100644
--- a/telemetry_test.go
+++ b/telemetry_test.go
@@ -127,6 +127,42 @@ func TestTelemetryLogEventWithOptionalParams(t *testing.T) {
}
}
+func TestTelemetryQueryMetricsWithOptionalParams(t *testing.T) {
+ t.Skip("unsupported query params in java / kotlin")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Telemetry.QueryMetrics(
+ context.TODO(),
+ "metric_name",
+ llamastackclient.TelemetryQueryMetricsParams{
+ QueryType: llamastackclient.TelemetryQueryMetricsParamsQueryTypeRange,
+ StartTime: 0,
+ EndTime: llamastackclient.Int(0),
+ Granularity: llamastackclient.String("granularity"),
+ LabelMatchers: []llamastackclient.TelemetryQueryMetricsParamsLabelMatcher{{
+ Name: "name",
+ Operator: "=",
+ Value: "value",
+ }},
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestTelemetryQuerySpansWithOptionalParams(t *testing.T) {
t.Skip("unsupported query params in java / kotlin")
baseURL := "http://localhost:4010"
From 3e9c39f1bf837daf2487ec2c465a9522e6b5befe Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 22 Aug 2025 23:44:11 +0000
Subject: [PATCH 03/33] feat(api): fix completion response breakage perhaps?
---
.stats.yml | 2 +-
aliases.go | 54 +++---------
api.md | 5 +-
inference.go | 2 +-
scoringfunction.go | 47 ++++++++++-
scoringfunction_test.go | 5 +-
shared/shared.go | 181 ++++++++++++++++------------------------
telemetry.go | 24 ------
8 files changed, 131 insertions(+), 189 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index ef19246..316d7e4 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: 17fe64b23723fc54f2ee61c80223c3e3
+config_hash: 4138b0fa1be4c2807ad4ec538b8b38f4
diff --git a/aliases.go b/aliases.go
index 4f1f7c1..d8eb39d 100644
--- a/aliases.go
+++ b/aliases.go
@@ -148,6 +148,11 @@ type ContentDeltaImage = shared.ContentDeltaImage
// This is an alias to an internal type.
type ContentDeltaToolCall = shared.ContentDeltaToolCall
+// Either an in-progress tool call string or the final parsed tool call
+//
+// This is an alias to an internal type.
+type ContentDeltaToolCallToolCallUnion = shared.ContentDeltaToolCallToolCallUnion
+
// A document to be used for document ingestion in the RAG Tool.
//
// This is an alias to an internal type.
@@ -296,6 +301,11 @@ type InterleavedContentItemTextParam = shared.InterleavedContentItemTextParam
// This is an alias to an internal type.
type MessageUnionParam = shared.MessageUnionParam
+// A metric value included in API responses.
+//
+// This is an alias to an internal type.
+type Metric = shared.Metric
+
// Configuration for the RAG query generation.
//
// This is an alias to an internal type.
@@ -396,45 +406,6 @@ type ResponseFormatGrammarParam = shared.ResponseFormatGrammarParam
// This is an alias to an internal type.
type ResponseFormatGrammarBnfUnionParam = shared.ResponseFormatGrammarBnfUnionParam
-// This is an alias to an internal type.
-type ReturnType = shared.ReturnType
-
-// This is an alias to an internal type.
-type ReturnTypeType = shared.ReturnTypeType
-
-// Equals "string"
-const ReturnTypeTypeString = shared.ReturnTypeTypeString
-
-// Equals "number"
-const ReturnTypeTypeNumber = shared.ReturnTypeTypeNumber
-
-// Equals "boolean"
-const ReturnTypeTypeBoolean = shared.ReturnTypeTypeBoolean
-
-// Equals "array"
-const ReturnTypeTypeArray = shared.ReturnTypeTypeArray
-
-// Equals "object"
-const ReturnTypeTypeObject = shared.ReturnTypeTypeObject
-
-// Equals "json"
-const ReturnTypeTypeJson = shared.ReturnTypeTypeJson
-
-// Equals "union"
-const ReturnTypeTypeUnion = shared.ReturnTypeTypeUnion
-
-// Equals "chat_completion_input"
-const ReturnTypeTypeChatCompletionInput = shared.ReturnTypeTypeChatCompletionInput
-
-// Equals "completion_input"
-const ReturnTypeTypeCompletionInput = shared.ReturnTypeTypeCompletionInput
-
-// Equals "agent_turn_input"
-const ReturnTypeTypeAgentTurnInput = shared.ReturnTypeTypeAgentTurnInput
-
-// This is an alias to an internal type.
-type ReturnTypeParam = shared.ReturnTypeParam
-
// Details of a safety violation detected by content moderation.
//
// This is an alias to an internal type.
@@ -632,11 +603,6 @@ type ToolCallArgumentsMapItemArrayItemUnionParam = shared.ToolCallArgumentsMapIt
// This is an alias to an internal type.
type ToolCallArgumentsMapItemMapItemUnionParam = shared.ToolCallArgumentsMapItemMapItemUnionParam
-// Either an in-progress tool call string or the final parsed tool call
-//
-// This is an alias to an internal type.
-type ToolCallOrStringUnion = shared.ToolCallOrStringUnion
-
// This is an alias to an internal type.
type ToolParamDefinition = shared.ToolParamDefinition
diff --git a/api.md b/api.md
index 0ad6788..1983c71 100644
--- a/api.md
+++ b/api.md
@@ -9,7 +9,6 @@
- shared.QueryConfigParam
- shared.QueryGeneratorConfigUnionParam
- shared.ResponseFormatUnionParam
-- shared.ReturnTypeParam
- shared.SamplingParams
- shared.SharedToolDefParam
- shared.SystemMessageParam
@@ -27,16 +26,15 @@
- shared.ContentDeltaUnion
- shared.InterleavedContentUnion
- shared.InterleavedContentItemUnion
+- shared.Metric
- shared.QueryResult
- shared.ResponseFormatUnion
-- shared.ReturnType
- shared.SafetyViolation
- shared.SamplingParamsResp
- shared.ScoringResult
- shared.SharedCompletionResponse
- shared.SharedToolDef
- shared.ToolCall
-- shared.ToolCallOrStringUnion
- shared.ToolResponseMessage
- shared.UserMessage
@@ -465,7 +463,6 @@ Params Types:
Response Types:
-- llamastackclient.Metric
- llamastackclient.QuerySpansResponse
- llamastackclient.SpanWithStatus
- llamastackclient.Trace
diff --git a/inference.go b/inference.go
index bc3f560..80960cd 100644
--- a/inference.go
+++ b/inference.go
@@ -120,7 +120,7 @@ type ChatCompletionResponseStreamChunk struct {
// The event containing the new content
Event ChatCompletionResponseStreamChunkEvent `json:"event,required"`
// (Optional) List of metrics associated with the API response
- Metrics []Metric `json:"metrics"`
+ Metrics []shared.Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
diff --git a/scoringfunction.go b/scoringfunction.go
index 898bca7..7e4476b 100644
--- a/scoringfunction.go
+++ b/scoringfunction.go
@@ -14,7 +14,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
@@ -92,7 +91,7 @@ type ScoringFn struct {
Identifier string `json:"identifier,required"`
Metadata map[string]ScoringFnMetadataUnion `json:"metadata,required"`
ProviderID string `json:"provider_id,required"`
- ReturnType shared.ReturnType `json:"return_type,required"`
+ ReturnType ScoringFnReturnType `json:"return_type,required"`
// The resource type, always scoring_function
Type constant.ScoringFunction `json:"type,required"`
Description string `json:"description"`
@@ -172,6 +171,24 @@ func (r *ScoringFnMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+type ScoringFnReturnType struct {
+ // Any of "string", "number", "boolean", "array", "object", "json", "union",
+ // "chat_completion_input", "completion_input", "agent_turn_input".
+ Type string `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ScoringFnReturnType) RawJSON() string { return r.JSON.raw }
+func (r *ScoringFnReturnType) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ScoringFnParamsUnionResp contains all possible properties and values from
// [ScoringFnParamsLlmAsJudgeResp], [ScoringFnParamsRegexParserResp],
// [ScoringFnParamsBasicResp].
@@ -541,8 +558,8 @@ func (r *ScoringFnParamsBasic) UnmarshalJSON(data []byte) error {
type ScoringFunctionRegisterParams struct {
// The description of the scoring function.
- Description string `json:"description,required"`
- ReturnType shared.ReturnTypeParam `json:"return_type,omitzero,required"`
+ Description string `json:"description,required"`
+ ReturnType ScoringFunctionRegisterParamsReturnType `json:"return_type,omitzero,required"`
// The ID of the scoring function to register.
ScoringFnID string `json:"scoring_fn_id,required"`
// The ID of the provider to use for the scoring function.
@@ -562,3 +579,25 @@ func (r ScoringFunctionRegisterParams) MarshalJSON() (data []byte, err error) {
func (r *ScoringFunctionRegisterParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+
+// The property Type is required.
+type ScoringFunctionRegisterParamsReturnType struct {
+ // Any of "string", "number", "boolean", "array", "object", "json", "union",
+ // "chat_completion_input", "completion_input", "agent_turn_input".
+ Type string `json:"type,omitzero,required"`
+ paramObj
+}
+
+func (r ScoringFunctionRegisterParamsReturnType) MarshalJSON() (data []byte, err error) {
+ type shadow ScoringFunctionRegisterParamsReturnType
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ScoringFunctionRegisterParamsReturnType) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[ScoringFunctionRegisterParamsReturnType](
+ "type", "string", "number", "boolean", "array", "object", "json", "union", "chat_completion_input", "completion_input", "agent_turn_input",
+ )
+}
diff --git a/scoringfunction_test.go b/scoringfunction_test.go
index 3ba1c2e..189050a 100644
--- a/scoringfunction_test.go
+++ b/scoringfunction_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestScoringFunctionGet(t *testing.T) {
@@ -69,8 +68,8 @@ func TestScoringFunctionRegisterWithOptionalParams(t *testing.T) {
)
err := client.ScoringFunctions.Register(context.TODO(), llamastackclient.ScoringFunctionRegisterParams{
Description: "description",
- ReturnType: shared.ReturnTypeParam{
- Type: shared.ReturnTypeTypeString,
+ ReturnType: llamastackclient.ScoringFunctionRegisterParamsReturnType{
+ Type: "string",
},
ScoringFnID: "scoring_fn_id",
Params: llamastackclient.ScoringFnParamsUnion{
diff --git a/shared/shared.go b/shared/shared.go
index c92f92a..b211704 100644
--- a/shared/shared.go
+++ b/shared/shared.go
@@ -5,7 +5,6 @@ package shared
import (
"encoding/json"
- "github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
@@ -444,7 +443,7 @@ type ChatCompletionResponse struct {
// Optional log probabilities for generated tokens
Logprobs []ChatCompletionResponseLogprob `json:"logprobs"`
// (Optional) List of metrics associated with the API response
- Metrics []llamastackclient.Metric `json:"metrics"`
+ Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CompletionMessage respjson.Field
@@ -584,7 +583,7 @@ type ContentDeltaUnion struct {
// This field is from variant [ContentDeltaToolCall].
ParseStatus string `json:"parse_status"`
// This field is from variant [ContentDeltaToolCall].
- ToolCall ToolCallOrStringUnion `json:"tool_call"`
+ ToolCall ContentDeltaToolCallToolCallUnion `json:"tool_call"`
JSON struct {
Text respjson.Field
Type respjson.Field
@@ -697,7 +696,7 @@ type ContentDeltaToolCall struct {
// Any of "started", "in_progress", "failed", "succeeded".
ParseStatus string `json:"parse_status,required"`
// Either an in-progress tool call string or the final parsed tool call
- ToolCall ToolCallOrStringUnion `json:"tool_call,required"`
+ ToolCall ContentDeltaToolCallToolCallUnion `json:"tool_call,required"`
// Discriminator type of the delta. Always "tool_call"
Type constant.ToolCall `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -718,6 +717,51 @@ func (r *ContentDeltaToolCall) UnmarshalJSON(data []byte) error {
func (ContentDeltaToolCall) implContentDeltaUnion() {}
+// ContentDeltaToolCallToolCallUnion contains all possible properties and values
+// from [string], [ToolCall].
+//
+// 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: OfString]
+type ContentDeltaToolCallToolCallUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field is from variant [ToolCall].
+ Arguments ToolCallArgumentsUnion `json:"arguments"`
+ // This field is from variant [ToolCall].
+ CallID string `json:"call_id"`
+ // This field is from variant [ToolCall].
+ ToolName ToolCallToolName `json:"tool_name"`
+ // This field is from variant [ToolCall].
+ ArgumentsJson string `json:"arguments_json"`
+ JSON struct {
+ OfString respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ ToolName respjson.Field
+ ArgumentsJson respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ContentDeltaToolCallToolCallUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ContentDeltaToolCallToolCallUnion) AsToolCall() (v ToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ContentDeltaToolCallToolCallUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ContentDeltaToolCallToolCallUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A document to be used for document ingestion in the RAG Tool.
//
// The properties Content, DocumentID, Metadata are required.
@@ -1714,6 +1758,30 @@ func init() {
)
}
+// A metric value included in API responses.
+type Metric struct {
+ // The name of the metric
+ Metric string `json:"metric,required"`
+ // The numeric value of the metric
+ Value float64 `json:"value,required"`
+ // (Optional) The unit of measurement for the metric value
+ Unit string `json:"unit"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Metric respjson.Field
+ Value respjson.Field
+ Unit respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r Metric) RawJSON() string { return r.JSON.raw }
+func (r *Metric) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Configuration for the RAG query generation.
//
// The properties ChunkTemplate, MaxChunks, MaxTokensInContext,
@@ -2456,64 +2524,6 @@ func (u *ResponseFormatGrammarBnfUnionParam) asAny() any {
return nil
}
-type ReturnType struct {
- // Any of "string", "number", "boolean", "array", "object", "json", "union",
- // "chat_completion_input", "completion_input", "agent_turn_input".
- Type ReturnTypeType `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ReturnType) RawJSON() string { return r.JSON.raw }
-func (r *ReturnType) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToParam converts this ReturnType to a ReturnTypeParam.
-//
-// Warning: the fields of the param type will not be present. ToParam should only
-// be used at the last possible moment before sending a request. Test for this with
-// ReturnTypeParam.Overrides()
-func (r ReturnType) ToParam() ReturnTypeParam {
- return param.Override[ReturnTypeParam](json.RawMessage(r.RawJSON()))
-}
-
-type ReturnTypeType string
-
-const (
- ReturnTypeTypeString ReturnTypeType = "string"
- ReturnTypeTypeNumber ReturnTypeType = "number"
- ReturnTypeTypeBoolean ReturnTypeType = "boolean"
- ReturnTypeTypeArray ReturnTypeType = "array"
- ReturnTypeTypeObject ReturnTypeType = "object"
- ReturnTypeTypeJson ReturnTypeType = "json"
- ReturnTypeTypeUnion ReturnTypeType = "union"
- ReturnTypeTypeChatCompletionInput ReturnTypeType = "chat_completion_input"
- ReturnTypeTypeCompletionInput ReturnTypeType = "completion_input"
- ReturnTypeTypeAgentTurnInput ReturnTypeType = "agent_turn_input"
-)
-
-// The property Type is required.
-type ReturnTypeParam struct {
- // Any of "string", "number", "boolean", "array", "object", "json", "union",
- // "chat_completion_input", "completion_input", "agent_turn_input".
- Type ReturnTypeType `json:"type,omitzero,required"`
- paramObj
-}
-
-func (r ReturnTypeParam) MarshalJSON() (data []byte, err error) {
- type shadow ReturnTypeParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ReturnTypeParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// Details of a safety violation detected by content moderation.
type SafetyViolation struct {
// Additional metadata including specific violation codes for debugging and
@@ -3094,7 +3104,7 @@ type SharedCompletionResponse struct {
// Optional log probabilities for generated tokens
Logprobs []SharedCompletionResponseLogprob `json:"logprobs"`
// (Optional) List of metrics associated with the API response
- Metrics []llamastackclient.Metric `json:"metrics"`
+ Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -3808,51 +3818,6 @@ func (u *ToolCallArgumentsMapItemMapItemUnionParam) asAny() any {
return nil
}
-// ToolCallOrStringUnion contains all possible properties and values from [string],
-// [ToolCall].
-//
-// 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: OfString]
-type ToolCallOrStringUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field is from variant [ToolCall].
- Arguments ToolCallArgumentsUnion `json:"arguments"`
- // This field is from variant [ToolCall].
- CallID string `json:"call_id"`
- // This field is from variant [ToolCall].
- ToolName ToolCallToolName `json:"tool_name"`
- // This field is from variant [ToolCall].
- ArgumentsJson string `json:"arguments_json"`
- JSON struct {
- OfString respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- ToolName respjson.Field
- ArgumentsJson respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolCallOrStringUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallOrStringUnion) AsToolCall() (v ToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolCallOrStringUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolCallOrStringUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// The property ParamType is required.
type ToolParamDefinition struct {
ParamType string `json:"param_type,required"`
diff --git a/telemetry.go b/telemetry.go
index 96536f5..2a04754 100644
--- a/telemetry.go
+++ b/telemetry.go
@@ -612,30 +612,6 @@ func (u *EventStructuredLogAttributeUnionParam) asAny() any {
return nil
}
-// A metric value included in API responses.
-type Metric struct {
- // The name of the metric
- Metric string `json:"metric,required"`
- // The numeric value of the metric
- Value float64 `json:"value,required"`
- // (Optional) The unit of measurement for the metric value
- Unit string `json:"unit"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Metric respjson.Field
- Value respjson.Field
- Unit respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r Metric) RawJSON() string { return r.JSON.raw }
-func (r *Metric) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A condition for filtering query results.
//
// The properties Key, Op, Value are required.
From 1f42156c60f707085274b9523de5afe1e33c3079 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 25 Aug 2025 22:40:24 +0000
Subject: [PATCH 04/33] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 316d7e4..fde202d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: 4138b0fa1be4c2807ad4ec538b8b38f4
+config_hash: c7d7508716a41fa92482b28d5976c43a
From 9de5708ab28e06c58731c3ac57c3e4c4fbc12aca Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 26 Aug 2025 00:15:13 +0000
Subject: [PATCH 05/33] feat(api): manual updates
---
.stats.yml | 2 +-
agent_test.go | 8 +-
aliases.go | 65 ------
api.md | 14 +-
inference.go | 64 ++++--
packages/pagination/pagination.go | 17 +-
shared/shared.go | 371 +-----------------------------
toolruntime.go | 284 ++++++++++++++++++++++-
8 files changed, 362 insertions(+), 463 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index fde202d..f937dc2 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: c7d7508716a41fa92482b28d5976c43a
+config_hash: 40b8d777e1eb8b6ab05759b663edd2fb
diff --git a/agent_test.go b/agent_test.go
index 24d9e3c..bfdd200 100644
--- a/agent_test.go
+++ b/agent_test.go
@@ -29,20 +29,20 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
AgentConfig: shared.AgentConfigParam{
Instructions: "instructions",
Model: "model",
- ClientTools: []shared.SharedToolDefParam{{
+ ClientTools: []llamastackclient.ToolDefParam{{
Name: "name",
Description: llamastackclient.String("description"),
- Metadata: map[string]shared.SharedToolDefMetadataUnionParam{
+ Metadata: map[string]llamastackclient.ToolDefMetadataUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
- Parameters: []shared.SharedToolDefParameterParam{{
+ Parameters: []llamastackclient.ToolDefParameterParam{{
Description: "description",
Name: "name",
ParameterType: "parameter_type",
Required: true,
- Default: shared.SharedToolDefParameterDefaultUnionParam{
+ Default: llamastackclient.ToolDefParameterDefaultUnionParam{
OfBool: llamastackclient.Bool(true),
},
}},
diff --git a/aliases.go b/aliases.go
index d8eb39d..555023a 100644
--- a/aliases.go
+++ b/aliases.go
@@ -94,11 +94,6 @@ type BatchCompletion = shared.BatchCompletion
// This is an alias to an internal type.
type ChatCompletionResponse = shared.ChatCompletionResponse
-// Log probabilities for generated tokens.
-//
-// This is an alias to an internal type.
-type ChatCompletionResponseLogprob = shared.ChatCompletionResponseLogprob
-
// A message containing the model's (assistant) response in a chat conversation.
//
// This is an alias to an internal type.
@@ -493,66 +488,6 @@ type ScoringResultAggregatedResultUnion = shared.ScoringResultAggregatedResultUn
// This is an alias to an internal type.
type ScoringResultScoreRowUnion = shared.ScoringResultScoreRowUnion
-// Response from a completion request.
-//
-// This is an alias to an internal type.
-type SharedCompletionResponse = shared.SharedCompletionResponse
-
-// Reason why generation stopped
-//
-// This is an alias to an internal type.
-type SharedCompletionResponseStopReason = shared.SharedCompletionResponseStopReason
-
-// Equals "end_of_turn"
-const SharedCompletionResponseStopReasonEndOfTurn = shared.SharedCompletionResponseStopReasonEndOfTurn
-
-// Equals "end_of_message"
-const SharedCompletionResponseStopReasonEndOfMessage = shared.SharedCompletionResponseStopReasonEndOfMessage
-
-// Equals "out_of_tokens"
-const SharedCompletionResponseStopReasonOutOfTokens = shared.SharedCompletionResponseStopReasonOutOfTokens
-
-// Log probabilities for generated tokens.
-//
-// This is an alias to an internal type.
-type SharedCompletionResponseLogprob = shared.SharedCompletionResponseLogprob
-
-// Tool definition used in runtime contexts.
-//
-// This is an alias to an internal type.
-type SharedToolDef = shared.SharedToolDef
-
-// This is an alias to an internal type.
-type SharedToolDefMetadataUnion = shared.SharedToolDefMetadataUnion
-
-// Parameter definition for a tool.
-//
-// This is an alias to an internal type.
-type SharedToolDefParameter = shared.SharedToolDefParameter
-
-// (Optional) Default value for the parameter if not provided
-//
-// This is an alias to an internal type.
-type SharedToolDefParameterDefaultUnion = shared.SharedToolDefParameterDefaultUnion
-
-// Tool definition used in runtime contexts.
-//
-// This is an alias to an internal type.
-type SharedToolDefParam = shared.SharedToolDefParam
-
-// This is an alias to an internal type.
-type SharedToolDefMetadataUnionParam = shared.SharedToolDefMetadataUnionParam
-
-// Parameter definition for a tool.
-//
-// This is an alias to an internal type.
-type SharedToolDefParameterParam = shared.SharedToolDefParameterParam
-
-// (Optional) Default value for the parameter if not provided
-//
-// This is an alias to an internal type.
-type SharedToolDefParameterDefaultUnionParam = shared.SharedToolDefParameterDefaultUnionParam
-
// A system message providing instructions or context to the model.
//
// This is an alias to an internal type.
diff --git a/api.md b/api.md
index 1983c71..90e1b72 100644
--- a/api.md
+++ b/api.md
@@ -10,7 +10,6 @@
- shared.QueryGeneratorConfigUnionParam
- shared.ResponseFormatUnionParam
- shared.SamplingParams
-- shared.SharedToolDefParam
- shared.SystemMessageParam
- shared.ToolCallParam
- shared.ToolParamDefinition
@@ -32,8 +31,6 @@
- shared.SafetyViolation
- shared.SamplingParamsResp
- shared.ScoringResult
-- shared.SharedCompletionResponse
-- shared.SharedToolDef
- shared.ToolCall
- shared.ToolResponseMessage
- shared.UserMessage
@@ -66,14 +63,19 @@ Methods:
# ToolRuntime
+Params Types:
+
+- llamastackclient.ToolDefParam
+
Response Types:
+- llamastackclient.ToolDef
- llamastackclient.ToolInvocationResult
Methods:
- client.ToolRuntime.InvokeTool(ctx context.Context, body llamastackclient.ToolRuntimeInvokeToolParams) (llamastackclient.ToolInvocationResult, error)
-- client.ToolRuntime.ListTools(ctx context.Context, query llamastackclient.ToolRuntimeListToolsParams) ([]shared.SharedToolDef, error)
+- client.ToolRuntime.ListTools(ctx context.Context, query llamastackclient.ToolRuntimeListToolsParams) ([]llamastackclient.ToolDef, error)
## RagTool
@@ -234,7 +236,9 @@ Methods:
Response Types:
- llamastackclient.ChatCompletionResponseStreamChunk
+- llamastackclient.CompletionResponse
- llamastackclient.EmbeddingsResponse
+- llamastackclient.TokenLogProbs
- llamastackclient.InferenceBatchChatCompletionResponse
Methods:
@@ -242,7 +246,7 @@ Methods:
- client.Inference.BatchChatCompletion(ctx context.Context, body llamastackclient.InferenceBatchChatCompletionParams) (llamastackclient.InferenceBatchChatCompletionResponse, error)
- client.Inference.BatchCompletion(ctx context.Context, body llamastackclient.InferenceBatchCompletionParams) (shared.BatchCompletion, error)
- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (shared.ChatCompletionResponse, error)
-- client.Inference.Completion(ctx context.Context, body llamastackclient.InferenceCompletionParams) (shared.SharedCompletionResponse, error)
+- client.Inference.Completion(ctx context.Context, body llamastackclient.InferenceCompletionParams) (llamastackclient.CompletionResponse, error)
- client.Inference.Embeddings(ctx context.Context, body llamastackclient.InferenceEmbeddingsParams) (llamastackclient.EmbeddingsResponse, error)
# Embeddings
diff --git a/inference.go b/inference.go
index 80960cd..26d369e 100644
--- a/inference.go
+++ b/inference.go
@@ -81,7 +81,7 @@ func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body Inf
//
// Deprecated: /v1/inference/completion is deprecated. Please use
// /v1/openai/v1/completions.
-func (r *InferenceService) Completion(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (res *shared.SharedCompletionResponse, err error) {
+func (r *InferenceService) Completion(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (res *CompletionResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/inference/completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -92,7 +92,7 @@ func (r *InferenceService) Completion(ctx context.Context, body InferenceComplet
//
// Deprecated: /v1/inference/completion is deprecated. Please use
// /v1/openai/v1/completions.
-func (r *InferenceService) CompletionStreaming(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (stream *ssestream.Stream[shared.SharedCompletionResponse]) {
+func (r *InferenceService) CompletionStreaming(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (stream *ssestream.Stream[CompletionResponse]) {
var (
raw *http.Response
err error
@@ -101,7 +101,7 @@ func (r *InferenceService) CompletionStreaming(ctx context.Context, body Inferen
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/inference/completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
- return ssestream.NewStream[shared.SharedCompletionResponse](ssestream.NewDecoder(raw), err)
+ return ssestream.NewStream[CompletionResponse](ssestream.NewDecoder(raw), err)
}
// Generate embeddings for content pieces using the specified model.
@@ -146,7 +146,7 @@ type ChatCompletionResponseStreamChunkEvent struct {
// Any of "start", "complete", "progress".
EventType string `json:"event_type,required"`
// Optional log probabilities for generated tokens
- Logprobs []ChatCompletionResponseStreamChunkEventLogprob `json:"logprobs"`
+ Logprobs []TokenLogProbs `json:"logprobs"`
// Optional reason why generation stopped, if complete
//
// Any of "end_of_turn", "end_of_message", "out_of_tokens".
@@ -168,24 +168,44 @@ func (r *ChatCompletionResponseStreamChunkEvent) UnmarshalJSON(data []byte) erro
return apijson.UnmarshalRoot(data, r)
}
-// Log probabilities for generated tokens.
-type ChatCompletionResponseStreamChunkEventLogprob struct {
- // Dictionary mapping tokens to their log probabilities
- LogprobsByToken map[string]float64 `json:"logprobs_by_token,required"`
+// Response from a completion request.
+type CompletionResponse struct {
+ // The generated completion text
+ Content string `json:"content,required"`
+ // Reason why generation stopped
+ //
+ // Any of "end_of_turn", "end_of_message", "out_of_tokens".
+ StopReason CompletionResponseStopReason `json:"stop_reason,required"`
+ // Optional log probabilities for generated tokens
+ Logprobs []TokenLogProbs `json:"logprobs"`
+ // (Optional) List of metrics associated with the API response
+ Metrics []shared.Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- LogprobsByToken respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Content respjson.Field
+ StopReason respjson.Field
+ Logprobs respjson.Field
+ Metrics respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponseStreamChunkEventLogprob) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponseStreamChunkEventLogprob) UnmarshalJSON(data []byte) error {
+func (r CompletionResponse) RawJSON() string { return r.JSON.raw }
+func (r *CompletionResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Reason why generation stopped
+type CompletionResponseStopReason string
+
+const (
+ CompletionResponseStopReasonEndOfTurn CompletionResponseStopReason = "end_of_turn"
+ CompletionResponseStopReasonEndOfMessage CompletionResponseStopReason = "end_of_message"
+ CompletionResponseStopReasonOutOfTokens CompletionResponseStopReason = "out_of_tokens"
+)
+
// Response containing generated embeddings.
type EmbeddingsResponse struct {
// List of embedding vectors, one per input content. Each embedding is a list of
@@ -206,6 +226,24 @@ func (r *EmbeddingsResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Log probabilities for generated tokens.
+type TokenLogProbs struct {
+ // Dictionary mapping tokens to their log probabilities
+ LogprobsByToken map[string]float64 `json:"logprobs_by_token,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ LogprobsByToken respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TokenLogProbs) RawJSON() string { return r.JSON.raw }
+func (r *TokenLogProbs) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Response from a batch chat completion request.
type InferenceBatchChatCompletionResponse struct {
// List of chat completion responses, one for each conversation in the batch
diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go
index 9056b77..7574120 100644
--- a/packages/pagination/pagination.go
+++ b/packages/pagination/pagination.go
@@ -4,7 +4,6 @@ package pagination
import (
"net/http"
- "strconv"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -46,19 +45,15 @@ func (r *DatasetsIterrows[T]) GetNextPage() (res *DatasetsIterrows[T], err error
if len(r.Data) == 0 {
return nil, nil
}
- cfg := r.cfg.Clone(r.cfg.Context)
-
next := r.NextIndex
- length := int64(len(r.Data))
-
- if length > 0 && next != 0 {
- err = cfg.Apply(option.WithQuery("start_index", strconv.FormatInt(next, 10)))
- if err != nil {
- return nil, err
- }
- } else {
+ if len(next) == 0 {
return nil, nil
}
+ cfg := r.cfg.Clone(r.cfg.Context)
+ err = cfg.Apply(option.WithQuery("start_index", next))
+ if err != nil {
+ return nil, err
+ }
var raw *http.Response
cfg.ResponseInto = &raw
cfg.ResponseBodyInto = &res
diff --git a/shared/shared.go b/shared/shared.go
index b211704..eb9c8c2 100644
--- a/shared/shared.go
+++ b/shared/shared.go
@@ -5,6 +5,7 @@ package shared
import (
"encoding/json"
+ "github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
@@ -22,8 +23,8 @@ type AgentConfig struct {
// The system instructions for the agent
Instructions string `json:"instructions,required"`
// The model identifier to use for the agent
- Model string `json:"model,required"`
- ClientTools []SharedToolDef `json:"client_tools"`
+ Model string `json:"model,required"`
+ ClientTools []llamastackclient.ToolDef `json:"client_tools"`
// Optional flag indicating whether session data has to be persisted
EnableSessionPersistence bool `json:"enable_session_persistence"`
InputShields []string `json:"input_shields"`
@@ -268,10 +269,10 @@ type AgentConfigParam struct {
EnableSessionPersistence param.Opt[bool] `json:"enable_session_persistence,omitzero"`
MaxInferIters param.Opt[int64] `json:"max_infer_iters,omitzero"`
// Optional name for the agent, used in telemetry and identification
- Name param.Opt[string] `json:"name,omitzero"`
- ClientTools []SharedToolDefParam `json:"client_tools,omitzero"`
- InputShields []string `json:"input_shields,omitzero"`
- OutputShields []string `json:"output_shields,omitzero"`
+ Name param.Opt[string] `json:"name,omitzero"`
+ ClientTools []llamastackclient.ToolDefParam `json:"client_tools,omitzero"`
+ InputShields []string `json:"input_shields,omitzero"`
+ OutputShields []string `json:"output_shields,omitzero"`
// Optional response format configuration
ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
// Sampling parameters.
@@ -421,7 +422,7 @@ func (u *AgentConfigToolgroupAgentToolGroupWithArgsArgUnionParam) asAny() any {
// Response from a batch completion request.
type BatchCompletion struct {
// List of completion responses, one for each input in the batch
- Batch []SharedCompletionResponse `json:"batch,required"`
+ Batch []llamastackclient.CompletionResponse `json:"batch,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Batch respjson.Field
@@ -441,7 +442,7 @@ type ChatCompletionResponse struct {
// The complete response message
CompletionMessage CompletionMessage `json:"completion_message,required"`
// Optional log probabilities for generated tokens
- Logprobs []ChatCompletionResponseLogprob `json:"logprobs"`
+ Logprobs []llamastackclient.TokenLogProbs `json:"logprobs"`
// (Optional) List of metrics associated with the API response
Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -460,24 +461,6 @@ func (r *ChatCompletionResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Log probabilities for generated tokens.
-type ChatCompletionResponseLogprob struct {
- // Dictionary mapping tokens to their log probabilities
- LogprobsByToken map[string]float64 `json:"logprobs_by_token,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- LogprobsByToken respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponseLogprob) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponseLogprob) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A message containing the model's (assistant) response in a chat conversation.
type CompletionMessage struct {
// The content of the model's response
@@ -3093,342 +3076,6 @@ func (r *ScoringResultScoreRowUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Response from a completion request.
-type SharedCompletionResponse struct {
- // The generated completion text
- Content string `json:"content,required"`
- // Reason why generation stopped
- //
- // Any of "end_of_turn", "end_of_message", "out_of_tokens".
- StopReason SharedCompletionResponseStopReason `json:"stop_reason,required"`
- // Optional log probabilities for generated tokens
- Logprobs []SharedCompletionResponseLogprob `json:"logprobs"`
- // (Optional) List of metrics associated with the API response
- Metrics []Metric `json:"metrics"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Content respjson.Field
- StopReason respjson.Field
- Logprobs respjson.Field
- Metrics respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r SharedCompletionResponse) RawJSON() string { return r.JSON.raw }
-func (r *SharedCompletionResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Reason why generation stopped
-type SharedCompletionResponseStopReason string
-
-const (
- SharedCompletionResponseStopReasonEndOfTurn SharedCompletionResponseStopReason = "end_of_turn"
- SharedCompletionResponseStopReasonEndOfMessage SharedCompletionResponseStopReason = "end_of_message"
- SharedCompletionResponseStopReasonOutOfTokens SharedCompletionResponseStopReason = "out_of_tokens"
-)
-
-// Log probabilities for generated tokens.
-type SharedCompletionResponseLogprob struct {
- // Dictionary mapping tokens to their log probabilities
- LogprobsByToken map[string]float64 `json:"logprobs_by_token,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- LogprobsByToken respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r SharedCompletionResponseLogprob) RawJSON() string { return r.JSON.raw }
-func (r *SharedCompletionResponseLogprob) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Tool definition used in runtime contexts.
-type SharedToolDef struct {
- // Name of the tool
- Name string `json:"name,required"`
- // (Optional) Human-readable description of what the tool does
- Description string `json:"description"`
- // (Optional) Additional metadata about the tool
- Metadata map[string]SharedToolDefMetadataUnion `json:"metadata"`
- // (Optional) List of parameters this tool accepts
- Parameters []SharedToolDefParameter `json:"parameters"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Name respjson.Field
- Description respjson.Field
- Metadata respjson.Field
- Parameters respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r SharedToolDef) RawJSON() string { return r.JSON.raw }
-func (r *SharedToolDef) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToParam converts this SharedToolDef to a SharedToolDefParam.
-//
-// Warning: the fields of the param type will not be present. ToParam should only
-// be used at the last possible moment before sending a request. Test for this with
-// SharedToolDefParam.Overrides()
-func (r SharedToolDef) ToParam() SharedToolDefParam {
- return param.Override[SharedToolDefParam](json.RawMessage(r.RawJSON()))
-}
-
-// SharedToolDefMetadataUnion contains all possible properties and values from
-// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type SharedToolDefMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u SharedToolDefMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SharedToolDefMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SharedToolDefMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SharedToolDefMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u SharedToolDefMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *SharedToolDefMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Parameter definition for a tool.
-type SharedToolDefParameter struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Default value for the parameter if not provided
- Default SharedToolDefParameterDefaultUnion `json:"default,nullable"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Description respjson.Field
- Name respjson.Field
- ParameterType respjson.Field
- Required respjson.Field
- Default respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r SharedToolDefParameter) RawJSON() string { return r.JSON.raw }
-func (r *SharedToolDefParameter) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// SharedToolDefParameterDefaultUnion contains all possible properties and values
-// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type SharedToolDefParameterDefaultUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u SharedToolDefParameterDefaultUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SharedToolDefParameterDefaultUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SharedToolDefParameterDefaultUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SharedToolDefParameterDefaultUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u SharedToolDefParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *SharedToolDefParameterDefaultUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Tool definition used in runtime contexts.
-//
-// The property Name is required.
-type SharedToolDefParam struct {
- // Name of the tool
- Name string `json:"name,required"`
- // (Optional) Human-readable description of what the tool does
- Description param.Opt[string] `json:"description,omitzero"`
- // (Optional) Additional metadata about the tool
- Metadata map[string]SharedToolDefMetadataUnionParam `json:"metadata,omitzero"`
- // (Optional) List of parameters this tool accepts
- Parameters []SharedToolDefParameterParam `json:"parameters,omitzero"`
- paramObj
-}
-
-func (r SharedToolDefParam) MarshalJSON() (data []byte, err error) {
- type shadow SharedToolDefParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *SharedToolDefParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type SharedToolDefMetadataUnionParam struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u SharedToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *SharedToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *SharedToolDefMetadataUnionParam) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// Parameter definition for a tool.
-//
-// The properties Description, Name, ParameterType, Required are required.
-type SharedToolDefParameterParam struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Default value for the parameter if not provided
- Default SharedToolDefParameterDefaultUnionParam `json:"default,omitzero"`
- paramObj
-}
-
-func (r SharedToolDefParameterParam) MarshalJSON() (data []byte, err error) {
- type shadow SharedToolDefParameterParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *SharedToolDefParameterParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type SharedToolDefParameterDefaultUnionParam struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u SharedToolDefParameterDefaultUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *SharedToolDefParameterDefaultUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *SharedToolDefParameterDefaultUnionParam) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
// A system message providing instructions or context to the model.
//
// The properties Content, Role are required.
diff --git a/toolruntime.go b/toolruntime.go
index 59067b3..156d800 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -47,7 +47,7 @@ func (r *ToolRuntimeService) InvokeTool(ctx context.Context, body ToolRuntimeInv
}
// List all tools in the runtime.
-func (r *ToolRuntimeService) ListTools(ctx context.Context, query ToolRuntimeListToolsParams, opts ...option.RequestOption) (res *[]shared.SharedToolDef, err error) {
+func (r *ToolRuntimeService) ListTools(ctx context.Context, query ToolRuntimeListToolsParams, opts ...option.RequestOption) (res *[]ToolDef, err error) {
var env ToolRuntimeListToolsResponseEnvelope
opts = append(r.Options[:], opts...)
path := "v1/tool-runtime/list-tools"
@@ -59,6 +59,286 @@ func (r *ToolRuntimeService) ListTools(ctx context.Context, query ToolRuntimeLis
return
}
+// Tool definition used in runtime contexts.
+type ToolDef struct {
+ // Name of the tool
+ Name string `json:"name,required"`
+ // (Optional) Human-readable description of what the tool does
+ Description string `json:"description"`
+ // (Optional) Additional metadata about the tool
+ Metadata map[string]ToolDefMetadataUnion `json:"metadata"`
+ // (Optional) List of parameters this tool accepts
+ Parameters []ToolDefParameter `json:"parameters"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Description respjson.Field
+ Metadata respjson.Field
+ Parameters respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolDef) RawJSON() string { return r.JSON.raw }
+func (r *ToolDef) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToParam converts this ToolDef to a ToolDefParam.
+//
+// Warning: the fields of the param type will not be present. ToParam should only
+// be used at the last possible moment before sending a request. Test for this with
+// ToolDefParam.Overrides()
+func (r ToolDef) ToParam() ToolDefParam {
+ return param.Override[ToolDefParam](json.RawMessage(r.RawJSON()))
+}
+
+// ToolDefMetadataUnion contains all possible properties and values from [bool],
+// [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ToolDefMetadataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ToolDefMetadataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefMetadataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefMetadataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefMetadataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ToolDefMetadataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ToolDefMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Parameter definition for a tool.
+type ToolDefParameter struct {
+ // Human-readable description of what the parameter does
+ Description string `json:"description,required"`
+ // Name of the parameter
+ Name string `json:"name,required"`
+ // Type of the parameter (e.g., string, integer)
+ ParameterType string `json:"parameter_type,required"`
+ // Whether this parameter is required for tool invocation
+ Required bool `json:"required,required"`
+ // (Optional) Default value for the parameter if not provided
+ Default ToolDefParameterDefaultUnion `json:"default,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Description respjson.Field
+ Name respjson.Field
+ ParameterType respjson.Field
+ Required respjson.Field
+ Default respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolDefParameter) RawJSON() string { return r.JSON.raw }
+func (r *ToolDefParameter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToolDefParameterDefaultUnion contains all possible properties and values from
+// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ToolDefParameterDefaultUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ToolDefParameterDefaultUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefParameterDefaultUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefParameterDefaultUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefParameterDefaultUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ToolDefParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ToolDefParameterDefaultUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Tool definition used in runtime contexts.
+//
+// The property Name is required.
+type ToolDefParam struct {
+ // Name of the tool
+ Name string `json:"name,required"`
+ // (Optional) Human-readable description of what the tool does
+ Description param.Opt[string] `json:"description,omitzero"`
+ // (Optional) Additional metadata about the tool
+ Metadata map[string]ToolDefMetadataUnionParam `json:"metadata,omitzero"`
+ // (Optional) List of parameters this tool accepts
+ Parameters []ToolDefParameterParam `json:"parameters,omitzero"`
+ paramObj
+}
+
+func (r ToolDefParam) MarshalJSON() (data []byte, err error) {
+ type shadow ToolDefParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ToolDefParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ToolDefMetadataUnionParam struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ToolDefMetadataUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
+// Parameter definition for a tool.
+//
+// The properties Description, Name, ParameterType, Required are required.
+type ToolDefParameterParam struct {
+ // Human-readable description of what the parameter does
+ Description string `json:"description,required"`
+ // Name of the parameter
+ Name string `json:"name,required"`
+ // Type of the parameter (e.g., string, integer)
+ ParameterType string `json:"parameter_type,required"`
+ // Whether this parameter is required for tool invocation
+ Required bool `json:"required,required"`
+ // (Optional) Default value for the parameter if not provided
+ Default ToolDefParameterDefaultUnionParam `json:"default,omitzero"`
+ paramObj
+}
+
+func (r ToolDefParameterParam) MarshalJSON() (data []byte, err error) {
+ type shadow ToolDefParameterParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ToolDefParameterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ToolDefParameterDefaultUnionParam struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ToolDefParameterDefaultUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ToolDefParameterDefaultUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ToolDefParameterDefaultUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
// Result of a tool invocation.
type ToolInvocationResult struct {
// (Optional) The output content from the tool execution
@@ -223,7 +503,7 @@ func (r ToolRuntimeListToolsParamsMcpEndpoint) URLQuery() (v url.Values, err err
// Response containing a list of tool definitions.
type ToolRuntimeListToolsResponseEnvelope struct {
// List of tool definitions
- Data []shared.SharedToolDef `json:"data,required"`
+ Data []ToolDef `json:"data,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
From 66adbea266032b1198c76c8f590808d61a3d145a Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 29 Aug 2025 03:10:37 +0000
Subject: [PATCH 06/33] fix: close body before retrying
---
internal/requestconfig/requestconfig.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index 6760966..8b4d023 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -461,6 +461,11 @@ func (cfg *RequestConfig) Execute() (err error) {
break
}
+ // Close the response body before retrying to prevent connection leaks
+ if res != nil && res.Body != nil {
+ res.Body.Close()
+ }
+
time.Sleep(retryDelay(res, retryCount))
}
From a3cccf10d30121514bb6b07a6416c589a1881763 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 3 Sep 2025 03:06:27 +0000
Subject: [PATCH 07/33] chore(internal): codegen related update
---
README.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 2fd267d..6e24092 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,11 @@
# Llama Stack Client Go API Library
+
+
+
+
The Llama Stack Client Go library provides convenient access to the [Llama Stack Client REST API](https://llama-stack.readthedocs.io/en/latest/)
from applications written in Go.
From 0b95836016ca0d089d3f7c07456ff5f55989011f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 5 Sep 2025 13:31:14 +0000
Subject: [PATCH 08/33] fix(client): fix circular dependencies and offset
pagination
---
.stats.yml | 2 +-
README.md | 24 +-
agent.go | 17 +-
agent_test.go | 23 +-
agentstep.go | 11 +-
agentturn.go | 67 ++--
agentturn_test.go | 9 +-
aliases.go | 556 ------------------------------
api.md | 68 ++--
client_test.go | 61 ++--
eval.go | 19 +-
eval_test.go | 41 ++-
inference.go | 53 ++-
inference_test.go | 77 ++---
packages/pagination/pagination.go | 17 +-
safety.go | 5 +-
safety_test.go | 9 +-
scoring.go | 5 +-
shared/shared.go => shared.go | 39 +--
syntheticdatageneration.go | 3 +-
syntheticdatageneration_test.go | 9 +-
toolruntime.go | 3 +-
toolruntimeragtool.go | 9 +-
toolruntimeragtool_test.go | 21 +-
vectorio.go | 7 +-
vectorio_test.go | 5 +-
26 files changed, 294 insertions(+), 866 deletions(-)
rename shared/shared.go => shared.go (99%)
diff --git a/.stats.yml b/.stats.yml
index f937dc2..53ea203 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 107
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: 40b8d777e1eb8b6ab05759b663edd2fb
+config_hash: 374d9711288576877a9fabb34e4da7b9
diff --git a/README.md b/README.md
index 6e24092..a1d8ae6 100644
--- a/README.md
+++ b/README.md
@@ -297,9 +297,9 @@ To handle errors, we recommend that you use the `errors.As` pattern:
```go
_, err := client.Inference.ChatCompletion(context.TODO(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -333,9 +333,9 @@ defer cancel()
client.Inference.ChatCompletion(
ctx,
llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -399,9 +399,9 @@ client := llamastackclient.NewClient(
client.Inference.ChatCompletion(
context.TODO(),
llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -423,9 +423,9 @@ var response *http.Response
chatCompletionResponse, err := client.Inference.ChatCompletion(
context.TODO(),
llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
diff --git a/agent.go b/agent.go
index d5d87ef..4137935 100644
--- a/agent.go
+++ b/agent.go
@@ -17,7 +17,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
@@ -90,7 +89,7 @@ func (r *AgentService) Delete(ctx context.Context, agentID string, opts ...optio
// An inference step in an agent turn.
type InferenceStep struct {
// The response from the LLM.
- ModelResponse shared.CompletionMessage `json:"model_response,required"`
+ ModelResponse CompletionMessage `json:"model_response,required"`
// The ID of the step.
StepID string `json:"step_id,required"`
// Type of the step in an agent turn.
@@ -123,7 +122,7 @@ func (r *InferenceStep) UnmarshalJSON(data []byte) error {
// A memory retrieval step in an agent turn.
type MemoryRetrievalStep struct {
// The context retrieved from the vector databases.
- InsertedContext shared.InterleavedContentUnion `json:"inserted_context,required"`
+ InsertedContext InterleavedContentUnion `json:"inserted_context,required"`
// The ID of the step.
StepID string `json:"step_id,required"`
// Type of the step in an agent turn.
@@ -169,7 +168,7 @@ type ShieldCallStep struct {
// The time the step started.
StartedAt time.Time `json:"started_at" format:"date-time"`
// The violation from the shield call.
- Violation shared.SafetyViolation `json:"violation"`
+ Violation SafetyViolation `json:"violation"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
StepID respjson.Field
@@ -196,7 +195,7 @@ type ToolExecutionStep struct {
// Type of the step in an agent turn.
StepType constant.ToolExecution `json:"step_type,required"`
// The tool calls to execute.
- ToolCalls []shared.ToolCall `json:"tool_calls,required"`
+ ToolCalls []ToolCall `json:"tool_calls,required"`
// The tool responses from the tool calls.
ToolResponses []ToolResponse `json:"tool_responses,required"`
// The ID of the turn.
@@ -230,7 +229,7 @@ type ToolResponse struct {
// Unique identifier for the tool call this response is for
CallID string `json:"call_id,required"`
// The response content from the tool
- Content shared.InterleavedContentUnion `json:"content,required"`
+ Content InterleavedContentUnion `json:"content,required"`
// Name of the tool that was invoked
ToolName ToolResponseToolName `json:"tool_name,required"`
// (Optional) Additional metadata about the tool response
@@ -330,7 +329,7 @@ type ToolResponseParam struct {
// Unique identifier for the tool call this response is for
CallID string `json:"call_id,required"`
// The response content from the tool
- Content shared.InterleavedContentUnionParam `json:"content,omitzero,required"`
+ Content InterleavedContentUnionParam `json:"content,omitzero,required"`
// Name of the tool that was invoked
ToolName ToolResponseToolName `json:"tool_name,omitzero,required"`
// (Optional) Additional metadata about the tool response
@@ -398,7 +397,7 @@ func (r *AgentNewResponse) UnmarshalJSON(data []byte) error {
// An agent instance with configuration and metadata.
type AgentGetResponse struct {
// Configuration settings for the agent
- AgentConfig shared.AgentConfig `json:"agent_config,required"`
+ AgentConfig AgentConfig `json:"agent_config,required"`
// Unique identifier for the agent
AgentID string `json:"agent_id,required"`
// Timestamp when the agent was created
@@ -497,7 +496,7 @@ func (r *AgentListResponseDataUnion) UnmarshalJSON(data []byte) error {
type AgentNewParams struct {
// The configuration for the agent.
- AgentConfig shared.AgentConfigParam `json:"agent_config,omitzero,required"`
+ AgentConfig AgentConfigParam `json:"agent_config,omitzero,required"`
paramObj
}
diff --git a/agent_test.go b/agent_test.go
index bfdd200..4d38d0e 100644
--- a/agent_test.go
+++ b/agent_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestAgentNewWithOptionalParams(t *testing.T) {
@@ -26,7 +25,7 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Agents.New(context.TODO(), llamastackclient.AgentNewParams{
- AgentConfig: shared.AgentConfigParam{
+ AgentConfig: llamastackclient.AgentConfigParam{
Instructions: "instructions",
Model: "model",
ClientTools: []llamastackclient.ToolDefParam{{
@@ -52,31 +51,31 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
MaxInferIters: llamastackclient.Int(0),
Name: llamastackclient.String("name"),
OutputShields: []string{"string"},
- ResponseFormat: shared.ResponseFormatUnionParam{
- OfJsonSchema: &shared.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]shared.ResponseFormatJsonSchemaJsonSchemaUnionParam{
+ ResponseFormat: llamastackclient.ResponseFormatUnionParam{
+ OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
+ JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
},
},
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
Stop: []string{"string"},
},
- ToolChoice: shared.AgentConfigToolChoiceAuto,
- ToolConfig: shared.AgentConfigToolConfigParam{
+ ToolChoice: llamastackclient.AgentConfigToolChoiceAuto,
+ ToolConfig: llamastackclient.AgentConfigToolConfigParam{
SystemMessageBehavior: "append",
ToolChoice: "auto",
ToolPromptFormat: "json",
},
- ToolPromptFormat: shared.AgentConfigToolPromptFormatJson,
- Toolgroups: []shared.AgentConfigToolgroupUnionParam{{
+ ToolPromptFormat: llamastackclient.AgentConfigToolPromptFormatJson,
+ Toolgroups: []llamastackclient.AgentConfigToolgroupUnionParam{{
OfString: llamastackclient.String("string"),
}},
},
diff --git a/agentstep.go b/agentstep.go
index 40ddfa3..7ce85a2 100644
--- a/agentstep.go
+++ b/agentstep.go
@@ -14,7 +14,6 @@ import (
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// AgentStepService contains methods and other services that help with interacting
@@ -86,21 +85,21 @@ func (r *AgentStepGetResponse) UnmarshalJSON(data []byte) error {
// Use the methods beginning with 'As' to cast the union to one of its variants.
type AgentStepGetResponseStepUnion struct {
// This field is from variant [InferenceStep].
- ModelResponse shared.CompletionMessage `json:"model_response"`
- StepID string `json:"step_id"`
+ ModelResponse CompletionMessage `json:"model_response"`
+ StepID string `json:"step_id"`
// Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
StepType string `json:"step_type"`
TurnID string `json:"turn_id"`
CompletedAt time.Time `json:"completed_at"`
StartedAt time.Time `json:"started_at"`
// This field is from variant [ToolExecutionStep].
- ToolCalls []shared.ToolCall `json:"tool_calls"`
+ ToolCalls []ToolCall `json:"tool_calls"`
// This field is from variant [ToolExecutionStep].
ToolResponses []ToolResponse `json:"tool_responses"`
// This field is from variant [ShieldCallStep].
- Violation shared.SafetyViolation `json:"violation"`
+ Violation SafetyViolation `json:"violation"`
// This field is from variant [MemoryRetrievalStep].
- InsertedContext shared.InterleavedContentUnion `json:"inserted_context"`
+ InsertedContext InterleavedContentUnion `json:"inserted_context"`
// This field is from variant [MemoryRetrievalStep].
VectorDBIDs string `json:"vector_db_ids"`
JSON struct {
diff --git a/agentturn.go b/agentturn.go
index d3f14af..7a0e9e0 100644
--- a/agentturn.go
+++ b/agentturn.go
@@ -16,7 +16,6 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
"github.com/llamastack/llama-stack-client-go/packages/ssestream"
- "github.com/llamastack/llama-stack-client-go/shared"
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
@@ -170,7 +169,7 @@ type Turn struct {
// List of messages that initiated this turn
InputMessages []TurnInputMessageUnion `json:"input_messages,required"`
// The model's generated response containing content and metadata
- OutputMessage shared.CompletionMessage `json:"output_message,required"`
+ OutputMessage CompletionMessage `json:"output_message,required"`
// Unique identifier for the conversation session
SessionID string `json:"session_id,required"`
// Timestamp when the turn began
@@ -205,16 +204,16 @@ func (r *Turn) UnmarshalJSON(data []byte) error {
}
// TurnInputMessageUnion contains all possible properties and values from
-// [shared.UserMessage], [shared.ToolResponseMessage].
+// [UserMessage], [ToolResponseMessage].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
type TurnInputMessageUnion struct {
- // This field is from variant [shared.UserMessage].
- Content shared.InterleavedContentUnion `json:"content"`
- Role string `json:"role"`
- // This field is from variant [shared.UserMessage].
- Context shared.InterleavedContentUnion `json:"context"`
- // This field is from variant [shared.ToolResponseMessage].
+ // This field is from variant [UserMessage].
+ Content InterleavedContentUnion `json:"content"`
+ Role string `json:"role"`
+ // This field is from variant [UserMessage].
+ Context InterleavedContentUnion `json:"context"`
+ // This field is from variant [ToolResponseMessage].
CallID string `json:"call_id"`
JSON struct {
Content respjson.Field
@@ -225,12 +224,12 @@ type TurnInputMessageUnion struct {
} `json:"-"`
}
-func (u TurnInputMessageUnion) AsUserMessage() (v shared.UserMessage) {
+func (u TurnInputMessageUnion) AsUserMessage() (v UserMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u TurnInputMessageUnion) AsToolResponseMessage() (v shared.ToolResponseMessage) {
+func (u TurnInputMessageUnion) AsToolResponseMessage() (v ToolResponseMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
@@ -250,21 +249,21 @@ func (r *TurnInputMessageUnion) UnmarshalJSON(data []byte) error {
// Use the methods beginning with 'As' to cast the union to one of its variants.
type TurnStepUnion struct {
// This field is from variant [InferenceStep].
- ModelResponse shared.CompletionMessage `json:"model_response"`
- StepID string `json:"step_id"`
+ ModelResponse CompletionMessage `json:"model_response"`
+ StepID string `json:"step_id"`
// Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
StepType string `json:"step_type"`
TurnID string `json:"turn_id"`
CompletedAt time.Time `json:"completed_at"`
StartedAt time.Time `json:"started_at"`
// This field is from variant [ToolExecutionStep].
- ToolCalls []shared.ToolCall `json:"tool_calls"`
+ ToolCalls []ToolCall `json:"tool_calls"`
// This field is from variant [ToolExecutionStep].
ToolResponses []ToolResponse `json:"tool_responses"`
// This field is from variant [ShieldCallStep].
- Violation shared.SafetyViolation `json:"violation"`
+ Violation SafetyViolation `json:"violation"`
// This field is from variant [MemoryRetrievalStep].
- InsertedContext shared.InterleavedContentUnion `json:"inserted_context"`
+ InsertedContext InterleavedContentUnion `json:"inserted_context"`
// This field is from variant [MemoryRetrievalStep].
VectorDBIDs string `json:"vector_db_ids"`
JSON struct {
@@ -368,8 +367,8 @@ func (r *TurnOutputAttachment) UnmarshalJSON(data []byte) error {
// TurnOutputAttachmentContentUnion contains all possible properties and values
// from [string], [TurnOutputAttachmentContentImageContentItem],
-// [TurnOutputAttachmentContentTextContentItem],
-// [[]shared.InterleavedContentItemUnion], [TurnOutputAttachmentContentURL].
+// [TurnOutputAttachmentContentTextContentItem], [[]InterleavedContentItemUnion],
+// [TurnOutputAttachmentContentURL].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
//
@@ -378,9 +377,9 @@ func (r *TurnOutputAttachment) UnmarshalJSON(data []byte) error {
type TurnOutputAttachmentContentUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
- // This field will be present if the value is a
- // [[]shared.InterleavedContentItemUnion] instead of an object.
- OfInterleavedContentItemArray []shared.InterleavedContentItemUnion `json:",inline"`
+ // This field will be present if the value is a [[]InterleavedContentItemUnion]
+ // instead of an object.
+ OfInterleavedContentItemArray []InterleavedContentItemUnion `json:",inline"`
// This field is from variant [TurnOutputAttachmentContentImageContentItem].
Image TurnOutputAttachmentContentImageContentItemImage `json:"image"`
Type string `json:"type"`
@@ -414,7 +413,7 @@ func (u TurnOutputAttachmentContentUnion) AsTextContentItem() (v TurnOutputAttac
return
}
-func (u TurnOutputAttachmentContentUnion) AsInterleavedContentItemArray() (v []shared.InterleavedContentItemUnion) {
+func (u TurnOutputAttachmentContentUnion) AsInterleavedContentItemArray() (v []InterleavedContentItemUnion) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
@@ -568,7 +567,7 @@ type TurnResponseEventPayloadUnion struct {
// This field is from variant [TurnResponseEventPayloadStepStart].
Metadata map[string]TurnResponseEventPayloadStepStartMetadataUnion `json:"metadata"`
// This field is from variant [TurnResponseEventPayloadStepProgress].
- Delta shared.ContentDeltaUnion `json:"delta"`
+ Delta ContentDeltaUnion `json:"delta"`
// This field is from variant [TurnResponseEventPayloadStepComplete].
StepDetails TurnResponseEventPayloadStepCompleteStepDetailsUnion `json:"step_details"`
// This field is from variant [TurnResponseEventPayloadTurnStart].
@@ -753,7 +752,7 @@ func (r *TurnResponseEventPayloadStepStartMetadataUnion) UnmarshalJSON(data []by
// Payload for step progress events in agent turn responses.
type TurnResponseEventPayloadStepProgress struct {
// Incremental content changes during step execution
- Delta shared.ContentDeltaUnion `json:"delta,required"`
+ Delta ContentDeltaUnion `json:"delta,required"`
// Type of event being reported
EventType constant.StepProgress `json:"event_type,required"`
// Unique identifier for the step within a turn
@@ -818,21 +817,21 @@ func (r *TurnResponseEventPayloadStepComplete) UnmarshalJSON(data []byte) error
// Use the methods beginning with 'As' to cast the union to one of its variants.
type TurnResponseEventPayloadStepCompleteStepDetailsUnion struct {
// This field is from variant [InferenceStep].
- ModelResponse shared.CompletionMessage `json:"model_response"`
- StepID string `json:"step_id"`
+ ModelResponse CompletionMessage `json:"model_response"`
+ StepID string `json:"step_id"`
// Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
StepType string `json:"step_type"`
TurnID string `json:"turn_id"`
CompletedAt time.Time `json:"completed_at"`
StartedAt time.Time `json:"started_at"`
// This field is from variant [ToolExecutionStep].
- ToolCalls []shared.ToolCall `json:"tool_calls"`
+ ToolCalls []ToolCall `json:"tool_calls"`
// This field is from variant [ToolExecutionStep].
ToolResponses []ToolResponse `json:"tool_responses"`
// This field is from variant [ShieldCallStep].
- Violation shared.SafetyViolation `json:"violation"`
+ Violation SafetyViolation `json:"violation"`
// This field is from variant [MemoryRetrievalStep].
- InsertedContext shared.InterleavedContentUnion `json:"inserted_context"`
+ InsertedContext InterleavedContentUnion `json:"inserted_context"`
// This field is from variant [MemoryRetrievalStep].
VectorDBIDs string `json:"vector_db_ids"`
JSON struct {
@@ -1005,8 +1004,8 @@ func (r *AgentTurnNewParams) UnmarshalJSON(data []byte) error {
//
// Use [param.IsOmitted] to confirm if a field is set.
type AgentTurnNewParamsMessageUnion struct {
- OfUserMessage *shared.UserMessageParam `json:",omitzero,inline"`
- OfToolResponseMessage *shared.ToolResponseMessageParam `json:",omitzero,inline"`
+ OfUserMessage *UserMessageParam `json:",omitzero,inline"`
+ OfToolResponseMessage *ToolResponseMessageParam `json:",omitzero,inline"`
paramUnion
}
@@ -1027,7 +1026,7 @@ func (u *AgentTurnNewParamsMessageUnion) asAny() any {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsMessageUnion) GetContext() *shared.InterleavedContentUnionParam {
+func (u AgentTurnNewParamsMessageUnion) GetContext() *InterleavedContentUnionParam {
if vt := u.OfUserMessage; vt != nil {
return &vt.Context
}
@@ -1053,7 +1052,7 @@ func (u AgentTurnNewParamsMessageUnion) GetRole() *string {
}
// Returns a pointer to the underlying variant's Content property, if present.
-func (u AgentTurnNewParamsMessageUnion) GetContent() *shared.InterleavedContentUnionParam {
+func (u AgentTurnNewParamsMessageUnion) GetContent() *InterleavedContentUnionParam {
if vt := u.OfUserMessage; vt != nil {
return &vt.Content
} else if vt := u.OfToolResponseMessage; vt != nil {
@@ -1088,7 +1087,7 @@ type AgentTurnNewParamsDocumentContentUnion struct {
OfString param.Opt[string] `json:",omitzero,inline"`
OfImageContentItem *AgentTurnNewParamsDocumentContentImageContentItem `json:",omitzero,inline"`
OfTextContentItem *AgentTurnNewParamsDocumentContentTextContentItem `json:",omitzero,inline"`
- OfInterleavedContentItemArray []shared.InterleavedContentItemUnionParam `json:",omitzero,inline"`
+ OfInterleavedContentItemArray []InterleavedContentItemUnionParam `json:",omitzero,inline"`
OfURL *AgentTurnNewParamsDocumentContentURL `json:",omitzero,inline"`
paramUnion
}
diff --git a/agentturn_test.go b/agentturn_test.go
index 72ef6ce..963e087 100644
--- a/agentturn_test.go
+++ b/agentturn_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestAgentTurnNewWithOptionalParams(t *testing.T) {
@@ -31,11 +30,11 @@ func TestAgentTurnNewWithOptionalParams(t *testing.T) {
llamastackclient.AgentTurnNewParams{
AgentID: "agent_id",
Messages: []llamastackclient.AgentTurnNewParamsMessageUnion{{
- OfUserMessage: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ OfUserMessage: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
- Context: shared.InterleavedContentUnionParam{
+ Context: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -112,7 +111,7 @@ func TestAgentTurnResumeWithOptionalParams(t *testing.T) {
SessionID: "session_id",
ToolResponses: []llamastackclient.ToolResponseParam{{
CallID: "call_id",
- Content: shared.InterleavedContentUnionParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
ToolName: llamastackclient.ToolResponseToolNameBraveSearch,
diff --git a/aliases.go b/aliases.go
index 555023a..378eb17 100644
--- a/aliases.go
+++ b/aliases.go
@@ -4,562 +4,6 @@ package llamastackclient
import (
"github.com/llamastack/llama-stack-client-go/internal/apierror"
- "github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/shared"
)
-// aliased to make [param.APIUnion] private when embedding
-type paramUnion = param.APIUnion
-
-// aliased to make [param.APIObject] private when embedding
-type paramObj = param.APIObject
-
type Error = apierror.Error
-
-// Configuration for an agent.
-//
-// This is an alias to an internal type.
-type AgentConfig = shared.AgentConfig
-
-// Whether tool use is required or automatic. This is a hint to the model which may
-// not be followed. It depends on the Instruction Following capabilities of the
-// model.
-//
-// This is an alias to an internal type.
-type AgentConfigToolChoice = shared.AgentConfigToolChoice
-
-// Equals "auto"
-const AgentConfigToolChoiceAuto = shared.AgentConfigToolChoiceAuto
-
-// Equals "required"
-const AgentConfigToolChoiceRequired = shared.AgentConfigToolChoiceRequired
-
-// Equals "none"
-const AgentConfigToolChoiceNone = shared.AgentConfigToolChoiceNone
-
-// Configuration for tool use.
-//
-// This is an alias to an internal type.
-type AgentConfigToolConfig = shared.AgentConfigToolConfig
-
-// Prompt format for calling custom / zero shot tools.
-//
-// This is an alias to an internal type.
-type AgentConfigToolPromptFormat = shared.AgentConfigToolPromptFormat
-
-// Equals "json"
-const AgentConfigToolPromptFormatJson = shared.AgentConfigToolPromptFormatJson
-
-// Equals "function_tag"
-const AgentConfigToolPromptFormatFunctionTag = shared.AgentConfigToolPromptFormatFunctionTag
-
-// Equals "python_list"
-const AgentConfigToolPromptFormatPythonList = shared.AgentConfigToolPromptFormatPythonList
-
-// This is an alias to an internal type.
-type AgentConfigToolgroupUnion = shared.AgentConfigToolgroupUnion
-
-// This is an alias to an internal type.
-type AgentConfigToolgroupAgentToolGroupWithArgs = shared.AgentConfigToolgroupAgentToolGroupWithArgs
-
-// This is an alias to an internal type.
-type AgentConfigToolgroupAgentToolGroupWithArgsArgUnion = shared.AgentConfigToolgroupAgentToolGroupWithArgsArgUnion
-
-// Configuration for an agent.
-//
-// This is an alias to an internal type.
-type AgentConfigParam = shared.AgentConfigParam
-
-// Configuration for tool use.
-//
-// This is an alias to an internal type.
-type AgentConfigToolConfigParam = shared.AgentConfigToolConfigParam
-
-// This is an alias to an internal type.
-type AgentConfigToolgroupUnionParam = shared.AgentConfigToolgroupUnionParam
-
-// This is an alias to an internal type.
-type AgentConfigToolgroupAgentToolGroupWithArgsParam = shared.AgentConfigToolgroupAgentToolGroupWithArgsParam
-
-// This is an alias to an internal type.
-type AgentConfigToolgroupAgentToolGroupWithArgsArgUnionParam = shared.AgentConfigToolgroupAgentToolGroupWithArgsArgUnionParam
-
-// Response from a batch completion request.
-//
-// This is an alias to an internal type.
-type BatchCompletion = shared.BatchCompletion
-
-// Response from a chat completion request.
-//
-// This is an alias to an internal type.
-type ChatCompletionResponse = shared.ChatCompletionResponse
-
-// A message containing the model's (assistant) response in a chat conversation.
-//
-// This is an alias to an internal type.
-type CompletionMessage = shared.CompletionMessage
-
-// Reason why the model stopped generating. Options are: -
-// `StopReason.end_of_turn`: The model finished generating the entire response. -
-// `StopReason.end_of_message`: The model finished generating but generated a
-// partial response -- usually, a tool call. The user may call the tool and
-// continue the conversation with the tool's response. -
-// `StopReason.out_of_tokens`: The model ran out of token budget.
-//
-// This is an alias to an internal type.
-type CompletionMessageStopReason = shared.CompletionMessageStopReason
-
-// Equals "end_of_turn"
-const CompletionMessageStopReasonEndOfTurn = shared.CompletionMessageStopReasonEndOfTurn
-
-// Equals "end_of_message"
-const CompletionMessageStopReasonEndOfMessage = shared.CompletionMessageStopReasonEndOfMessage
-
-// Equals "out_of_tokens"
-const CompletionMessageStopReasonOutOfTokens = shared.CompletionMessageStopReasonOutOfTokens
-
-// A message containing the model's (assistant) response in a chat conversation.
-//
-// This is an alias to an internal type.
-type CompletionMessageParam = shared.CompletionMessageParam
-
-// A text content delta for streaming responses.
-//
-// This is an alias to an internal type.
-type ContentDeltaUnion = shared.ContentDeltaUnion
-
-// A text content delta for streaming responses.
-//
-// This is an alias to an internal type.
-type ContentDeltaText = shared.ContentDeltaText
-
-// An image content delta for streaming responses.
-//
-// This is an alias to an internal type.
-type ContentDeltaImage = shared.ContentDeltaImage
-
-// A tool call content delta for streaming responses.
-//
-// This is an alias to an internal type.
-type ContentDeltaToolCall = shared.ContentDeltaToolCall
-
-// Either an in-progress tool call string or the final parsed tool call
-//
-// This is an alias to an internal type.
-type ContentDeltaToolCallToolCallUnion = shared.ContentDeltaToolCallToolCallUnion
-
-// A document to be used for document ingestion in the RAG Tool.
-//
-// This is an alias to an internal type.
-type DocumentParam = shared.DocumentParam
-
-// The content of the document.
-//
-// This is an alias to an internal type.
-type DocumentContentUnionParam = shared.DocumentContentUnionParam
-
-// A image content item
-//
-// This is an alias to an internal type.
-type DocumentContentImageContentItemParam = shared.DocumentContentImageContentItemParam
-
-// Image as a base64 encoded string or an URL
-//
-// This is an alias to an internal type.
-type DocumentContentImageContentItemImageParam = shared.DocumentContentImageContentItemImageParam
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-//
-// This is an alias to an internal type.
-type DocumentContentImageContentItemImageURLParam = shared.DocumentContentImageContentItemImageURLParam
-
-// A text content item
-//
-// This is an alias to an internal type.
-type DocumentContentTextContentItemParam = shared.DocumentContentTextContentItemParam
-
-// A URL reference to external content.
-//
-// This is an alias to an internal type.
-type DocumentContentURLParam = shared.DocumentContentURLParam
-
-// This is an alias to an internal type.
-type DocumentMetadataUnionParam = shared.DocumentMetadataUnionParam
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentUnion = shared.InterleavedContentUnion
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentImageContentItem = shared.InterleavedContentImageContentItem
-
-// Image as a base64 encoded string or an URL
-//
-// This is an alias to an internal type.
-type InterleavedContentImageContentItemImage = shared.InterleavedContentImageContentItemImage
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-//
-// This is an alias to an internal type.
-type InterleavedContentImageContentItemImageURL = shared.InterleavedContentImageContentItemImageURL
-
-// A text content item
-//
-// This is an alias to an internal type.
-type InterleavedContentTextContentItem = shared.InterleavedContentTextContentItem
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentUnionParam = shared.InterleavedContentUnionParam
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentImageContentItemParam = shared.InterleavedContentImageContentItemParam
-
-// Image as a base64 encoded string or an URL
-//
-// This is an alias to an internal type.
-type InterleavedContentImageContentItemImageParam = shared.InterleavedContentImageContentItemImageParam
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-//
-// This is an alias to an internal type.
-type InterleavedContentImageContentItemImageURLParam = shared.InterleavedContentImageContentItemImageURLParam
-
-// A text content item
-//
-// This is an alias to an internal type.
-type InterleavedContentTextContentItemParam = shared.InterleavedContentTextContentItemParam
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentItemUnion = shared.InterleavedContentItemUnion
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentItemImage = shared.InterleavedContentItemImage
-
-// Image as a base64 encoded string or an URL
-//
-// This is an alias to an internal type.
-type InterleavedContentItemImageImage = shared.InterleavedContentItemImageImage
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-//
-// This is an alias to an internal type.
-type InterleavedContentItemImageImageURL = shared.InterleavedContentItemImageImageURL
-
-// A text content item
-//
-// This is an alias to an internal type.
-type InterleavedContentItemText = shared.InterleavedContentItemText
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentItemUnionParam = shared.InterleavedContentItemUnionParam
-
-// A image content item
-//
-// This is an alias to an internal type.
-type InterleavedContentItemImageParam = shared.InterleavedContentItemImageParam
-
-// Image as a base64 encoded string or an URL
-//
-// This is an alias to an internal type.
-type InterleavedContentItemImageImageParam = shared.InterleavedContentItemImageImageParam
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-//
-// This is an alias to an internal type.
-type InterleavedContentItemImageImageURLParam = shared.InterleavedContentItemImageImageURLParam
-
-// A text content item
-//
-// This is an alias to an internal type.
-type InterleavedContentItemTextParam = shared.InterleavedContentItemTextParam
-
-// A message from the user in a chat conversation.
-//
-// This is an alias to an internal type.
-type MessageUnionParam = shared.MessageUnionParam
-
-// A metric value included in API responses.
-//
-// This is an alias to an internal type.
-type Metric = shared.Metric
-
-// Configuration for the RAG query generation.
-//
-// This is an alias to an internal type.
-type QueryConfigParam = shared.QueryConfigParam
-
-// Search mode for retrieval—either "vector", "keyword", or "hybrid". Default
-// "vector".
-//
-// This is an alias to an internal type.
-type QueryConfigMode = shared.QueryConfigMode
-
-// Equals "vector"
-const QueryConfigModeVector = shared.QueryConfigModeVector
-
-// Equals "keyword"
-const QueryConfigModeKeyword = shared.QueryConfigModeKeyword
-
-// Equals "hybrid"
-const QueryConfigModeHybrid = shared.QueryConfigModeHybrid
-
-// Configuration for the ranker to use in hybrid search. Defaults to RRF ranker.
-//
-// This is an alias to an internal type.
-type QueryConfigRankerUnionParam = shared.QueryConfigRankerUnionParam
-
-// Reciprocal Rank Fusion (RRF) ranker configuration.
-//
-// This is an alias to an internal type.
-type QueryConfigRankerRrfParam = shared.QueryConfigRankerRrfParam
-
-// Weighted ranker configuration that combines vector and keyword scores.
-//
-// This is an alias to an internal type.
-type QueryConfigRankerWeightedParam = shared.QueryConfigRankerWeightedParam
-
-// Configuration for the default RAG query generator.
-//
-// This is an alias to an internal type.
-type QueryGeneratorConfigUnionParam = shared.QueryGeneratorConfigUnionParam
-
-// Configuration for the default RAG query generator.
-//
-// This is an alias to an internal type.
-type QueryGeneratorConfigDefaultParam = shared.QueryGeneratorConfigDefaultParam
-
-// Configuration for the LLM-based RAG query generator.
-//
-// This is an alias to an internal type.
-type QueryGeneratorConfigLlmParam = shared.QueryGeneratorConfigLlmParam
-
-// Result of a RAG query containing retrieved content and metadata.
-//
-// This is an alias to an internal type.
-type QueryResult = shared.QueryResult
-
-// This is an alias to an internal type.
-type QueryResultMetadataUnion = shared.QueryResultMetadataUnion
-
-// Configuration for JSON schema-guided response generation.
-//
-// This is an alias to an internal type.
-type ResponseFormatUnion = shared.ResponseFormatUnion
-
-// Configuration for JSON schema-guided response generation.
-//
-// This is an alias to an internal type.
-type ResponseFormatJsonSchema = shared.ResponseFormatJsonSchema
-
-// This is an alias to an internal type.
-type ResponseFormatJsonSchemaJsonSchemaUnion = shared.ResponseFormatJsonSchemaJsonSchemaUnion
-
-// Configuration for grammar-guided response generation.
-//
-// This is an alias to an internal type.
-type ResponseFormatGrammar = shared.ResponseFormatGrammar
-
-// This is an alias to an internal type.
-type ResponseFormatGrammarBnfUnion = shared.ResponseFormatGrammarBnfUnion
-
-// Configuration for JSON schema-guided response generation.
-//
-// This is an alias to an internal type.
-type ResponseFormatUnionParam = shared.ResponseFormatUnionParam
-
-// Configuration for JSON schema-guided response generation.
-//
-// This is an alias to an internal type.
-type ResponseFormatJsonSchemaParam = shared.ResponseFormatJsonSchemaParam
-
-// This is an alias to an internal type.
-type ResponseFormatJsonSchemaJsonSchemaUnionParam = shared.ResponseFormatJsonSchemaJsonSchemaUnionParam
-
-// Configuration for grammar-guided response generation.
-//
-// This is an alias to an internal type.
-type ResponseFormatGrammarParam = shared.ResponseFormatGrammarParam
-
-// This is an alias to an internal type.
-type ResponseFormatGrammarBnfUnionParam = shared.ResponseFormatGrammarBnfUnionParam
-
-// Details of a safety violation detected by content moderation.
-//
-// This is an alias to an internal type.
-type SafetyViolation = shared.SafetyViolation
-
-// This is an alias to an internal type.
-type SafetyViolationMetadataUnion = shared.SafetyViolationMetadataUnion
-
-// Severity level of the violation
-//
-// This is an alias to an internal type.
-type SafetyViolationViolationLevel = shared.SafetyViolationViolationLevel
-
-// Equals "info"
-const SafetyViolationViolationLevelInfo = shared.SafetyViolationViolationLevelInfo
-
-// Equals "warn"
-const SafetyViolationViolationLevelWarn = shared.SafetyViolationViolationLevelWarn
-
-// Equals "error"
-const SafetyViolationViolationLevelError = shared.SafetyViolationViolationLevelError
-
-// Sampling parameters.
-//
-// This is an alias to an internal type.
-type SamplingParamsResp = shared.SamplingParamsResp
-
-// The sampling strategy.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyUnionResp = shared.SamplingParamsStrategyUnionResp
-
-// Greedy sampling strategy that selects the highest probability token at each
-// step.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyGreedyResp = shared.SamplingParamsStrategyGreedyResp
-
-// Top-p (nucleus) sampling strategy that samples from the smallest set of tokens
-// with cumulative probability >= p.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyTopPResp = shared.SamplingParamsStrategyTopPResp
-
-// Top-k sampling strategy that restricts sampling to the k most likely tokens.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyTopKResp = shared.SamplingParamsStrategyTopKResp
-
-// Sampling parameters.
-//
-// This is an alias to an internal type.
-type SamplingParams = shared.SamplingParams
-
-// The sampling strategy.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyUnion = shared.SamplingParamsStrategyUnion
-
-// Greedy sampling strategy that selects the highest probability token at each
-// step.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyGreedy = shared.SamplingParamsStrategyGreedy
-
-// Top-p (nucleus) sampling strategy that samples from the smallest set of tokens
-// with cumulative probability >= p.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyTopP = shared.SamplingParamsStrategyTopP
-
-// Top-k sampling strategy that restricts sampling to the k most likely tokens.
-//
-// This is an alias to an internal type.
-type SamplingParamsStrategyTopK = shared.SamplingParamsStrategyTopK
-
-// A scoring result for a single row.
-//
-// This is an alias to an internal type.
-type ScoringResult = shared.ScoringResult
-
-// This is an alias to an internal type.
-type ScoringResultAggregatedResultUnion = shared.ScoringResultAggregatedResultUnion
-
-// This is an alias to an internal type.
-type ScoringResultScoreRowUnion = shared.ScoringResultScoreRowUnion
-
-// A system message providing instructions or context to the model.
-//
-// This is an alias to an internal type.
-type SystemMessageParam = shared.SystemMessageParam
-
-// This is an alias to an internal type.
-type ToolCall = shared.ToolCall
-
-// This is an alias to an internal type.
-type ToolCallArgumentsUnion = shared.ToolCallArgumentsUnion
-
-// This is an alias to an internal type.
-type ToolCallArgumentsMapItemUnion = shared.ToolCallArgumentsMapItemUnion
-
-// This is an alias to an internal type.
-type ToolCallArgumentsMapItemArrayItemUnion = shared.ToolCallArgumentsMapItemArrayItemUnion
-
-// This is an alias to an internal type.
-type ToolCallArgumentsMapItemMapItemUnion = shared.ToolCallArgumentsMapItemMapItemUnion
-
-// This is an alias to an internal type.
-type ToolCallToolName = shared.ToolCallToolName
-
-// Equals "brave_search"
-const ToolCallToolNameBraveSearch = shared.ToolCallToolNameBraveSearch
-
-// Equals "wolfram_alpha"
-const ToolCallToolNameWolframAlpha = shared.ToolCallToolNameWolframAlpha
-
-// Equals "photogen"
-const ToolCallToolNamePhotogen = shared.ToolCallToolNamePhotogen
-
-// Equals "code_interpreter"
-const ToolCallToolNameCodeInterpreter = shared.ToolCallToolNameCodeInterpreter
-
-// This is an alias to an internal type.
-type ToolCallParam = shared.ToolCallParam
-
-// This is an alias to an internal type.
-type ToolCallArgumentsUnionParam = shared.ToolCallArgumentsUnionParam
-
-// This is an alias to an internal type.
-type ToolCallArgumentsMapItemUnionParam = shared.ToolCallArgumentsMapItemUnionParam
-
-// This is an alias to an internal type.
-type ToolCallArgumentsMapItemArrayItemUnionParam = shared.ToolCallArgumentsMapItemArrayItemUnionParam
-
-// This is an alias to an internal type.
-type ToolCallArgumentsMapItemMapItemUnionParam = shared.ToolCallArgumentsMapItemMapItemUnionParam
-
-// This is an alias to an internal type.
-type ToolParamDefinition = shared.ToolParamDefinition
-
-// This is an alias to an internal type.
-type ToolParamDefinitionDefaultUnion = shared.ToolParamDefinitionDefaultUnion
-
-// A message representing the result of a tool invocation.
-//
-// This is an alias to an internal type.
-type ToolResponseMessage = shared.ToolResponseMessage
-
-// A message representing the result of a tool invocation.
-//
-// This is an alias to an internal type.
-type ToolResponseMessageParam = shared.ToolResponseMessageParam
-
-// A message from the user in a chat conversation.
-//
-// This is an alias to an internal type.
-type UserMessage = shared.UserMessage
-
-// A message from the user in a chat conversation.
-//
-// This is an alias to an internal type.
-type UserMessageParam = shared.UserMessageParam
diff --git a/api.md b/api.md
index 90e1b72..d42ee54 100644
--- a/api.md
+++ b/api.md
@@ -1,39 +1,39 @@
# Shared Params Types
-- shared.AgentConfigParam
-- shared.CompletionMessageParam
-- shared.DocumentParam
-- shared.InterleavedContentUnionParam
-- shared.InterleavedContentItemUnionParam
-- shared.MessageUnionParam
-- shared.QueryConfigParam
-- shared.QueryGeneratorConfigUnionParam
-- shared.ResponseFormatUnionParam
-- shared.SamplingParams
-- shared.SystemMessageParam
-- shared.ToolCallParam
-- shared.ToolParamDefinition
-- shared.ToolResponseMessageParam
-- shared.UserMessageParam
+- llamastackclient.AgentConfigParam
+- llamastackclient.CompletionMessageParam
+- llamastackclient.DocumentParam
+- llamastackclient.InterleavedContentUnionParam
+- llamastackclient.InterleavedContentItemUnionParam
+- llamastackclient.MessageUnionParam
+- llamastackclient.QueryConfigParam
+- llamastackclient.QueryGeneratorConfigUnionParam
+- llamastackclient.ResponseFormatUnionParam
+- llamastackclient.SamplingParams
+- llamastackclient.SystemMessageParam
+- llamastackclient.ToolCallParam
+- llamastackclient.ToolParamDefinition
+- llamastackclient.ToolResponseMessageParam
+- llamastackclient.UserMessageParam
# Shared Response Types
-- shared.AgentConfig
-- shared.BatchCompletion
-- shared.ChatCompletionResponse
-- shared.CompletionMessage
-- shared.ContentDeltaUnion
-- shared.InterleavedContentUnion
-- shared.InterleavedContentItemUnion
-- shared.Metric
-- shared.QueryResult
-- shared.ResponseFormatUnion
-- shared.SafetyViolation
-- shared.SamplingParamsResp
-- shared.ScoringResult
-- shared.ToolCall
-- shared.ToolResponseMessage
-- shared.UserMessage
+- llamastackclient.AgentConfig
+- llamastackclient.BatchCompletion
+- llamastackclient.ChatCompletionResponse
+- llamastackclient.CompletionMessage
+- llamastackclient.ContentDeltaUnion
+- llamastackclient.InterleavedContentUnion
+- llamastackclient.InterleavedContentItemUnion
+- llamastackclient.Metric
+- llamastackclient.QueryResult
+- llamastackclient.ResponseFormatUnion
+- llamastackclient.SafetyViolation
+- llamastackclient.SamplingParamsResp
+- llamastackclient.ScoringResult
+- llamastackclient.ToolCall
+- llamastackclient.ToolResponseMessage
+- llamastackclient.UserMessage
# Toolgroups
@@ -82,7 +82,7 @@ Methods:
Methods:
- client.ToolRuntime.RagTool.Insert(ctx context.Context, body llamastackclient.ToolRuntimeRagToolInsertParams) error
-- client.ToolRuntime.RagTool.Query(ctx context.Context, body llamastackclient.ToolRuntimeRagToolQueryParams) (shared.QueryResult, error)
+- client.ToolRuntime.RagTool.Query(ctx context.Context, body llamastackclient.ToolRuntimeRagToolQueryParams) (llamastackclient.QueryResult, error)
# Responses
@@ -244,8 +244,8 @@ Response Types:
Methods:
- client.Inference.BatchChatCompletion(ctx context.Context, body llamastackclient.InferenceBatchChatCompletionParams) (llamastackclient.InferenceBatchChatCompletionResponse, error)
-- client.Inference.BatchCompletion(ctx context.Context, body llamastackclient.InferenceBatchCompletionParams) (shared.BatchCompletion, error)
-- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (shared.ChatCompletionResponse, error)
+- client.Inference.BatchCompletion(ctx context.Context, body llamastackclient.InferenceBatchCompletionParams) (llamastackclient.BatchCompletion, error)
+- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (llamastackclient.ChatCompletionResponse, error)
- client.Inference.Completion(ctx context.Context, body llamastackclient.InferenceCompletionParams) (llamastackclient.CompletionResponse, error)
- client.Inference.Embeddings(ctx context.Context, body llamastackclient.InferenceEmbeddingsParams) (llamastackclient.EmbeddingsResponse, error)
diff --git a/client_test.go b/client_test.go
index f297c94..118fbe0 100644
--- a/client_test.go
+++ b/client_test.go
@@ -14,7 +14,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
type closureTransport struct {
@@ -40,9 +39,9 @@ func TestUserAgentHeader(t *testing.T) {
}),
)
client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -72,9 +71,9 @@ func TestRetryAfter(t *testing.T) {
}),
)
_, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -115,9 +114,9 @@ func TestDeleteRetryCountHeader(t *testing.T) {
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
_, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -153,9 +152,9 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
_, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -190,9 +189,9 @@ func TestRetryAfterMs(t *testing.T) {
}),
)
_, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -221,9 +220,9 @@ func TestContextCancel(t *testing.T) {
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
_, err := client.Inference.ChatCompletion(cancelCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -249,9 +248,9 @@ func TestContextCancelDelay(t *testing.T) {
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
_, err := client.Inference.ChatCompletion(cancelCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -283,9 +282,9 @@ func TestContextDeadline(t *testing.T) {
}),
)
_, err := client.Inference.ChatCompletion(deadlineCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -336,9 +335,9 @@ func TestContextDeadlineStreaming(t *testing.T) {
}),
)
stream := client.Inference.ChatCompletionStreaming(deadlineCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -391,9 +390,9 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
stream := client.Inference.ChatCompletionStreaming(
context.Background(),
llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
diff --git a/eval.go b/eval.go
index 779d51d..6961a0c 100644
--- a/eval.go
+++ b/eval.go
@@ -14,7 +14,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
@@ -110,14 +109,14 @@ func (r *BenchmarkConfigParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-func EvalCandidateParamOfModel(model string, samplingParams shared.SamplingParams) EvalCandidateUnionParam {
+func EvalCandidateParamOfModel(model string, samplingParams SamplingParams) EvalCandidateUnionParam {
var variant EvalCandidateModelParam
variant.Model = model
variant.SamplingParams = samplingParams
return EvalCandidateUnionParam{OfModel: &variant}
}
-func EvalCandidateParamOfAgent(config shared.AgentConfigParam) EvalCandidateUnionParam {
+func EvalCandidateParamOfAgent(config AgentConfigParam) EvalCandidateUnionParam {
var agent EvalCandidateAgentParam
agent.Config = config
return EvalCandidateUnionParam{OfAgent: &agent}
@@ -157,7 +156,7 @@ func (u EvalCandidateUnionParam) GetModel() *string {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetSamplingParams() *shared.SamplingParams {
+func (u EvalCandidateUnionParam) GetSamplingParams() *SamplingParams {
if vt := u.OfModel; vt != nil {
return &vt.SamplingParams
}
@@ -165,7 +164,7 @@ func (u EvalCandidateUnionParam) GetSamplingParams() *shared.SamplingParams {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetSystemMessage() *shared.SystemMessageParam {
+func (u EvalCandidateUnionParam) GetSystemMessage() *SystemMessageParam {
if vt := u.OfModel; vt != nil {
return &vt.SystemMessage
}
@@ -173,7 +172,7 @@ func (u EvalCandidateUnionParam) GetSystemMessage() *shared.SystemMessageParam {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetConfig() *shared.AgentConfigParam {
+func (u EvalCandidateUnionParam) GetConfig() *AgentConfigParam {
if vt := u.OfAgent; vt != nil {
return &vt.Config
}
@@ -205,9 +204,9 @@ type EvalCandidateModelParam struct {
// The model ID to evaluate.
Model string `json:"model,required"`
// The sampling parameters for the model.
- SamplingParams shared.SamplingParams `json:"sampling_params,omitzero,required"`
+ SamplingParams SamplingParams `json:"sampling_params,omitzero,required"`
// (Optional) The system message providing instructions or context to the model.
- SystemMessage shared.SystemMessageParam `json:"system_message,omitzero"`
+ SystemMessage SystemMessageParam `json:"system_message,omitzero"`
// This field can be elided, and will marshal its zero value as "model".
Type constant.Model `json:"type,required"`
paramObj
@@ -226,7 +225,7 @@ func (r *EvalCandidateModelParam) UnmarshalJSON(data []byte) error {
// The properties Config, Type are required.
type EvalCandidateAgentParam struct {
// The configuration for the agent candidate.
- Config shared.AgentConfigParam `json:"config,omitzero,required"`
+ Config AgentConfigParam `json:"config,omitzero,required"`
// This field can be elided, and will marshal its zero value as "agent".
Type constant.Agent `json:"type,required"`
paramObj
@@ -245,7 +244,7 @@ type EvaluateResponse struct {
// The generations from the evaluation.
Generations []map[string]EvaluateResponseGenerationUnion `json:"generations,required"`
// The scores from the evaluation.
- Scores map[string]shared.ScoringResult `json:"scores,required"`
+ Scores map[string]ScoringResult `json:"scores,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Generations respjson.Field
diff --git a/eval_test.go b/eval_test.go
index 7ae74bc..407c1d4 100644
--- a/eval_test.go
+++ b/eval_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
@@ -33,16 +32,16 @@ func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
EvalCandidate: llamastackclient.EvalCandidateUnionParam{
OfModel: &llamastackclient.EvalCandidateModelParam{
Model: "model",
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
Stop: []string{"string"},
},
- SystemMessage: shared.SystemMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ SystemMessage: llamastackclient.SystemMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -96,16 +95,16 @@ func TestEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
EvalCandidate: llamastackclient.EvalCandidateUnionParam{
OfModel: &llamastackclient.EvalCandidateModelParam{
Model: "model",
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
Stop: []string{"string"},
},
- SystemMessage: shared.SystemMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ SystemMessage: llamastackclient.SystemMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -159,16 +158,16 @@ func TestEvalRunEvalWithOptionalParams(t *testing.T) {
EvalCandidate: llamastackclient.EvalCandidateUnionParam{
OfModel: &llamastackclient.EvalCandidateModelParam{
Model: "model",
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
Stop: []string{"string"},
},
- SystemMessage: shared.SystemMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ SystemMessage: llamastackclient.SystemMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -216,16 +215,16 @@ func TestEvalRunEvalAlphaWithOptionalParams(t *testing.T) {
EvalCandidate: llamastackclient.EvalCandidateUnionParam{
OfModel: &llamastackclient.EvalCandidateModelParam{
Model: "model",
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
Stop: []string{"string"},
},
- SystemMessage: shared.SystemMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ SystemMessage: llamastackclient.SystemMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
diff --git a/inference.go b/inference.go
index 26d369e..24a5a87 100644
--- a/inference.go
+++ b/inference.go
@@ -12,7 +12,6 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
"github.com/llamastack/llama-stack-client-go/packages/ssestream"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// InferenceService contains methods and other services that help with interacting
@@ -43,7 +42,7 @@ func (r *InferenceService) BatchChatCompletion(ctx context.Context, body Inferen
}
// Generate completions for a batch of content using the specified model.
-func (r *InferenceService) BatchCompletion(ctx context.Context, body InferenceBatchCompletionParams, opts ...option.RequestOption) (res *shared.BatchCompletion, err error) {
+func (r *InferenceService) BatchCompletion(ctx context.Context, body InferenceBatchCompletionParams, opts ...option.RequestOption) (res *BatchCompletion, err error) {
opts = append(r.Options[:], opts...)
path := "v1/inference/batch-completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -54,7 +53,7 @@ func (r *InferenceService) BatchCompletion(ctx context.Context, body InferenceBa
//
// Deprecated: /v1/inference/chat-completion is deprecated. Please use
// /v1/openai/v1/chat/completions.
-func (r *InferenceService) ChatCompletion(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (res *shared.ChatCompletionResponse, err error) {
+func (r *InferenceService) ChatCompletion(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (res *ChatCompletionResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/inference/chat-completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -120,7 +119,7 @@ type ChatCompletionResponseStreamChunk struct {
// The event containing the new content
Event ChatCompletionResponseStreamChunkEvent `json:"event,required"`
// (Optional) List of metrics associated with the API response
- Metrics []shared.Metric `json:"metrics"`
+ Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Event respjson.Field
@@ -140,7 +139,7 @@ func (r *ChatCompletionResponseStreamChunk) UnmarshalJSON(data []byte) error {
type ChatCompletionResponseStreamChunkEvent struct {
// Content generated since last event. This can be one or more tokens, or a tool
// call.
- Delta shared.ContentDeltaUnion `json:"delta,required"`
+ Delta ContentDeltaUnion `json:"delta,required"`
// Type of the event
//
// Any of "start", "complete", "progress".
@@ -179,7 +178,7 @@ type CompletionResponse struct {
// Optional log probabilities for generated tokens
Logprobs []TokenLogProbs `json:"logprobs"`
// (Optional) List of metrics associated with the API response
- Metrics []shared.Metric `json:"metrics"`
+ Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -247,7 +246,7 @@ func (r *TokenLogProbs) UnmarshalJSON(data []byte) error {
// Response from a batch chat completion request.
type InferenceBatchChatCompletionResponse struct {
// List of chat completion responses, one for each conversation in the batch
- Batch []shared.ChatCompletionResponse `json:"batch,required"`
+ Batch []ChatCompletionResponse `json:"batch,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Batch respjson.Field
@@ -264,7 +263,7 @@ func (r *InferenceBatchChatCompletionResponse) UnmarshalJSON(data []byte) error
type InferenceBatchChatCompletionParams struct {
// The messages to generate completions for.
- MessagesBatch [][]shared.MessageUnionParam `json:"messages_batch,omitzero,required"`
+ MessagesBatch [][]MessageUnionParam `json:"messages_batch,omitzero,required"`
// The identifier of the model to use. The model must be registered with Llama
// Stack and available via the /models endpoint.
ModelID string `json:"model_id,required"`
@@ -272,9 +271,9 @@ type InferenceBatchChatCompletionParams struct {
// returned.
Logprobs InferenceBatchChatCompletionParamsLogprobs `json:"logprobs,omitzero"`
// (Optional) Grammar specification for guided (structured) decoding.
- ResponseFormat shared.ResponseFormatUnionParam `json:"response_format,omitzero"`
+ ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
// (Optional) Parameters to control the sampling strategy.
- SamplingParams shared.SamplingParams `json:"sampling_params,omitzero"`
+ SamplingParams SamplingParams `json:"sampling_params,omitzero"`
// (Optional) Configuration for tool use.
ToolConfig InferenceBatchChatCompletionParamsToolConfig `json:"tool_config,omitzero"`
// (Optional) List of tool definitions available to the model.
@@ -351,9 +350,9 @@ func init() {
// The property ToolName is required.
type InferenceBatchChatCompletionParamsTool struct {
- ToolName string `json:"tool_name,omitzero,required"`
- Description param.Opt[string] `json:"description,omitzero"`
- Parameters map[string]shared.ToolParamDefinition `json:"parameters,omitzero"`
+ ToolName string `json:"tool_name,omitzero,required"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ Parameters map[string]ToolParamDefinition `json:"parameters,omitzero"`
paramObj
}
@@ -367,7 +366,7 @@ func (r *InferenceBatchChatCompletionParamsTool) UnmarshalJSON(data []byte) erro
type InferenceBatchCompletionParams struct {
// The content to generate completions for.
- ContentBatch []shared.InterleavedContentUnionParam `json:"content_batch,omitzero,required"`
+ ContentBatch []InterleavedContentUnionParam `json:"content_batch,omitzero,required"`
// The identifier of the model to use. The model must be registered with Llama
// Stack and available via the /models endpoint.
ModelID string `json:"model_id,required"`
@@ -375,9 +374,9 @@ type InferenceBatchCompletionParams struct {
// returned.
Logprobs InferenceBatchCompletionParamsLogprobs `json:"logprobs,omitzero"`
// (Optional) Grammar specification for guided (structured) decoding.
- ResponseFormat shared.ResponseFormatUnionParam `json:"response_format,omitzero"`
+ ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
// (Optional) Parameters to control the sampling strategy.
- SamplingParams shared.SamplingParams `json:"sampling_params,omitzero"`
+ SamplingParams SamplingParams `json:"sampling_params,omitzero"`
paramObj
}
@@ -407,7 +406,7 @@ func (r *InferenceBatchCompletionParamsLogprobs) UnmarshalJSON(data []byte) erro
type InferenceChatCompletionParams struct {
// List of messages in the conversation.
- Messages []shared.MessageUnionParam `json:"messages,omitzero,required"`
+ Messages []MessageUnionParam `json:"messages,omitzero,required"`
// The identifier of the model to use. The model must be registered with Llama
// Stack and available via the /models endpoint.
ModelID string `json:"model_id,required"`
@@ -418,9 +417,9 @@ type InferenceChatCompletionParams struct {
// options: - `ResponseFormat.json_schema`: The grammar is a JSON schema. Most
// providers support this format. - `ResponseFormat.grammar`: The grammar is a BNF
// grammar. This format is more flexible, but not all providers support it.
- ResponseFormat shared.ResponseFormatUnionParam `json:"response_format,omitzero"`
+ ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
// Parameters to control the sampling strategy.
- SamplingParams shared.SamplingParams `json:"sampling_params,omitzero"`
+ SamplingParams SamplingParams `json:"sampling_params,omitzero"`
// (Optional) Whether tool use is required or automatic. Defaults to
// ToolChoice.auto. .. deprecated:: Use tool_config instead.
//
@@ -537,9 +536,9 @@ const (
// The property ToolName is required.
type InferenceChatCompletionParamsTool struct {
- ToolName string `json:"tool_name,omitzero,required"`
- Description param.Opt[string] `json:"description,omitzero"`
- Parameters map[string]shared.ToolParamDefinition `json:"parameters,omitzero"`
+ ToolName string `json:"tool_name,omitzero,required"`
+ Description param.Opt[string] `json:"description,omitzero"`
+ Parameters map[string]ToolParamDefinition `json:"parameters,omitzero"`
paramObj
}
@@ -553,7 +552,7 @@ func (r *InferenceChatCompletionParamsTool) UnmarshalJSON(data []byte) error {
type InferenceCompletionParams struct {
// The content to generate a completion for.
- Content shared.InterleavedContentUnionParam `json:"content,omitzero,required"`
+ Content InterleavedContentUnionParam `json:"content,omitzero,required"`
// The identifier of the model to use. The model must be registered with Llama
// Stack and available via the /models endpoint.
ModelID string `json:"model_id,required"`
@@ -561,9 +560,9 @@ type InferenceCompletionParams struct {
// returned.
Logprobs InferenceCompletionParamsLogprobs `json:"logprobs,omitzero"`
// (Optional) Grammar specification for guided (structured) decoding.
- ResponseFormat shared.ResponseFormatUnionParam `json:"response_format,omitzero"`
+ ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
// (Optional) Parameters to control the sampling strategy.
- SamplingParams shared.SamplingParams `json:"sampling_params,omitzero"`
+ SamplingParams SamplingParams `json:"sampling_params,omitzero"`
paramObj
}
@@ -627,8 +626,8 @@ func (r *InferenceEmbeddingsParams) UnmarshalJSON(data []byte) error {
//
// Use [param.IsOmitted] to confirm if a field is set.
type InferenceEmbeddingsParamsContentsUnion struct {
- OfStringArray []string `json:",omitzero,inline"`
- OfInterleavedContentItemArray []shared.InterleavedContentItemUnionParam `json:",omitzero,inline"`
+ OfStringArray []string `json:",omitzero,inline"`
+ OfInterleavedContentItemArray []InterleavedContentItemUnionParam `json:",omitzero,inline"`
paramUnion
}
diff --git a/inference_test.go b/inference_test.go
index efec760..74245b7 100644
--- a/inference_test.go
+++ b/inference_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestInferenceBatchChatCompletionWithOptionalParams(t *testing.T) {
@@ -26,12 +25,12 @@ func TestInferenceBatchChatCompletionWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Inference.BatchChatCompletion(context.TODO(), llamastackclient.InferenceBatchChatCompletionParams{
- MessagesBatch: [][]shared.MessageUnionParam{{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ MessagesBatch: [][]llamastackclient.MessageUnionParam{{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
- Context: shared.InterleavedContentUnionParam{
+ Context: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -40,18 +39,18 @@ func TestInferenceBatchChatCompletionWithOptionalParams(t *testing.T) {
Logprobs: llamastackclient.InferenceBatchChatCompletionParamsLogprobs{
TopK: llamastackclient.Int(0),
},
- ResponseFormat: shared.ResponseFormatUnionParam{
- OfJsonSchema: &shared.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]shared.ResponseFormatJsonSchemaJsonSchemaUnionParam{
+ ResponseFormat: llamastackclient.ResponseFormatUnionParam{
+ OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
+ JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
},
},
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
@@ -65,10 +64,10 @@ func TestInferenceBatchChatCompletionWithOptionalParams(t *testing.T) {
Tools: []llamastackclient.InferenceBatchChatCompletionParamsTool{{
ToolName: "brave_search",
Description: llamastackclient.String("description"),
- Parameters: map[string]shared.ToolParamDefinition{
+ Parameters: map[string]llamastackclient.ToolParamDefinition{
"foo": {
ParamType: "param_type",
- Default: shared.ToolParamDefinitionDefaultUnion{
+ Default: llamastackclient.ToolParamDefinitionDefaultUnion{
OfBool: llamastackclient.Bool(true),
},
Description: llamastackclient.String("description"),
@@ -98,25 +97,25 @@ func TestInferenceBatchCompletionWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Inference.BatchCompletion(context.TODO(), llamastackclient.InferenceBatchCompletionParams{
- ContentBatch: []shared.InterleavedContentUnionParam{{
+ ContentBatch: []llamastackclient.InterleavedContentUnionParam{{
OfString: llamastackclient.String("string"),
}},
ModelID: "model_id",
Logprobs: llamastackclient.InferenceBatchCompletionParamsLogprobs{
TopK: llamastackclient.Int(0),
},
- ResponseFormat: shared.ResponseFormatUnionParam{
- OfJsonSchema: &shared.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]shared.ResponseFormatJsonSchemaJsonSchemaUnionParam{
+ ResponseFormat: llamastackclient.ResponseFormatUnionParam{
+ OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
+ JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
},
},
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
@@ -144,12 +143,12 @@ func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Inference.ChatCompletion(context.TODO(), llamastackclient.InferenceChatCompletionParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
- Context: shared.InterleavedContentUnionParam{
+ Context: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
@@ -158,18 +157,18 @@ func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
Logprobs: llamastackclient.InferenceChatCompletionParamsLogprobs{
TopK: llamastackclient.Int(0),
},
- ResponseFormat: shared.ResponseFormatUnionParam{
- OfJsonSchema: &shared.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]shared.ResponseFormatJsonSchemaJsonSchemaUnionParam{
+ ResponseFormat: llamastackclient.ResponseFormatUnionParam{
+ OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
+ JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
},
},
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
@@ -185,10 +184,10 @@ func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
Tools: []llamastackclient.InferenceChatCompletionParamsTool{{
ToolName: "brave_search",
Description: llamastackclient.String("description"),
- Parameters: map[string]shared.ToolParamDefinition{
+ Parameters: map[string]llamastackclient.ToolParamDefinition{
"foo": {
ParamType: "param_type",
- Default: shared.ToolParamDefinitionDefaultUnion{
+ Default: llamastackclient.ToolParamDefinitionDefaultUnion{
OfBool: llamastackclient.Bool(true),
},
Description: llamastackclient.String("description"),
@@ -218,25 +217,25 @@ func TestInferenceCompletionWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Inference.Completion(context.TODO(), llamastackclient.InferenceCompletionParams{
- Content: shared.InterleavedContentUnionParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
ModelID: "model_id",
Logprobs: llamastackclient.InferenceCompletionParamsLogprobs{
TopK: llamastackclient.Int(0),
},
- ResponseFormat: shared.ResponseFormatUnionParam{
- OfJsonSchema: &shared.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]shared.ResponseFormatJsonSchemaJsonSchemaUnionParam{
+ ResponseFormat: llamastackclient.ResponseFormatUnionParam{
+ OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
+ JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
},
},
- SamplingParams: shared.SamplingParams{
- Strategy: shared.SamplingParamsStrategyUnion{
- OfGreedy: &shared.SamplingParamsStrategyGreedy{},
+ SamplingParams: llamastackclient.SamplingParams{
+ Strategy: llamastackclient.SamplingParamsStrategyUnion{
+ OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
},
MaxTokens: llamastackclient.Int(0),
RepetitionPenalty: llamastackclient.Float(0),
diff --git a/packages/pagination/pagination.go b/packages/pagination/pagination.go
index 7574120..9056b77 100644
--- a/packages/pagination/pagination.go
+++ b/packages/pagination/pagination.go
@@ -4,6 +4,7 @@ package pagination
import (
"net/http"
+ "strconv"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -45,15 +46,19 @@ func (r *DatasetsIterrows[T]) GetNextPage() (res *DatasetsIterrows[T], err error
if len(r.Data) == 0 {
return nil, nil
}
+ cfg := r.cfg.Clone(r.cfg.Context)
+
next := r.NextIndex
- if len(next) == 0 {
+ length := int64(len(r.Data))
+
+ if length > 0 && next != 0 {
+ err = cfg.Apply(option.WithQuery("start_index", strconv.FormatInt(next, 10)))
+ if err != nil {
+ return nil, err
+ }
+ } else {
return nil, nil
}
- cfg := r.cfg.Clone(r.cfg.Context)
- err = cfg.Apply(option.WithQuery("start_index", next))
- if err != nil {
- return nil, err
- }
var raw *http.Response
cfg.ResponseInto = &raw
cfg.ResponseBodyInto = &res
diff --git a/safety.go b/safety.go
index 1c01cfe..c07f077 100644
--- a/safety.go
+++ b/safety.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// SafetyService contains methods and other services that help with interacting
@@ -44,7 +43,7 @@ func (r *SafetyService) RunShield(ctx context.Context, body SafetyRunShieldParam
// Response from running a safety shield.
type RunShieldResponse struct {
// (Optional) Safety violation detected by the shield, if any
- Violation shared.SafetyViolation `json:"violation"`
+ Violation SafetyViolation `json:"violation"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Violation respjson.Field
@@ -61,7 +60,7 @@ func (r *RunShieldResponse) UnmarshalJSON(data []byte) error {
type SafetyRunShieldParams struct {
// The messages to run the shield on.
- Messages []shared.MessageUnionParam `json:"messages,omitzero,required"`
+ Messages []MessageUnionParam `json:"messages,omitzero,required"`
// The parameters of the shield.
Params map[string]SafetyRunShieldParamsParamUnion `json:"params,omitzero,required"`
// The identifier of the shield to run.
diff --git a/safety_test.go b/safety_test.go
index 012daef..d7e98d4 100644
--- a/safety_test.go
+++ b/safety_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestSafetyRunShield(t *testing.T) {
@@ -26,12 +25,12 @@ func TestSafetyRunShield(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Safety.RunShield(context.TODO(), llamastackclient.SafetyRunShieldParams{
- Messages: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Messages: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
- Context: shared.InterleavedContentUnionParam{
+ Context: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
diff --git a/scoring.go b/scoring.go
index 19b5c06..56cf107 100644
--- a/scoring.go
+++ b/scoring.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// ScoringService contains methods and other services that help with interacting
@@ -52,7 +51,7 @@ func (r *ScoringService) ScoreBatch(ctx context.Context, body ScoringScoreBatchP
// The response from scoring.
type ScoringScoreResponse struct {
// A map of scoring function name to ScoringResult.
- Results map[string]shared.ScoringResult `json:"results,required"`
+ Results map[string]ScoringResult `json:"results,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Results respjson.Field
@@ -70,7 +69,7 @@ func (r *ScoringScoreResponse) UnmarshalJSON(data []byte) error {
// Response from batch scoring operations on datasets.
type ScoringScoreBatchResponse struct {
// A map of scoring function name to ScoringResult
- Results map[string]shared.ScoringResult `json:"results,required"`
+ Results map[string]ScoringResult `json:"results,required"`
// (Optional) The identifier of the dataset that was scored
DatasetID string `json:"dataset_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
diff --git a/shared/shared.go b/shared.go
similarity index 99%
rename from shared/shared.go
rename to shared.go
index eb9c8c2..f588447 100644
--- a/shared/shared.go
+++ b/shared.go
@@ -1,11 +1,10 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-package shared
+package llamastackclient
import (
"encoding/json"
- "github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
@@ -23,8 +22,8 @@ type AgentConfig struct {
// The system instructions for the agent
Instructions string `json:"instructions,required"`
// The model identifier to use for the agent
- Model string `json:"model,required"`
- ClientTools []llamastackclient.ToolDef `json:"client_tools"`
+ Model string `json:"model,required"`
+ ClientTools []ToolDef `json:"client_tools"`
// Optional flag indicating whether session data has to be persisted
EnableSessionPersistence bool `json:"enable_session_persistence"`
InputShields []string `json:"input_shields"`
@@ -269,10 +268,10 @@ type AgentConfigParam struct {
EnableSessionPersistence param.Opt[bool] `json:"enable_session_persistence,omitzero"`
MaxInferIters param.Opt[int64] `json:"max_infer_iters,omitzero"`
// Optional name for the agent, used in telemetry and identification
- Name param.Opt[string] `json:"name,omitzero"`
- ClientTools []llamastackclient.ToolDefParam `json:"client_tools,omitzero"`
- InputShields []string `json:"input_shields,omitzero"`
- OutputShields []string `json:"output_shields,omitzero"`
+ Name param.Opt[string] `json:"name,omitzero"`
+ ClientTools []ToolDefParam `json:"client_tools,omitzero"`
+ InputShields []string `json:"input_shields,omitzero"`
+ OutputShields []string `json:"output_shields,omitzero"`
// Optional response format configuration
ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
// Sampling parameters.
@@ -422,7 +421,7 @@ func (u *AgentConfigToolgroupAgentToolGroupWithArgsArgUnionParam) asAny() any {
// Response from a batch completion request.
type BatchCompletion struct {
// List of completion responses, one for each input in the batch
- Batch []llamastackclient.CompletionResponse `json:"batch,required"`
+ Batch []CompletionResponse `json:"batch,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Batch respjson.Field
@@ -442,7 +441,7 @@ type ChatCompletionResponse struct {
// The complete response message
CompletionMessage CompletionMessage `json:"completion_message,required"`
// Optional log probabilities for generated tokens
- Logprobs []llamastackclient.TokenLogProbs `json:"logprobs"`
+ Logprobs []TokenLogProbs `json:"logprobs"`
// (Optional) List of metrics associated with the API response
Metrics []Metric `json:"metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -586,9 +585,9 @@ type anyContentDelta interface {
// Use the following switch statement to find the correct variant
//
// switch variant := ContentDeltaUnion.AsAny().(type) {
-// case shared.ContentDeltaText:
-// case shared.ContentDeltaImage:
-// case shared.ContentDeltaToolCall:
+// case llamastackclient.ContentDeltaText:
+// case llamastackclient.ContentDeltaImage:
+// case llamastackclient.ContentDeltaToolCall:
// default:
// fmt.Errorf("no variant present")
// }
@@ -1292,8 +1291,8 @@ type anyInterleavedContentItem interface {
// Use the following switch statement to find the correct variant
//
// switch variant := InterleavedContentItemUnion.AsAny().(type) {
-// case shared.InterleavedContentItemImage:
-// case shared.InterleavedContentItemText:
+// case llamastackclient.InterleavedContentItemImage:
+// case llamastackclient.InterleavedContentItemText:
// default:
// fmt.Errorf("no variant present")
// }
@@ -2139,8 +2138,8 @@ type anyResponseFormat interface {
// Use the following switch statement to find the correct variant
//
// switch variant := ResponseFormatUnion.AsAny().(type) {
-// case shared.ResponseFormatJsonSchema:
-// case shared.ResponseFormatGrammar:
+// case llamastackclient.ResponseFormatJsonSchema:
+// case llamastackclient.ResponseFormatGrammar:
// default:
// fmt.Errorf("no variant present")
// }
@@ -2670,9 +2669,9 @@ type anySamplingParamsStrategyResp interface {
// Use the following switch statement to find the correct variant
//
// switch variant := SamplingParamsStrategyUnionResp.AsAny().(type) {
-// case shared.SamplingParamsStrategyGreedyResp:
-// case shared.SamplingParamsStrategyTopPResp:
-// case shared.SamplingParamsStrategyTopKResp:
+// case llamastackclient.SamplingParamsStrategyGreedyResp:
+// case llamastackclient.SamplingParamsStrategyTopPResp:
+// case llamastackclient.SamplingParamsStrategyTopKResp:
// default:
// fmt.Errorf("no variant present")
// }
diff --git a/syntheticdatageneration.go b/syntheticdatageneration.go
index 91f49ad..3472f75 100644
--- a/syntheticdatageneration.go
+++ b/syntheticdatageneration.go
@@ -12,7 +12,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// SyntheticDataGenerationService contains methods and other services that help
@@ -171,7 +170,7 @@ func (r *SyntheticDataGenerationResponseStatisticUnion) UnmarshalJSON(data []byt
type SyntheticDataGenerationGenerateParams struct {
// List of conversation messages to use as input for synthetic data generation
- Dialogs []shared.MessageUnionParam `json:"dialogs,omitzero,required"`
+ Dialogs []MessageUnionParam `json:"dialogs,omitzero,required"`
// Type of filtering to apply to generated synthetic data samples
//
// Any of "none", "random", "top_k", "top_p", "top_k_top_p", "sigmoid".
diff --git a/syntheticdatageneration_test.go b/syntheticdatageneration_test.go
index 02c3a1b..eb4f5a1 100644
--- a/syntheticdatageneration_test.go
+++ b/syntheticdatageneration_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestSyntheticDataGenerationGenerateWithOptionalParams(t *testing.T) {
@@ -26,12 +25,12 @@ func TestSyntheticDataGenerationGenerateWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.SyntheticDataGeneration.Generate(context.TODO(), llamastackclient.SyntheticDataGenerationGenerateParams{
- Dialogs: []shared.MessageUnionParam{{
- OfUser: &shared.UserMessageParam{
- Content: shared.InterleavedContentUnionParam{
+ Dialogs: []llamastackclient.MessageUnionParam{{
+ OfUser: &llamastackclient.UserMessageParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
- Context: shared.InterleavedContentUnionParam{
+ Context: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
},
diff --git a/toolruntime.go b/toolruntime.go
index 156d800..a0a791e 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -14,7 +14,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// ToolRuntimeService contains methods and other services that help with
@@ -342,7 +341,7 @@ func (u *ToolDefParameterDefaultUnionParam) asAny() any {
// Result of a tool invocation.
type ToolInvocationResult struct {
// (Optional) The output content from the tool execution
- Content shared.InterleavedContentUnion `json:"content"`
+ Content InterleavedContentUnion `json:"content"`
// (Optional) Numeric error code if the tool execution failed
ErrorCode int64 `json:"error_code"`
// (Optional) Error message if the tool execution failed
diff --git a/toolruntimeragtool.go b/toolruntimeragtool.go
index 603e9cb..e0e34e7 100644
--- a/toolruntimeragtool.go
+++ b/toolruntimeragtool.go
@@ -10,7 +10,6 @@ import (
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// ToolRuntimeRagToolService contains methods and other services that help with
@@ -42,7 +41,7 @@ func (r *ToolRuntimeRagToolService) Insert(ctx context.Context, body ToolRuntime
}
// Query the RAG system for context; typically invoked by the agent.
-func (r *ToolRuntimeRagToolService) Query(ctx context.Context, body ToolRuntimeRagToolQueryParams, opts ...option.RequestOption) (res *shared.QueryResult, err error) {
+func (r *ToolRuntimeRagToolService) Query(ctx context.Context, body ToolRuntimeRagToolQueryParams, opts ...option.RequestOption) (res *QueryResult, err error) {
opts = append(r.Options[:], opts...)
path := "v1/tool-runtime/rag-tool/query"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -53,7 +52,7 @@ type ToolRuntimeRagToolInsertParams struct {
// (Optional) Size in tokens for document chunking during indexing
ChunkSizeInTokens int64 `json:"chunk_size_in_tokens,required"`
// List of documents to index in the RAG system
- Documents []shared.DocumentParam `json:"documents,omitzero,required"`
+ Documents []DocumentParam `json:"documents,omitzero,required"`
// ID of the vector database to store the document embeddings
VectorDBID string `json:"vector_db_id,required"`
paramObj
@@ -69,11 +68,11 @@ func (r *ToolRuntimeRagToolInsertParams) UnmarshalJSON(data []byte) error {
type ToolRuntimeRagToolQueryParams struct {
// The query content to search for in the indexed documents
- Content shared.InterleavedContentUnionParam `json:"content,omitzero,required"`
+ Content InterleavedContentUnionParam `json:"content,omitzero,required"`
// List of vector database IDs to search within
VectorDBIDs []string `json:"vector_db_ids,omitzero,required"`
// (Optional) Configuration parameters for the query operation
- QueryConfig shared.QueryConfigParam `json:"query_config,omitzero"`
+ QueryConfig QueryConfigParam `json:"query_config,omitzero"`
paramObj
}
diff --git a/toolruntimeragtool_test.go b/toolruntimeragtool_test.go
index a2dcfb6..a0a2c54 100644
--- a/toolruntimeragtool_test.go
+++ b/toolruntimeragtool_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestToolRuntimeRagToolInsert(t *testing.T) {
@@ -27,12 +26,12 @@ func TestToolRuntimeRagToolInsert(t *testing.T) {
)
err := client.ToolRuntime.RagTool.Insert(context.TODO(), llamastackclient.ToolRuntimeRagToolInsertParams{
ChunkSizeInTokens: 0,
- Documents: []shared.DocumentParam{{
- Content: shared.DocumentContentUnionParam{
+ Documents: []llamastackclient.DocumentParam{{
+ Content: llamastackclient.DocumentContentUnionParam{
OfString: llamastackclient.String("string"),
},
DocumentID: "document_id",
- Metadata: map[string]shared.DocumentMetadataUnionParam{
+ Metadata: map[string]llamastackclient.DocumentMetadataUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
@@ -62,22 +61,22 @@ func TestToolRuntimeRagToolQueryWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.ToolRuntime.RagTool.Query(context.TODO(), llamastackclient.ToolRuntimeRagToolQueryParams{
- Content: shared.InterleavedContentUnionParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
VectorDBIDs: []string{"string"},
- QueryConfig: shared.QueryConfigParam{
+ QueryConfig: llamastackclient.QueryConfigParam{
ChunkTemplate: "chunk_template",
MaxChunks: 0,
MaxTokensInContext: 0,
- QueryGeneratorConfig: shared.QueryGeneratorConfigUnionParam{
- OfDefault: &shared.QueryGeneratorConfigDefaultParam{
+ QueryGeneratorConfig: llamastackclient.QueryGeneratorConfigUnionParam{
+ OfDefault: &llamastackclient.QueryGeneratorConfigDefaultParam{
Separator: "separator",
},
},
- Mode: shared.QueryConfigModeVector,
- Ranker: shared.QueryConfigRankerUnionParam{
- OfRrf: &shared.QueryConfigRankerRrfParam{
+ Mode: llamastackclient.QueryConfigModeVector,
+ Ranker: llamastackclient.QueryConfigRankerUnionParam{
+ OfRrf: &llamastackclient.QueryConfigRankerRrfParam{
ImpactFactor: 0,
},
},
diff --git a/vectorio.go b/vectorio.go
index b830aed..62f087d 100644
--- a/vectorio.go
+++ b/vectorio.go
@@ -12,7 +12,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared"
)
// VectorIoService contains methods and other services that help with interacting
@@ -75,7 +74,7 @@ func (r *QueryChunksResponse) UnmarshalJSON(data []byte) error {
// A chunk of content that can be inserted into a vector database.
type QueryChunksResponseChunk struct {
// The content of the chunk, which can be interleaved text, images, or other types.
- Content shared.InterleavedContentUnion `json:"content,required"`
+ Content InterleavedContentUnion `json:"content,required"`
// Metadata associated with the chunk that will be used in the model context during
// inference.
Metadata map[string]QueryChunksResponseChunkMetadataUnion `json:"metadata,required"`
@@ -234,7 +233,7 @@ func (r *VectorIoInsertParams) UnmarshalJSON(data []byte) error {
// The properties Content, Metadata are required.
type VectorIoInsertParamsChunk struct {
// The content of the chunk, which can be interleaved text, images, or other types.
- Content shared.InterleavedContentUnionParam `json:"content,omitzero,required"`
+ Content InterleavedContentUnionParam `json:"content,omitzero,required"`
// Metadata associated with the chunk that will be used in the model context during
// inference.
Metadata map[string]VectorIoInsertParamsChunkMetadataUnion `json:"metadata,omitzero,required"`
@@ -327,7 +326,7 @@ func (r *VectorIoInsertParamsChunkChunkMetadata) UnmarshalJSON(data []byte) erro
type VectorIoQueryParams struct {
// The query to search for.
- Query shared.InterleavedContentUnionParam `json:"query,omitzero,required"`
+ Query InterleavedContentUnionParam `json:"query,omitzero,required"`
// The identifier of the vector database to query.
VectorDBID string `json:"vector_db_id,required"`
// The parameters of the query.
diff --git a/vectorio_test.go b/vectorio_test.go
index 73d696e..0abce84 100644
--- a/vectorio_test.go
+++ b/vectorio_test.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/shared"
)
func TestVectorIoInsertWithOptionalParams(t *testing.T) {
@@ -27,7 +26,7 @@ func TestVectorIoInsertWithOptionalParams(t *testing.T) {
)
err := client.VectorIo.Insert(context.TODO(), llamastackclient.VectorIoInsertParams{
Chunks: []llamastackclient.VectorIoInsertParamsChunk{{
- Content: shared.InterleavedContentUnionParam{
+ Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
Metadata: map[string]llamastackclient.VectorIoInsertParamsChunkMetadataUnion{
@@ -75,7 +74,7 @@ func TestVectorIoQueryWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.VectorIo.Query(context.TODO(), llamastackclient.VectorIoQueryParams{
- Query: shared.InterleavedContentUnionParam{
+ Query: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
},
VectorDBID: "vector_db_id",
From d76c69c30d1402e13178448691d8202e6f2b5d82 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 6 Sep 2025 03:38:53 +0000
Subject: [PATCH 09/33] fix(internal): unmarshal correctly when there are
multiple discriminators
---
internal/apijson/decodeparam_test.go | 88 ++++++++++++++++++++++++++++
internal/apijson/union.go | 48 ++++++++-------
2 files changed, 115 insertions(+), 21 deletions(-)
diff --git a/internal/apijson/decodeparam_test.go b/internal/apijson/decodeparam_test.go
index b3762d1..f10eaba 100644
--- a/internal/apijson/decodeparam_test.go
+++ b/internal/apijson/decodeparam_test.go
@@ -351,6 +351,36 @@ func init() {
})
}
+type FooVariant struct {
+ Type string `json:"type,required"`
+ Value string `json:"value,required"`
+}
+
+type BarVariant struct {
+ Type string `json:"type,required"`
+ Enable bool `json:"enable,required"`
+}
+
+type MultiDiscriminatorUnion struct {
+ OfFoo *FooVariant `json:",inline"`
+ OfBar *BarVariant `json:",inline"`
+
+ paramUnion
+}
+
+func init() {
+ apijson.RegisterDiscriminatedUnion[MultiDiscriminatorUnion]("type", map[string]reflect.Type{
+ "foo": reflect.TypeOf(FooVariant{}),
+ "foo_v2": reflect.TypeOf(FooVariant{}),
+ "bar": reflect.TypeOf(BarVariant{}),
+ "bar_legacy": reflect.TypeOf(BarVariant{}),
+ })
+}
+
+func (m *MultiDiscriminatorUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, m)
+}
+
func (d *DiscriminatedUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, d)
}
@@ -408,3 +438,61 @@ func TestDiscriminatedUnion(t *testing.T) {
})
}
}
+
+func TestMultiDiscriminatorUnion(t *testing.T) {
+ tests := map[string]struct {
+ raw string
+ target MultiDiscriminatorUnion
+ shouldFail bool
+ }{
+ "foo_variant": {
+ raw: `{"type":"foo","value":"test"}`,
+ target: MultiDiscriminatorUnion{OfFoo: &FooVariant{
+ Type: "foo",
+ Value: "test",
+ }},
+ },
+ "foo_v2_variant": {
+ raw: `{"type":"foo_v2","value":"test_v2"}`,
+ target: MultiDiscriminatorUnion{OfFoo: &FooVariant{
+ Type: "foo_v2",
+ Value: "test_v2",
+ }},
+ },
+ "bar_variant": {
+ raw: `{"type":"bar","enable":true}`,
+ target: MultiDiscriminatorUnion{OfBar: &BarVariant{
+ Type: "bar",
+ Enable: true,
+ }},
+ },
+ "bar_legacy_variant": {
+ raw: `{"type":"bar_legacy","enable":false}`,
+ target: MultiDiscriminatorUnion{OfBar: &BarVariant{
+ Type: "bar_legacy",
+ Enable: false,
+ }},
+ },
+ "invalid_type": {
+ raw: `{"type":"unknown","value":"test"}`,
+ target: MultiDiscriminatorUnion{},
+ shouldFail: true,
+ },
+ }
+
+ for name, test := range tests {
+ t.Run(name, func(t *testing.T) {
+ var dst MultiDiscriminatorUnion
+ err := json.Unmarshal([]byte(test.raw), &dst)
+ if err != nil && !test.shouldFail {
+ t.Fatalf("failed unmarshal with err: %v", err)
+ }
+ if err == nil && test.shouldFail {
+ t.Fatalf("expected unmarshal to fail but it succeeded")
+ }
+ if !reflect.DeepEqual(dst, test.target) {
+ t.Fatalf("failed equality, got %#v but expected %#v", dst, test.target)
+ }
+ })
+ }
+}
diff --git a/internal/apijson/union.go b/internal/apijson/union.go
index d02daf0..df51692 100644
--- a/internal/apijson/union.go
+++ b/internal/apijson/union.go
@@ -39,12 +39,10 @@ func RegisterDiscriminatedUnion[T any](key string, mappings map[string]reflect.T
func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
type variantDecoder struct {
- decoder decoderFunc
- field reflect.StructField
- discriminatorValue any
+ decoder decoderFunc
+ field reflect.StructField
}
-
- variants := []variantDecoder{}
+ decoders := []variantDecoder{}
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
@@ -53,18 +51,26 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
}
decoder := d.typeDecoder(field.Type)
- variants = append(variants, variantDecoder{
+ decoders = append(decoders, variantDecoder{
decoder: decoder,
field: field,
})
}
+ type discriminatedDecoder struct {
+ variantDecoder
+ discriminator any
+ }
+ discriminatedDecoders := []discriminatedDecoder{}
unionEntry, discriminated := unionRegistry[t]
- for _, unionVariant := range unionEntry.variants {
- for i := 0; i < len(variants); i++ {
- variant := &variants[i]
- if variant.field.Type.Elem() == unionVariant.Type {
- variant.discriminatorValue = unionVariant.DiscriminatorValue
+ for _, variant := range unionEntry.variants {
+ // For each union variant, find a matching decoder and save it
+ for _, decoder := range decoders {
+ if decoder.field.Type.Elem() == variant.Type {
+ discriminatedDecoders = append(discriminatedDecoders, discriminatedDecoder{
+ decoder,
+ variant.DiscriminatorValue,
+ })
break
}
}
@@ -73,10 +79,10 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
return func(n gjson.Result, v reflect.Value, state *decoderState) error {
if discriminated && n.Type == gjson.JSON && len(unionEntry.discriminatorKey) != 0 {
discriminator := n.Get(unionEntry.discriminatorKey).Value()
- for _, variant := range variants {
- if discriminator == variant.discriminatorValue {
- inner := v.FieldByIndex(variant.field.Index)
- return variant.decoder(n, inner, state)
+ for _, decoder := range discriminatedDecoders {
+ if discriminator == decoder.discriminator {
+ inner := v.FieldByIndex(decoder.field.Index)
+ return decoder.decoder(n, inner, state)
}
}
return errors.New("apijson: was not able to find discriminated union variant")
@@ -85,15 +91,15 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
// Set bestExactness to worse than loose
bestExactness := loose - 1
bestVariant := -1
- for i, variant := range variants {
+ for i, decoder := range decoders {
// Pointers are used to discern JSON object variants from value variants
- if n.Type != gjson.JSON && variant.field.Type.Kind() == reflect.Ptr {
+ if n.Type != gjson.JSON && decoder.field.Type.Kind() == reflect.Ptr {
continue
}
sub := decoderState{strict: state.strict, exactness: exact}
- inner := v.FieldByIndex(variant.field.Index)
- err := variant.decoder(n, inner, &sub)
+ inner := v.FieldByIndex(decoder.field.Index)
+ err := decoder.decoder(n, inner, &sub)
if err != nil {
continue
}
@@ -116,11 +122,11 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
return errors.New("apijson: was not able to coerce type as union strictly")
}
- for i := 0; i < len(variants); i++ {
+ for i := 0; i < len(decoders); i++ {
if i == bestVariant {
continue
}
- v.FieldByIndex(variants[i].field.Index).SetZero()
+ v.FieldByIndex(decoders[i].field.Index).SetZero()
}
return nil
From 7b5d227df87389479dc2f6954ba59147b5d1a0fc Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 20 Sep 2025 02:47:15 +0000
Subject: [PATCH 10/33] chore: bump minimum go version to 1.22
---
go.mod | 2 +-
internal/encoding/json/shims/shims.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/go.mod b/go.mod
index 40c90a9..fd4d013 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/llamastack/llama-stack-client-go
-go 1.21
+go 1.22
require (
github.com/tidwall/gjson v1.14.4
diff --git a/internal/encoding/json/shims/shims.go b/internal/encoding/json/shims/shims.go
index b65a016..fe9a71a 100644
--- a/internal/encoding/json/shims/shims.go
+++ b/internal/encoding/json/shims/shims.go
@@ -1,5 +1,5 @@
// This package provides shims over Go 1.2{2,3} APIs
-// which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
+// which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
//
// Inside the vendored package, all shim code has comments that begin look like
// // SHIM(...): ...
From 67c0b0067523c93560b6d6467b81e3e8c2ecb61e Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 20 Sep 2025 02:48:40 +0000
Subject: [PATCH 11/33] chore: update more docs for 1.22
---
CONTRIBUTING.md | 2 +-
README.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ab38e86..aa34efe 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,7 @@ $ ./scripts/lint
This will install all the required dependencies and build the SDK.
-You can also [install go 1.18+ manually](https://go.dev/doc/install).
+You can also [install go 1.22+ manually](https://go.dev/doc/install).
## Modifying/Adding code
diff --git a/README.md b/README.md
index a1d8ae6..5d93ac3 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ go get -u 'github.com/llamastack/llama-stack-client-go@v0.1.0-alpha.1'
## Requirements
-This library requires Go 1.18+.
+This library requires Go 1.22+.
## Usage
From 15dfa47636cc1cd0ccb6b089ae363a7e70a5f56c Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 20 Sep 2025 02:49:17 +0000
Subject: [PATCH 12/33] fix: use slices.Concat instead of sometimes modifying
r.Options
---
agent.go | 9 +++++----
agentsession.go | 9 +++++----
agentstep.go | 3 ++-
agentturn.go | 11 ++++++-----
benchmark.go | 7 ++++---
chatcompletion.go | 9 +++++----
client.go | 3 ++-
completion.go | 5 +++--
dataset.go | 13 +++++++------
embedding.go | 3 ++-
eval.go | 9 +++++----
evaljob.go | 7 ++++---
file.go | 11 ++++++-----
inference.go | 15 ++++++++-------
inspect.go | 5 +++--
model.go | 9 +++++----
moderation.go | 3 ++-
posttraining.go | 5 +++--
posttrainingjob.go | 9 +++++----
provider.go | 5 +++--
response.go | 9 +++++----
responseinputitem.go | 3 ++-
route.go | 3 ++-
safety.go | 3 ++-
scoring.go | 5 +++--
scoringfunction.go | 7 ++++---
shield.go | 7 ++++---
syntheticdatageneration.go | 3 ++-
telemetry.go | 17 +++++++++--------
tool.go | 5 +++--
toolgroup.go | 9 +++++----
toolruntime.go | 5 +++--
toolruntimeragtool.go | 5 +++--
vectordb.go | 9 +++++----
vectorio.go | 5 +++--
vectorstore.go | 13 +++++++------
vectorstorefile.go | 13 +++++++------
37 files changed, 154 insertions(+), 117 deletions(-)
diff --git a/agent.go b/agent.go
index 4137935..73e4e27 100644
--- a/agent.go
+++ b/agent.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"time"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -47,7 +48,7 @@ func NewAgentService(opts ...option.RequestOption) (r AgentService) {
// Create an agent with the given configuration.
func (r *AgentService) New(ctx context.Context, body AgentNewParams, opts ...option.RequestOption) (res *AgentNewResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/agents"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -55,7 +56,7 @@ func (r *AgentService) New(ctx context.Context, body AgentNewParams, opts ...opt
// Describe an agent by its ID.
func (r *AgentService) Get(ctx context.Context, agentID string, opts ...option.RequestOption) (res *AgentGetResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -67,7 +68,7 @@ func (r *AgentService) Get(ctx context.Context, agentID string, opts ...option.R
// List all agents.
func (r *AgentService) List(ctx context.Context, query AgentListParams, opts ...option.RequestOption) (res *AgentListResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/agents"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
@@ -75,7 +76,7 @@ func (r *AgentService) List(ctx context.Context, query AgentListParams, opts ...
// Delete an agent by its ID and its associated sessions and turns.
func (r *AgentService) Delete(ctx context.Context, agentID string, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
diff --git a/agentsession.go b/agentsession.go
index 6685efb..cf0f23b 100644
--- a/agentsession.go
+++ b/agentsession.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"time"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -40,7 +41,7 @@ func NewAgentSessionService(opts ...option.RequestOption) (r AgentSessionService
// Create a new session for an agent.
func (r *AgentSessionService) New(ctx context.Context, agentID string, body AgentSessionNewParams, opts ...option.RequestOption) (res *AgentSessionNewResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -52,7 +53,7 @@ func (r *AgentSessionService) New(ctx context.Context, agentID string, body Agen
// Retrieve an agent session by its ID.
func (r *AgentSessionService) Get(ctx context.Context, sessionID string, params AgentSessionGetParams, opts ...option.RequestOption) (res *Session, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if params.AgentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -68,7 +69,7 @@ func (r *AgentSessionService) Get(ctx context.Context, sessionID string, params
// List all session(s) of a given agent.
func (r *AgentSessionService) List(ctx context.Context, agentID string, query AgentSessionListParams, opts ...option.RequestOption) (res *AgentSessionListResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -80,7 +81,7 @@ func (r *AgentSessionService) List(ctx context.Context, agentID string, query Ag
// Delete an agent session by its ID and its associated turns.
func (r *AgentSessionService) Delete(ctx context.Context, sessionID string, body AgentSessionDeleteParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if body.AgentID == "" {
err = errors.New("missing required agent_id parameter")
diff --git a/agentstep.go b/agentstep.go
index 7ce85a2..3d1d601 100644
--- a/agentstep.go
+++ b/agentstep.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"time"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -37,7 +38,7 @@ func NewAgentStepService(opts ...option.RequestOption) (r AgentStepService) {
// Retrieve an agent step by its ID.
func (r *AgentStepService) Get(ctx context.Context, stepID string, query AgentStepGetParams, opts ...option.RequestOption) (res *AgentStepGetResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.AgentID == "" {
err = errors.New("missing required agent_id parameter")
return
diff --git a/agentturn.go b/agentturn.go
index 7a0e9e0..f153688 100644
--- a/agentturn.go
+++ b/agentturn.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"time"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -40,7 +41,7 @@ func NewAgentTurnService(opts ...option.RequestOption) (r AgentTurnService) {
// Create a new turn for an agent.
func (r *AgentTurnService) New(ctx context.Context, sessionID string, params AgentTurnNewParams, opts ...option.RequestOption) (res *Turn, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if params.AgentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -60,7 +61,7 @@ func (r *AgentTurnService) NewStreaming(ctx context.Context, sessionID string, p
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
if params.AgentID == "" {
err = errors.New("missing required agent_id parameter")
@@ -77,7 +78,7 @@ func (r *AgentTurnService) NewStreaming(ctx context.Context, sessionID string, p
// Retrieve an agent turn by its ID.
func (r *AgentTurnService) Get(ctx context.Context, turnID string, query AgentTurnGetParams, opts ...option.RequestOption) (res *Turn, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.AgentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -100,7 +101,7 @@ func (r *AgentTurnService) Get(ctx context.Context, turnID string, query AgentTu
// endpoint can be used to submit the outputs from the tool calls once they are
// ready.
func (r *AgentTurnService) Resume(ctx context.Context, turnID string, params AgentTurnResumeParams, opts ...option.RequestOption) (res *Turn, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if params.AgentID == "" {
err = errors.New("missing required agent_id parameter")
return
@@ -127,7 +128,7 @@ func (r *AgentTurnService) ResumeStreaming(ctx context.Context, turnID string, p
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
if params.AgentID == "" {
err = errors.New("missing required agent_id parameter")
diff --git a/benchmark.go b/benchmark.go
index b11a273..0d0135b 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -38,7 +39,7 @@ func NewBenchmarkService(opts ...option.RequestOption) (r BenchmarkService) {
// Get a benchmark by its ID.
func (r *BenchmarkService) Get(ctx context.Context, benchmarkID string, opts ...option.RequestOption) (res *Benchmark, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
@@ -51,7 +52,7 @@ func (r *BenchmarkService) Get(ctx context.Context, benchmarkID string, opts ...
// List all benchmarks.
func (r *BenchmarkService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Benchmark, err error) {
var env ListBenchmarksResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/eval/benchmarks"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -63,7 +64,7 @@ func (r *BenchmarkService) List(ctx context.Context, opts ...option.RequestOptio
// Register a benchmark.
func (r *BenchmarkService) Register(ctx context.Context, body BenchmarkRegisterParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/eval/benchmarks"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
diff --git a/chatcompletion.go b/chatcompletion.go
index 89356fc..ec13e29 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -43,7 +44,7 @@ func NewChatCompletionService(opts ...option.RequestOption) (r ChatCompletionSer
// Generate an OpenAI-compatible chat completion for the given messages using the
// specified model.
func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewParams, opts ...option.RequestOption) (res *ChatCompletionNewResponseUnion, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/chat/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -56,7 +57,7 @@ func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompl
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/openai/v1/chat/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -65,7 +66,7 @@ func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompl
// Describe a chat completion by its ID.
func (r *ChatCompletionService) Get(ctx context.Context, completionID string, opts ...option.RequestOption) (res *ChatCompletionGetResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if completionID == "" {
err = errors.New("missing required completion_id parameter")
return
@@ -78,7 +79,7 @@ func (r *ChatCompletionService) Get(ctx context.Context, completionID string, op
// List all chat completions.
func (r *ChatCompletionService) List(ctx context.Context, query ChatCompletionListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[ChatCompletionListResponse], err error) {
var raw *http.Response
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "v1/openai/v1/chat/completions"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
diff --git a/client.go b/client.go
index 871db20..ed10d4c 100644
--- a/client.go
+++ b/client.go
@@ -6,6 +6,7 @@ import (
"context"
"net/http"
"os"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
@@ -132,7 +133,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 = append(r.Options, opts...)
+ opts = slices.Concat(r.Options, opts)
return requestconfig.ExecuteNewRequest(ctx, method, path, params, res, opts...)
}
diff --git a/completion.go b/completion.go
index 799b51d..41d3c3a 100644
--- a/completion.go
+++ b/completion.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -37,7 +38,7 @@ func NewCompletionService(opts ...option.RequestOption) (r CompletionService) {
// Generate an OpenAI-compatible completion for the given prompt using the
// specified model.
func (r *CompletionService) New(ctx context.Context, body CompletionNewParams, opts ...option.RequestOption) (res *CompletionNewResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -50,7 +51,7 @@ func (r *CompletionService) NewStreaming(ctx context.Context, body CompletionNew
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/openai/v1/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
diff --git a/dataset.go b/dataset.go
index f31e6b3..72a79d4 100644
--- a/dataset.go
+++ b/dataset.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -40,7 +41,7 @@ func NewDatasetService(opts ...option.RequestOption) (r DatasetService) {
// Get a dataset by its ID.
func (r *DatasetService) Get(ctx context.Context, datasetID string, opts ...option.RequestOption) (res *DatasetGetResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if datasetID == "" {
err = errors.New("missing required dataset_id parameter")
return
@@ -53,7 +54,7 @@ func (r *DatasetService) Get(ctx context.Context, datasetID string, opts ...opti
// List all datasets.
func (r *DatasetService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListDatasetsResponseData, err error) {
var env ListDatasetsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/datasets"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -65,7 +66,7 @@ func (r *DatasetService) List(ctx context.Context, opts ...option.RequestOption)
// Append rows to a dataset.
func (r *DatasetService) Appendrows(ctx context.Context, datasetID string, body DatasetAppendrowsParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if datasetID == "" {
err = errors.New("missing required dataset_id parameter")
@@ -86,7 +87,7 @@ func (r *DatasetService) Appendrows(ctx context.Context, datasetID string, body
// - data: List of items for the current page.
// - has_more: Whether there are more items available after this set.
func (r *DatasetService) Iterrows(ctx context.Context, datasetID string, query DatasetIterrowsParams, opts ...option.RequestOption) (res *DatasetIterrowsResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if datasetID == "" {
err = errors.New("missing required dataset_id parameter")
return
@@ -98,7 +99,7 @@ func (r *DatasetService) Iterrows(ctx context.Context, datasetID string, query D
// Register a new dataset.
func (r *DatasetService) Register(ctx context.Context, body DatasetRegisterParams, opts ...option.RequestOption) (res *DatasetRegisterResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/datasets"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -106,7 +107,7 @@ func (r *DatasetService) Register(ctx context.Context, body DatasetRegisterParam
// Unregister a dataset by its ID.
func (r *DatasetService) Unregister(ctx context.Context, datasetID string, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if datasetID == "" {
err = errors.New("missing required dataset_id parameter")
diff --git a/embedding.go b/embedding.go
index 168acd8..c366f00 100644
--- a/embedding.go
+++ b/embedding.go
@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -37,7 +38,7 @@ func NewEmbeddingService(opts ...option.RequestOption) (r EmbeddingService) {
// Generate OpenAI-compatible embeddings for the given input using the specified
// model.
func (r *EmbeddingService) New(ctx context.Context, body EmbeddingNewParams, opts ...option.RequestOption) (res *CreateEmbeddingsResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/embeddings"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/eval.go b/eval.go
index 6961a0c..ba9511f 100644
--- a/eval.go
+++ b/eval.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -40,7 +41,7 @@ func NewEvalService(opts ...option.RequestOption) (r EvalService) {
// Evaluate a list of rows on a benchmark.
func (r *EvalService) EvaluateRows(ctx context.Context, benchmarkID string, body EvalEvaluateRowsParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
@@ -52,7 +53,7 @@ func (r *EvalService) EvaluateRows(ctx context.Context, benchmarkID string, body
// Evaluate a list of rows on a benchmark.
func (r *EvalService) EvaluateRowsAlpha(ctx context.Context, benchmarkID string, body EvalEvaluateRowsAlphaParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
@@ -64,7 +65,7 @@ func (r *EvalService) EvaluateRowsAlpha(ctx context.Context, benchmarkID string,
// Run an evaluation on a benchmark.
func (r *EvalService) RunEval(ctx context.Context, benchmarkID string, body EvalRunEvalParams, opts ...option.RequestOption) (res *Job, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
@@ -76,7 +77,7 @@ func (r *EvalService) RunEval(ctx context.Context, benchmarkID string, body Eval
// Run an evaluation on a benchmark.
func (r *EvalService) RunEvalAlpha(ctx context.Context, benchmarkID string, body EvalRunEvalAlphaParams, opts ...option.RequestOption) (res *Job, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
diff --git a/evaljob.go b/evaljob.go
index f7e700b..e71d355 100644
--- a/evaljob.go
+++ b/evaljob.go
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
@@ -33,7 +34,7 @@ func NewEvalJobService(opts ...option.RequestOption) (r EvalJobService) {
// Get the result of a job.
func (r *EvalJobService) Get(ctx context.Context, jobID string, query EvalJobGetParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.BenchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
@@ -49,7 +50,7 @@ func (r *EvalJobService) Get(ctx context.Context, jobID string, query EvalJobGet
// Cancel a job.
func (r *EvalJobService) Cancel(ctx context.Context, jobID string, body EvalJobCancelParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if body.BenchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
@@ -66,7 +67,7 @@ func (r *EvalJobService) Cancel(ctx context.Context, jobID string, body EvalJobC
// Get the status of a job.
func (r *EvalJobService) Status(ctx context.Context, jobID string, query EvalJobStatusParams, opts ...option.RequestOption) (res *Job, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.BenchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
diff --git a/file.go b/file.go
index 9d16365..f7166ab 100644
--- a/file.go
+++ b/file.go
@@ -11,6 +11,7 @@ import (
"mime/multipart"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apiform"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -48,7 +49,7 @@ func NewFileService(opts ...option.RequestOption) (r FileService) {
// - file: The File object (not file name) to be uploaded.
// - purpose: The intended purpose of the uploaded file.
func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...option.RequestOption) (res *File, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/files"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -56,7 +57,7 @@ func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...optio
// Returns information about a specific file.
func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *File, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if fileID == "" {
err = errors.New("missing required file_id parameter")
return
@@ -69,7 +70,7 @@ func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.Req
// Returns a list of files that belong to the user's organization.
func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[File], err error) {
var raw *http.Response
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "v1/openai/v1/files"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -91,7 +92,7 @@ func (r *FileService) ListAutoPaging(ctx context.Context, query FileListParams,
// Delete a file.
func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (res *DeleteFileResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if fileID == "" {
err = errors.New("missing required file_id parameter")
return
@@ -103,7 +104,7 @@ func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.
// Returns the contents of the specified file.
func (r *FileService) Content(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileContentResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if fileID == "" {
err = errors.New("missing required file_id parameter")
return
diff --git a/inference.go b/inference.go
index 24a5a87..d0ba953 100644
--- a/inference.go
+++ b/inference.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -35,7 +36,7 @@ func NewInferenceService(opts ...option.RequestOption) (r InferenceService) {
// Generate chat completions for a batch of messages using the specified model.
func (r *InferenceService) BatchChatCompletion(ctx context.Context, body InferenceBatchChatCompletionParams, opts ...option.RequestOption) (res *InferenceBatchChatCompletionResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/inference/batch-chat-completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -43,7 +44,7 @@ func (r *InferenceService) BatchChatCompletion(ctx context.Context, body Inferen
// Generate completions for a batch of content using the specified model.
func (r *InferenceService) BatchCompletion(ctx context.Context, body InferenceBatchCompletionParams, opts ...option.RequestOption) (res *BatchCompletion, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/inference/batch-completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -54,7 +55,7 @@ func (r *InferenceService) BatchCompletion(ctx context.Context, body InferenceBa
// Deprecated: /v1/inference/chat-completion is deprecated. Please use
// /v1/openai/v1/chat/completions.
func (r *InferenceService) ChatCompletion(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (res *ChatCompletionResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/inference/chat-completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -69,7 +70,7 @@ func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body Inf
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/inference/chat-completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -81,7 +82,7 @@ func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body Inf
// Deprecated: /v1/inference/completion is deprecated. Please use
// /v1/openai/v1/completions.
func (r *InferenceService) Completion(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (res *CompletionResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/inference/completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -96,7 +97,7 @@ func (r *InferenceService) CompletionStreaming(ctx context.Context, body Inferen
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/inference/completion"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -108,7 +109,7 @@ func (r *InferenceService) CompletionStreaming(ctx context.Context, body Inferen
// Deprecated: /v1/inference/embeddings is deprecated. Please use
// /v1/openai/v1/embeddings.
func (r *InferenceService) Embeddings(ctx context.Context, body InferenceEmbeddingsParams, opts ...option.RequestOption) (res *EmbeddingsResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/inference/embeddings"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/inspect.go b/inspect.go
index 3713218..4250123 100644
--- a/inspect.go
+++ b/inspect.go
@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -34,7 +35,7 @@ func NewInspectService(opts ...option.RequestOption) (r InspectService) {
// Get the current health status of the service.
func (r *InspectService) Health(ctx context.Context, opts ...option.RequestOption) (res *HealthInfo, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/health"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
@@ -42,7 +43,7 @@ func (r *InspectService) Health(ctx context.Context, opts ...option.RequestOptio
// Get the version of the service.
func (r *InspectService) Version(ctx context.Context, opts ...option.RequestOption) (res *VersionInfo, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/version"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
diff --git a/model.go b/model.go
index d3cc1d2..ffe5fef 100644
--- a/model.go
+++ b/model.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -38,7 +39,7 @@ func NewModelService(opts ...option.RequestOption) (r ModelService) {
// Get a model by its identifier.
func (r *ModelService) Get(ctx context.Context, modelID string, opts ...option.RequestOption) (res *Model, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if modelID == "" {
err = errors.New("missing required model_id parameter")
return
@@ -51,7 +52,7 @@ func (r *ModelService) Get(ctx context.Context, modelID string, opts ...option.R
// List all models.
func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Model, err error) {
var env ListModelsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/models"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -63,7 +64,7 @@ func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (
// Register a model.
func (r *ModelService) Register(ctx context.Context, body ModelRegisterParams, opts ...option.RequestOption) (res *Model, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/models"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -71,7 +72,7 @@ func (r *ModelService) Register(ctx context.Context, body ModelRegisterParams, o
// Unregister a model.
func (r *ModelService) Unregister(ctx context.Context, modelID string, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if modelID == "" {
err = errors.New("missing required model_id parameter")
diff --git a/moderation.go b/moderation.go
index 47a9b36..b81aa7a 100644
--- a/moderation.go
+++ b/moderation.go
@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -35,7 +36,7 @@ func NewModerationService(opts ...option.RequestOption) (r ModerationService) {
// Classifies if text and/or image inputs are potentially harmful.
func (r *ModerationService) New(ctx context.Context, body ModerationNewParams, opts ...option.RequestOption) (res *CreateResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/moderations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/posttraining.go b/posttraining.go
index b919dfd..9b94fa8 100644
--- a/posttraining.go
+++ b/posttraining.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -37,7 +38,7 @@ func NewPostTrainingService(opts ...option.RequestOption) (r PostTrainingService
// Run preference optimization of a model.
func (r *PostTrainingService) PreferenceOptimize(ctx context.Context, body PostTrainingPreferenceOptimizeParams, opts ...option.RequestOption) (res *PostTrainingJob, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/post-training/preference-optimize"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -45,7 +46,7 @@ func (r *PostTrainingService) PreferenceOptimize(ctx context.Context, body PostT
// Run supervised fine-tuning of a model.
func (r *PostTrainingService) SupervisedFineTune(ctx context.Context, body PostTrainingSupervisedFineTuneParams, opts ...option.RequestOption) (res *PostTrainingJob, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/post-training/supervised-fine-tune"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/posttrainingjob.go b/posttrainingjob.go
index 45109d8..9cc9583 100644
--- a/posttrainingjob.go
+++ b/posttrainingjob.go
@@ -7,6 +7,7 @@ import (
"encoding/json"
"net/http"
"net/url"
+ "slices"
"time"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -39,7 +40,7 @@ func NewPostTrainingJobService(opts ...option.RequestOption) (r PostTrainingJobS
// Get all training jobs.
func (r *PostTrainingJobService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListPostTrainingJobsResponseData, err error) {
var env ListPostTrainingJobsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/post-training/jobs"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -51,7 +52,7 @@ func (r *PostTrainingJobService) List(ctx context.Context, opts ...option.Reques
// Get the artifacts of a training job.
func (r *PostTrainingJobService) Artifacts(ctx context.Context, query PostTrainingJobArtifactsParams, opts ...option.RequestOption) (res *PostTrainingJobArtifactsResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/post-training/job/artifacts"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
@@ -59,7 +60,7 @@ func (r *PostTrainingJobService) Artifacts(ctx context.Context, query PostTraini
// Cancel a training job.
func (r *PostTrainingJobService) Cancel(ctx context.Context, body PostTrainingJobCancelParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/post-training/job/cancel"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
@@ -68,7 +69,7 @@ func (r *PostTrainingJobService) Cancel(ctx context.Context, body PostTrainingJo
// Get the status of a training job.
func (r *PostTrainingJobService) Status(ctx context.Context, query PostTrainingJobStatusParams, opts ...option.RequestOption) (res *PostTrainingJobStatusResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/post-training/job/status"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
diff --git a/provider.go b/provider.go
index 87e7f3c..d93c0ba 100644
--- a/provider.go
+++ b/provider.go
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -35,7 +36,7 @@ func NewProviderService(opts ...option.RequestOption) (r ProviderService) {
// Get detailed information about a specific provider.
func (r *ProviderService) Get(ctx context.Context, providerID string, opts ...option.RequestOption) (res *ProviderInfo, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if providerID == "" {
err = errors.New("missing required provider_id parameter")
return
@@ -48,7 +49,7 @@ func (r *ProviderService) Get(ctx context.Context, providerID string, opts ...op
// List all available providers.
func (r *ProviderService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ProviderInfo, err error) {
var env ListProvidersResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/providers"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
diff --git a/response.go b/response.go
index a58d06e..c2b6491 100644
--- a/response.go
+++ b/response.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -44,7 +45,7 @@ func NewResponseService(opts ...option.RequestOption) (r ResponseService) {
// Create a new OpenAI response.
func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *ResponseObject, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -56,7 +57,7 @@ func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewPara
raw *http.Response
err error
)
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/openai/v1/responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
@@ -65,7 +66,7 @@ func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewPara
// Retrieve an OpenAI response by its ID.
func (r *ResponseService) Get(ctx context.Context, responseID string, opts ...option.RequestOption) (res *ResponseObject, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return
@@ -78,7 +79,7 @@ func (r *ResponseService) Get(ctx context.Context, responseID string, opts ...op
// List all OpenAI responses.
func (r *ResponseService) List(ctx context.Context, query ResponseListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[ResponseListResponse], err error) {
var raw *http.Response
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "v1/openai/v1/responses"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
diff --git a/responseinputitem.go b/responseinputitem.go
index 76f004c..5e83419 100644
--- a/responseinputitem.go
+++ b/responseinputitem.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -40,7 +41,7 @@ func NewResponseInputItemService(opts ...option.RequestOption) (r ResponseInputI
// List input items for a given OpenAI response.
func (r *ResponseInputItemService) List(ctx context.Context, responseID string, query ResponseInputItemListParams, opts ...option.RequestOption) (res *ResponseInputItemListResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if responseID == "" {
err = errors.New("missing required response_id parameter")
return
diff --git a/route.go b/route.go
index 9ab5dfb..60208fa 100644
--- a/route.go
+++ b/route.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -34,7 +35,7 @@ func NewRouteService(opts ...option.RequestOption) (r RouteService) {
// List all available API routes with their methods and implementing providers.
func (r *RouteService) List(ctx context.Context, opts ...option.RequestOption) (res *[]RouteInfo, err error) {
var env ListRoutesResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/inspect/routes"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
diff --git a/safety.go b/safety.go
index c07f077..015d128 100644
--- a/safety.go
+++ b/safety.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -34,7 +35,7 @@ func NewSafetyService(opts ...option.RequestOption) (r SafetyService) {
// Run a shield.
func (r *SafetyService) RunShield(ctx context.Context, body SafetyRunShieldParams, opts ...option.RequestOption) (res *RunShieldResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/safety/run-shield"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/scoring.go b/scoring.go
index 56cf107..3f4a0b6 100644
--- a/scoring.go
+++ b/scoring.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -34,7 +35,7 @@ func NewScoringService(opts ...option.RequestOption) (r ScoringService) {
// Score a list of rows.
func (r *ScoringService) Score(ctx context.Context, body ScoringScoreParams, opts ...option.RequestOption) (res *ScoringScoreResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/scoring/score"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -42,7 +43,7 @@ func (r *ScoringService) Score(ctx context.Context, body ScoringScoreParams, opt
// Score a batch of rows.
func (r *ScoringService) ScoreBatch(ctx context.Context, body ScoringScoreBatchParams, opts ...option.RequestOption) (res *ScoringScoreBatchResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/scoring/score-batch"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/scoringfunction.go b/scoringfunction.go
index 7e4476b..76fbef0 100644
--- a/scoringfunction.go
+++ b/scoringfunction.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -38,7 +39,7 @@ func NewScoringFunctionService(opts ...option.RequestOption) (r ScoringFunctionS
// Get a scoring function by its ID.
func (r *ScoringFunctionService) Get(ctx context.Context, scoringFnID string, opts ...option.RequestOption) (res *ScoringFn, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if scoringFnID == "" {
err = errors.New("missing required scoring_fn_id parameter")
return
@@ -51,7 +52,7 @@ func (r *ScoringFunctionService) Get(ctx context.Context, scoringFnID string, op
// List all scoring functions.
func (r *ScoringFunctionService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ScoringFn, err error) {
var env ListScoringFunctionsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/scoring-functions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -63,7 +64,7 @@ func (r *ScoringFunctionService) List(ctx context.Context, opts ...option.Reques
// Register a scoring function.
func (r *ScoringFunctionService) Register(ctx context.Context, body ScoringFunctionRegisterParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/scoring-functions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
diff --git a/shield.go b/shield.go
index 575f942..2ce56f9 100644
--- a/shield.go
+++ b/shield.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -38,7 +39,7 @@ func NewShieldService(opts ...option.RequestOption) (r ShieldService) {
// Get a shield by its identifier.
func (r *ShieldService) Get(ctx context.Context, identifier string, opts ...option.RequestOption) (res *Shield, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if identifier == "" {
err = errors.New("missing required identifier parameter")
return
@@ -51,7 +52,7 @@ func (r *ShieldService) Get(ctx context.Context, identifier string, opts ...opti
// List all shields.
func (r *ShieldService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Shield, err error) {
var env ListShieldsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/shields"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -63,7 +64,7 @@ func (r *ShieldService) List(ctx context.Context, opts ...option.RequestOption)
// Register a shield.
func (r *ShieldService) Register(ctx context.Context, body ShieldRegisterParams, opts ...option.RequestOption) (res *Shield, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/shields"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/syntheticdatageneration.go b/syntheticdatageneration.go
index 3472f75..14aae36 100644
--- a/syntheticdatageneration.go
+++ b/syntheticdatageneration.go
@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -35,7 +36,7 @@ func NewSyntheticDataGenerationService(opts ...option.RequestOption) (r Syntheti
// Generate synthetic data based on input dialogs and apply filtering.
func (r *SyntheticDataGenerationService) Generate(ctx context.Context, body SyntheticDataGenerationGenerateParams, opts ...option.RequestOption) (res *SyntheticDataGenerationResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/synthetic-data-generation/generate"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/telemetry.go b/telemetry.go
index 2a04754..e55e1da 100644
--- a/telemetry.go
+++ b/telemetry.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"time"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
@@ -39,7 +40,7 @@ func NewTelemetryService(opts ...option.RequestOption) (r TelemetryService) {
// Get a span by its ID.
func (r *TelemetryService) GetSpan(ctx context.Context, spanID string, query TelemetryGetSpanParams, opts ...option.RequestOption) (res *TelemetryGetSpanResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.TraceID == "" {
err = errors.New("missing required trace_id parameter")
return
@@ -56,7 +57,7 @@ func (r *TelemetryService) GetSpan(ctx context.Context, spanID string, query Tel
// Get a span tree by its ID.
func (r *TelemetryService) GetSpanTree(ctx context.Context, spanID string, body TelemetryGetSpanTreeParams, opts ...option.RequestOption) (res *TelemetryGetSpanTreeResponse, err error) {
var env TelemetryGetSpanTreeResponseEnvelope
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if spanID == "" {
err = errors.New("missing required span_id parameter")
return
@@ -72,7 +73,7 @@ func (r *TelemetryService) GetSpanTree(ctx context.Context, spanID string, body
// Get a trace by its ID.
func (r *TelemetryService) GetTrace(ctx context.Context, traceID string, opts ...option.RequestOption) (res *Trace, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if traceID == "" {
err = errors.New("missing required trace_id parameter")
return
@@ -84,7 +85,7 @@ func (r *TelemetryService) GetTrace(ctx context.Context, traceID string, opts ..
// Log an event.
func (r *TelemetryService) LogEvent(ctx context.Context, body TelemetryLogEventParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/telemetry/events"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
@@ -94,7 +95,7 @@ func (r *TelemetryService) LogEvent(ctx context.Context, body TelemetryLogEventP
// Query metrics.
func (r *TelemetryService) QueryMetrics(ctx context.Context, metricName string, body TelemetryQueryMetricsParams, opts ...option.RequestOption) (res *[]TelemetryQueryMetricsResponse, err error) {
var env TelemetryQueryMetricsResponseEnvelope
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if metricName == "" {
err = errors.New("missing required metric_name parameter")
return
@@ -111,7 +112,7 @@ func (r *TelemetryService) QueryMetrics(ctx context.Context, metricName string,
// Query spans.
func (r *TelemetryService) QuerySpans(ctx context.Context, body TelemetryQuerySpansParams, opts ...option.RequestOption) (res *[]QuerySpansResponseData, err error) {
var env QuerySpansResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/telemetry/spans"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
if err != nil {
@@ -124,7 +125,7 @@ func (r *TelemetryService) QuerySpans(ctx context.Context, body TelemetryQuerySp
// Query traces.
func (r *TelemetryService) QueryTraces(ctx context.Context, body TelemetryQueryTracesParams, opts ...option.RequestOption) (res *[]Trace, err error) {
var env TelemetryQueryTracesResponseEnvelope
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/telemetry/traces"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
if err != nil {
@@ -136,7 +137,7 @@ func (r *TelemetryService) QueryTraces(ctx context.Context, body TelemetryQueryT
// Save spans to a dataset.
func (r *TelemetryService) SaveSpansToDataset(ctx context.Context, body TelemetrySaveSpansToDatasetParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/telemetry/spans/export"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
diff --git a/tool.go b/tool.go
index 3518704..fabc9f6 100644
--- a/tool.go
+++ b/tool.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -41,7 +42,7 @@ func NewToolService(opts ...option.RequestOption) (r ToolService) {
// List tools with optional tool group.
func (r *ToolService) List(ctx context.Context, query ToolListParams, opts ...option.RequestOption) (res *[]Tool, err error) {
var env ListToolsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/tools"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
@@ -53,7 +54,7 @@ func (r *ToolService) List(ctx context.Context, query ToolListParams, opts ...op
// Get a tool by its name.
func (r *ToolService) Get(ctx context.Context, toolName string, opts ...option.RequestOption) (res *Tool, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if toolName == "" {
err = errors.New("missing required tool_name parameter")
return
diff --git a/toolgroup.go b/toolgroup.go
index bed1c74..66ea272 100644
--- a/toolgroup.go
+++ b/toolgroup.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -39,7 +40,7 @@ func NewToolgroupService(opts ...option.RequestOption) (r ToolgroupService) {
// List tool groups with optional provider.
func (r *ToolgroupService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ToolGroup, err error) {
var env ListToolGroupsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/toolgroups"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -51,7 +52,7 @@ func (r *ToolgroupService) List(ctx context.Context, opts ...option.RequestOptio
// Get a tool group by its ID.
func (r *ToolgroupService) Get(ctx context.Context, toolgroupID string, opts ...option.RequestOption) (res *ToolGroup, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if toolgroupID == "" {
err = errors.New("missing required toolgroup_id parameter")
return
@@ -63,7 +64,7 @@ func (r *ToolgroupService) Get(ctx context.Context, toolgroupID string, opts ...
// Register a tool group.
func (r *ToolgroupService) Register(ctx context.Context, body ToolgroupRegisterParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/toolgroups"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
@@ -72,7 +73,7 @@ func (r *ToolgroupService) Register(ctx context.Context, body ToolgroupRegisterP
// Unregister a tool group.
func (r *ToolgroupService) Unregister(ctx context.Context, toolgroupID string, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if toolgroupID == "" {
err = errors.New("missing required toolgroup_id parameter")
diff --git a/toolruntime.go b/toolruntime.go
index a0a791e..7b09134 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -7,6 +7,7 @@ import (
"encoding/json"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -39,7 +40,7 @@ func NewToolRuntimeService(opts ...option.RequestOption) (r ToolRuntimeService)
// Run a tool with the given arguments.
func (r *ToolRuntimeService) InvokeTool(ctx context.Context, body ToolRuntimeInvokeToolParams, opts ...option.RequestOption) (res *ToolInvocationResult, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/tool-runtime/invoke"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -48,7 +49,7 @@ func (r *ToolRuntimeService) InvokeTool(ctx context.Context, body ToolRuntimeInv
// List all tools in the runtime.
func (r *ToolRuntimeService) ListTools(ctx context.Context, query ToolRuntimeListToolsParams, opts ...option.RequestOption) (res *[]ToolDef, err error) {
var env ToolRuntimeListToolsResponseEnvelope
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/tool-runtime/list-tools"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
if err != nil {
diff --git a/toolruntimeragtool.go b/toolruntimeragtool.go
index e0e34e7..322954f 100644
--- a/toolruntimeragtool.go
+++ b/toolruntimeragtool.go
@@ -5,6 +5,7 @@ package llamastackclient
import (
"context"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -33,7 +34,7 @@ func NewToolRuntimeRagToolService(opts ...option.RequestOption) (r ToolRuntimeRa
// Index documents so they can be used by the RAG system.
func (r *ToolRuntimeRagToolService) Insert(ctx context.Context, body ToolRuntimeRagToolInsertParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/tool-runtime/rag-tool/insert"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
@@ -42,7 +43,7 @@ func (r *ToolRuntimeRagToolService) Insert(ctx context.Context, body ToolRuntime
// Query the RAG system for context; typically invoked by the agent.
func (r *ToolRuntimeRagToolService) Query(ctx context.Context, body ToolRuntimeRagToolQueryParams, opts ...option.RequestOption) (res *QueryResult, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/tool-runtime/rag-tool/query"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/vectordb.go b/vectordb.go
index 99547fa..0319191 100644
--- a/vectordb.go
+++ b/vectordb.go
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -37,7 +38,7 @@ func NewVectorDBService(opts ...option.RequestOption) (r VectorDBService) {
// Get a vector database by its identifier.
func (r *VectorDBService) Get(ctx context.Context, vectorDBID string, opts ...option.RequestOption) (res *VectorDBGetResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if vectorDBID == "" {
err = errors.New("missing required vector_db_id parameter")
return
@@ -50,7 +51,7 @@ func (r *VectorDBService) Get(ctx context.Context, vectorDBID string, opts ...op
// List all vector databases.
func (r *VectorDBService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListVectorDBsResponseData, err error) {
var env ListVectorDBsResponse
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/vector-dbs"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
@@ -62,7 +63,7 @@ func (r *VectorDBService) List(ctx context.Context, opts ...option.RequestOption
// Register a vector database.
func (r *VectorDBService) Register(ctx context.Context, body VectorDBRegisterParams, opts ...option.RequestOption) (res *VectorDBRegisterResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/vector-dbs"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -70,7 +71,7 @@ func (r *VectorDBService) Register(ctx context.Context, body VectorDBRegisterPar
// Unregister a vector database.
func (r *VectorDBService) Unregister(ctx context.Context, vectorDBID string, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if vectorDBID == "" {
err = errors.New("missing required vector_db_id parameter")
diff --git a/vectorio.go b/vectorio.go
index 62f087d..5a16929 100644
--- a/vectorio.go
+++ b/vectorio.go
@@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"net/http"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
@@ -35,7 +36,7 @@ func NewVectorIoService(opts ...option.RequestOption) (r VectorIoService) {
// Insert chunks into a vector database.
func (r *VectorIoService) Insert(ctx context.Context, body VectorIoInsertParams, opts ...option.RequestOption) (err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
path := "v1/vector-io/insert"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
@@ -44,7 +45,7 @@ func (r *VectorIoService) Insert(ctx context.Context, body VectorIoInsertParams,
// Query chunks from a vector database.
func (r *VectorIoService) Query(ctx context.Context, body VectorIoQueryParams, opts ...option.RequestOption) (res *QueryChunksResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/vector-io/query"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
diff --git a/vectorstore.go b/vectorstore.go
index 8a41fde..0a5042a 100644
--- a/vectorstore.go
+++ b/vectorstore.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -43,7 +44,7 @@ func NewVectorStoreService(opts ...option.RequestOption) (r VectorStoreService)
// Creates a vector store.
func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams, opts ...option.RequestOption) (res *VectorStore, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
path := "v1/openai/v1/vector_stores"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
@@ -51,7 +52,7 @@ func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams,
// Retrieves a vector store.
func (r *VectorStoreService) Get(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStore, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -63,7 +64,7 @@ func (r *VectorStoreService) Get(ctx context.Context, vectorStoreID string, opts
// Updates a vector store.
func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, body VectorStoreUpdateParams, opts ...option.RequestOption) (res *VectorStore, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -76,7 +77,7 @@ func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, b
// Returns a list of vector stores.
func (r *VectorStoreService) List(ctx context.Context, query VectorStoreListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStore], err error) {
var raw *http.Response
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "v1/openai/v1/vector_stores"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
@@ -98,7 +99,7 @@ func (r *VectorStoreService) ListAutoPaging(ctx context.Context, query VectorSto
// Delete a vector store.
func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, opts ...option.RequestOption) (res *VectorStoreDeleteResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -111,7 +112,7 @@ func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, o
// Search for chunks in a vector store. Searches a vector store for relevant chunks
// based on a query and optional file attribute filters.
func (r *VectorStoreService) Search(ctx context.Context, vectorStoreID string, body VectorStoreSearchParams, opts ...option.RequestOption) (res *VectorStoreSearchResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
diff --git a/vectorstorefile.go b/vectorstorefile.go
index c05d2c6..bcb31b0 100644
--- a/vectorstorefile.go
+++ b/vectorstorefile.go
@@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "slices"
"github.com/llamastack/llama-stack-client-go/internal/apijson"
"github.com/llamastack/llama-stack-client-go/internal/apiquery"
@@ -41,7 +42,7 @@ func NewVectorStoreFileService(opts ...option.RequestOption) (r VectorStoreFileS
// Attach a file to a vector store.
func (r *VectorStoreFileService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileNewParams, opts ...option.RequestOption) (res *VectorStoreFile, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -53,7 +54,7 @@ func (r *VectorStoreFileService) New(ctx context.Context, vectorStoreID string,
// Retrieves a vector store file.
func (r *VectorStoreFileService) Get(ctx context.Context, fileID string, query VectorStoreFileGetParams, opts ...option.RequestOption) (res *VectorStoreFile, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.VectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -69,7 +70,7 @@ func (r *VectorStoreFileService) Get(ctx context.Context, fileID string, query V
// Updates a vector store file.
func (r *VectorStoreFileService) Update(ctx context.Context, fileID string, params VectorStoreFileUpdateParams, opts ...option.RequestOption) (res *VectorStoreFile, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if params.VectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -86,7 +87,7 @@ func (r *VectorStoreFileService) Update(ctx context.Context, fileID string, para
// List files in a vector store.
func (r *VectorStoreFileService) List(ctx context.Context, vectorStoreID string, query VectorStoreFileListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStoreFile], err error) {
var raw *http.Response
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
if vectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
@@ -112,7 +113,7 @@ func (r *VectorStoreFileService) ListAutoPaging(ctx context.Context, vectorStore
// Delete a vector store file.
func (r *VectorStoreFileService) Delete(ctx context.Context, fileID string, body VectorStoreFileDeleteParams, opts ...option.RequestOption) (res *VectorStoreFileDeleteResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if body.VectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
@@ -128,7 +129,7 @@ func (r *VectorStoreFileService) Delete(ctx context.Context, fileID string, body
// Retrieves the contents of a vector store file.
func (r *VectorStoreFileService) Content(ctx context.Context, fileID string, query VectorStoreFileContentParams, opts ...option.RequestOption) (res *VectorStoreFileContentResponse, err error) {
- opts = append(r.Options[:], opts...)
+ opts = slices.Concat(r.Options, opts)
if query.VectorStoreID == "" {
err = errors.New("missing required vector_store_id parameter")
return
From 062a46b117baaf537ef9a0edef4222d7a1b3a839 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 20 Sep 2025 02:50:01 +0000
Subject: [PATCH 13/33] chore: do not install brew dependencies in
./scripts/bootstrap by default
---
scripts/bootstrap | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/scripts/bootstrap b/scripts/bootstrap
index d6ac165..5ab3066 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,10 +4,18 @@ set -e
cd "$(dirname "$0")/.."
-if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then
+if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
- echo "==> Installing Homebrew dependencies…"
- brew bundle
+ echo -n "==> Install Homebrew dependencies? (y/N): "
+ read -r response
+ case "$response" in
+ [yY][eE][sS]|[yY])
+ brew bundle
+ ;;
+ *)
+ ;;
+ esac
+ echo
}
fi
From eb137afa61bf5621159b871561e3a11ca3589b00 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 25 Sep 2025 21:26:48 +0000
Subject: [PATCH 14/33] feat(api): manual updates
delete /v1/openai/v1/responses/{response_id}
post /v1/inference/rerank
get /v1/openai/v1/models
delete /v1/shields/{identifier}
---
.stats.yml | 4 +-
api.md | 15 +++
inference.go | 307 ++++++++++++++++++++++++++++++++++++++++++++
inference_test.go | 30 +++++
model.go | 2 +
modelopenai.go | 86 +++++++++++++
modelopenai_test.go | 35 +++++
response.go | 36 ++++++
response_test.go | 21 +++
shield.go | 13 ++
shield_test.go | 21 +++
11 files changed, 568 insertions(+), 2 deletions(-)
create mode 100644 modelopenai.go
create mode 100644 modelopenai_test.go
diff --git a/.stats.yml b/.stats.yml
index 53ea203..fa9edfc 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 107
+configured_endpoints: 111
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: 374d9711288576877a9fabb34e4da7b9
+config_hash: 0358112cc0f3d880b4d55debdbe1cfa3
diff --git a/api.md b/api.md
index d42ee54..9188d71 100644
--- a/api.md
+++ b/api.md
@@ -91,12 +91,14 @@ Response Types:
- llamastackclient.ResponseObject
- llamastackclient.ResponseObjectStreamUnion
- llamastackclient.ResponseListResponse
+- llamastackclient.ResponseDeleteResponse
Methods:
- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseObject, error)
- client.Responses.Get(ctx context.Context, responseID string) (llamastackclient.ResponseObject, error)
- client.Responses.List(ctx context.Context, query llamastackclient.ResponseListParams) (pagination.OpenAICursorPage[llamastackclient.ResponseListResponse], error)
+- client.Responses.Delete(ctx context.Context, responseID string) (llamastackclient.ResponseDeleteResponse, error)
## InputItems
@@ -240,6 +242,7 @@ Response Types:
- llamastackclient.EmbeddingsResponse
- llamastackclient.TokenLogProbs
- llamastackclient.InferenceBatchChatCompletionResponse
+- llamastackclient.InferenceRerankResponse
Methods:
@@ -248,6 +251,7 @@ Methods:
- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (llamastackclient.ChatCompletionResponse, error)
- client.Inference.Completion(ctx context.Context, body llamastackclient.InferenceCompletionParams) (llamastackclient.CompletionResponse, error)
- client.Inference.Embeddings(ctx context.Context, body llamastackclient.InferenceEmbeddingsParams) (llamastackclient.EmbeddingsResponse, error)
+- client.Inference.Rerank(ctx context.Context, body llamastackclient.InferenceRerankParams) ([]llamastackclient.InferenceRerankResponse, error)
# Embeddings
@@ -364,6 +368,16 @@ Methods:
- client.Models.Register(ctx context.Context, body llamastackclient.ModelRegisterParams) (llamastackclient.Model, error)
- client.Models.Unregister(ctx context.Context, modelID string) error
+## OpenAI
+
+Response Types:
+
+- llamastackclient.ModelOpenAIListResponse
+
+Methods:
+
+- client.Models.OpenAI.List(ctx context.Context) ([]llamastackclient.ModelOpenAIListResponse, error)
+
# PostTraining
Params Types:
@@ -446,6 +460,7 @@ Methods:
- client.Shields.Get(ctx context.Context, identifier string) (llamastackclient.Shield, error)
- client.Shields.List(ctx context.Context) ([]llamastackclient.Shield, error)
+- client.Shields.Delete(ctx context.Context, identifier string) error
- client.Shields.Register(ctx context.Context, body llamastackclient.ShieldRegisterParams) (llamastackclient.Shield, error)
# SyntheticDataGeneration
diff --git a/inference.go b/inference.go
index d0ba953..7b928ad 100644
--- a/inference.go
+++ b/inference.go
@@ -13,6 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
"github.com/llamastack/llama-stack-client-go/packages/ssestream"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// InferenceService contains methods and other services that help with interacting
@@ -115,6 +116,19 @@ func (r *InferenceService) Embeddings(ctx context.Context, body InferenceEmbeddi
return
}
+// Rerank a list of documents based on their relevance to a query.
+func (r *InferenceService) Rerank(ctx context.Context, body InferenceRerankParams, opts ...option.RequestOption) (res *[]InferenceRerankResponse, err error) {
+ var env InferenceRerankResponseEnvelope
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/inference/rerank"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Data
+ return
+}
+
// A chunk of a streamed chat completion response.
type ChatCompletionResponseStreamChunk struct {
// The event containing the new content
@@ -262,6 +276,28 @@ func (r *InferenceBatchChatCompletionResponse) UnmarshalJSON(data []byte) error
return apijson.UnmarshalRoot(data, r)
}
+// A single rerank result from a reranking response.
+type InferenceRerankResponse struct {
+ // The original index of the document in the input list
+ Index int64 `json:"index,required"`
+ // The relevance score from the model output. Values are inverted when applicable
+ // so that higher scores indicate greater relevance.
+ RelevanceScore float64 `json:"relevance_score,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Index respjson.Field
+ RelevanceScore respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r InferenceRerankResponse) RawJSON() string { return r.JSON.raw }
+func (r *InferenceRerankResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type InferenceBatchChatCompletionParams struct {
// The messages to generate completions for.
MessagesBatch [][]MessageUnionParam `json:"messages_batch,omitzero,required"`
@@ -666,3 +702,274 @@ const (
InferenceEmbeddingsParamsTextTruncationStart InferenceEmbeddingsParamsTextTruncation = "start"
InferenceEmbeddingsParamsTextTruncationEnd InferenceEmbeddingsParamsTextTruncation = "end"
)
+
+type InferenceRerankParams struct {
+ // List of items to rerank. Each item can be a string, text content part, or image
+ // content part. Each input must not exceed the model's max input token length.
+ Items []InferenceRerankParamsItemUnion `json:"items,omitzero,required"`
+ // The identifier of the reranking model to use.
+ Model string `json:"model,required"`
+ // The search query to rank items against. Can be a string, text content part, or
+ // image content part. The input must not exceed the model's max input token
+ // length.
+ Query InferenceRerankParamsQueryUnion `json:"query,omitzero,required"`
+ // (Optional) Maximum number of results to return. Default: returns all.
+ MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
+ paramObj
+}
+
+func (r InferenceRerankParams) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type InferenceRerankParamsItemUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartText *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u InferenceRerankParamsItemUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
+}
+func (u *InferenceRerankParamsItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *InferenceRerankParamsItemUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
+ return u.OfOpenAIChatCompletionContentPartText
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartImage) {
+ return u.OfOpenAIChatCompletionContentPartImage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsItemUnion) GetText() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsItemUnion) GetImageURL() *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL {
+ if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return &vt.ImageURL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsItemUnion) GetType() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Text content part for OpenAI-compatible chat completion messages.
+//
+// The properties Text, Type are required.
+type InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam struct {
+ // The text content of the message
+ Text string `json:"text,required"`
+ // Must be "text" to identify this as text content
+ //
+ // This field can be elided, and will marshal its zero value as "text".
+ Type constant.Text `json:"type,required"`
+ paramObj
+}
+
+func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image content part for OpenAI-compatible chat completion messages.
+//
+// The properties ImageURL, Type are required.
+type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam struct {
+ // Image URL specification and processing details
+ ImageURL InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
+ // Must be "image_url" to identify this as image content
+ //
+ // This field can be elided, and will marshal its zero value as "image_url".
+ Type constant.ImageURL `json:"type,required"`
+ paramObj
+}
+
+func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image URL specification and processing details
+//
+// The property URL is required.
+type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL struct {
+ // URL of the image to include in the message
+ URL string `json:"url,required"`
+ // (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
+ Detail param.Opt[string] `json:"detail,omitzero"`
+ paramObj
+}
+
+func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type InferenceRerankParamsQueryUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartText *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u InferenceRerankParamsQueryUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
+}
+func (u *InferenceRerankParamsQueryUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *InferenceRerankParamsQueryUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
+ return u.OfOpenAIChatCompletionContentPartText
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartImage) {
+ return u.OfOpenAIChatCompletionContentPartImage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsQueryUnion) GetText() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsQueryUnion) GetImageURL() *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL {
+ if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return &vt.ImageURL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsQueryUnion) GetType() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Text content part for OpenAI-compatible chat completion messages.
+//
+// The properties Text, Type are required.
+type InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam struct {
+ // The text content of the message
+ Text string `json:"text,required"`
+ // Must be "text" to identify this as text content
+ //
+ // This field can be elided, and will marshal its zero value as "text".
+ Type constant.Text `json:"type,required"`
+ paramObj
+}
+
+func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image content part for OpenAI-compatible chat completion messages.
+//
+// The properties ImageURL, Type are required.
+type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam struct {
+ // Image URL specification and processing details
+ ImageURL InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
+ // Must be "image_url" to identify this as image content
+ //
+ // This field can be elided, and will marshal its zero value as "image_url".
+ Type constant.ImageURL `json:"type,required"`
+ paramObj
+}
+
+func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image URL specification and processing details
+//
+// The property URL is required.
+type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL struct {
+ // URL of the image to include in the message
+ URL string `json:"url,required"`
+ // (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
+ Detail param.Opt[string] `json:"detail,omitzero"`
+ paramObj
+}
+
+func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Response from a reranking request.
+type InferenceRerankResponseEnvelope struct {
+ // List of rerank result objects, sorted by relevance score (descending)
+ Data []InferenceRerankResponse `json:"data,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 InferenceRerankResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *InferenceRerankResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/inference_test.go b/inference_test.go
index 74245b7..92a81cc 100644
--- a/inference_test.go
+++ b/inference_test.go
@@ -279,3 +279,33 @@ func TestInferenceEmbeddingsWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestInferenceRerankWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Inference.Rerank(context.TODO(), llamastackclient.InferenceRerankParams{
+ Items: []llamastackclient.InferenceRerankParamsItemUnion{{
+ OfString: llamastackclient.String("string"),
+ }},
+ Model: "model",
+ Query: llamastackclient.InferenceRerankParamsQueryUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ MaxNumResults: llamastackclient.Int(0),
+ })
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/model.go b/model.go
index ffe5fef..8e92752 100644
--- a/model.go
+++ b/model.go
@@ -26,6 +26,7 @@ import (
// the [NewModelService] method instead.
type ModelService struct {
Options []option.RequestOption
+ OpenAI ModelOpenAIService
}
// NewModelService generates a new service that applies the given options to each
@@ -34,6 +35,7 @@ type ModelService struct {
func NewModelService(opts ...option.RequestOption) (r ModelService) {
r = ModelService{}
r.Options = opts
+ r.OpenAI = NewModelOpenAIService(opts...)
return
}
diff --git a/modelopenai.go b/modelopenai.go
new file mode 100644
index 0000000..c35f871
--- /dev/null
+++ b/modelopenai.go
@@ -0,0 +1,86 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient
+
+import (
+ "context"
+ "net/http"
+ "slices"
+
+ "github.com/llamastack/llama-stack-client-go/internal/apijson"
+ "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
+ "github.com/llamastack/llama-stack-client-go/option"
+ "github.com/llamastack/llama-stack-client-go/packages/respjson"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
+)
+
+// ModelOpenAIService contains methods and other services that help with
+// interacting with the llama-stack-client 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 [NewModelOpenAIService] method instead.
+type ModelOpenAIService struct {
+ Options []option.RequestOption
+}
+
+// NewModelOpenAIService 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 NewModelOpenAIService(opts ...option.RequestOption) (r ModelOpenAIService) {
+ r = ModelOpenAIService{}
+ r.Options = opts
+ return
+}
+
+// List models using the OpenAI API.
+func (r *ModelOpenAIService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ModelOpenAIListResponse, err error) {
+ var env ModelOpenAIListResponseEnvelope
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/openai/v1/models"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Data
+ return
+}
+
+// A model from OpenAI.
+type ModelOpenAIListResponse struct {
+ ID string `json:"id,required"`
+ Created int64 `json:"created,required"`
+ Object constant.Model `json:"object,required"`
+ OwnedBy string `json:"owned_by,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Created respjson.Field
+ Object respjson.Field
+ OwnedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ModelOpenAIListResponse) RawJSON() string { return r.JSON.raw }
+func (r *ModelOpenAIListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ModelOpenAIListResponseEnvelope struct {
+ Data []ModelOpenAIListResponse `json:"data,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 ModelOpenAIListResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *ModelOpenAIListResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/modelopenai_test.go b/modelopenai_test.go
new file mode 100644
index 0000000..03bfd79
--- /dev/null
+++ b/modelopenai_test.go
@@ -0,0 +1,35 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/llamastack/llama-stack-client-go"
+ "github.com/llamastack/llama-stack-client-go/internal/testutil"
+ "github.com/llamastack/llama-stack-client-go/option"
+)
+
+func TestModelOpenAIList(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Models.OpenAI.List(context.TODO())
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/response.go b/response.go
index c2b6491..4e5999b 100644
--- a/response.go
+++ b/response.go
@@ -99,6 +99,18 @@ func (r *ResponseService) ListAutoPaging(ctx context.Context, query ResponseList
return pagination.NewOpenAICursorPageAutoPager(r.List(ctx, query, opts...))
}
+// Delete an OpenAI response by its ID.
+func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ...option.RequestOption) (res *ResponseDeleteResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if responseID == "" {
+ err = errors.New("missing required response_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/openai/v1/responses/%s", responseID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return
+}
+
// Complete OpenAI response object containing generation results and metadata.
type ResponseObject struct {
// Unique identifier for this response
@@ -6296,6 +6308,30 @@ func (r *ResponseListResponseError) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Response object confirming deletion of an OpenAI response.
+type ResponseDeleteResponse struct {
+ // Unique identifier of the deleted response
+ ID string `json:"id,required"`
+ // Deletion confirmation flag, always True
+ Deleted bool `json:"deleted,required"`
+ // Object type identifier, always "response"
+ Object constant.Response `json:"object,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Deleted respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseDeleteResponse) RawJSON() string { return r.JSON.raw }
+func (r *ResponseDeleteResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ResponseNewParams struct {
// Input message(s) to create the response.
Input ResponseNewParamsInputUnion `json:"input,omitzero,required"`
diff --git a/response_test.go b/response_test.go
index ea61345..829b38b 100644
--- a/response_test.go
+++ b/response_test.go
@@ -110,3 +110,24 @@ func TestResponseListWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestResponseDelete(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Responses.Delete(context.TODO(), "response_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/shield.go b/shield.go
index 2ce56f9..f50b7e3 100644
--- a/shield.go
+++ b/shield.go
@@ -62,6 +62,19 @@ func (r *ShieldService) List(ctx context.Context, opts ...option.RequestOption)
return
}
+// Unregister a shield.
+func (r *ShieldService) Delete(ctx context.Context, identifier string, opts ...option.RequestOption) (err error) {
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ if identifier == "" {
+ err = errors.New("missing required identifier parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/shields/%s", identifier)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
+ return
+}
+
// Register a shield.
func (r *ShieldService) Register(ctx context.Context, body ShieldRegisterParams, opts ...option.RequestOption) (res *Shield, err error) {
opts = slices.Concat(r.Options, opts)
diff --git a/shield_test.go b/shield_test.go
index 1201b74..7aadb27 100644
--- a/shield_test.go
+++ b/shield_test.go
@@ -55,6 +55,27 @@ func TestShieldList(t *testing.T) {
}
}
+func TestShieldDelete(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ err := client.Shields.Delete(context.TODO(), "identifier")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestShieldRegisterWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
From ceb15f300fdf9b7e1b2615c14c352878bcfc082b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 26 Sep 2025 02:23:18 +0000
Subject: [PATCH 15/33] fix: bugfix for setting JSON keys with special
characters
---
internal/apijson/encoder.go | 14 +++++++-------
internal/apijson/union.go | 4 ++--
packages/param/encoder.go | 7 ++++++-
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/internal/apijson/encoder.go b/internal/apijson/encoder.go
index 8358a2f..ab7a3c1 100644
--- a/internal/apijson/encoder.go
+++ b/internal/apijson/encoder.go
@@ -16,6 +16,10 @@ import (
var encoders sync.Map // map[encoderEntry]encoderFunc
+// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
+// special characters that sjson interprets as a path.
+var EscapeSJSONKey = strings.NewReplacer("\\", "\\\\", "|", "\\|", "#", "\\#", "@", "\\@", "*", "\\*", ".", "\\.", ":", "\\:", "?", "\\?").Replace
+
func Marshal(value any) ([]byte, error) {
e := &encoder{dateFormat: time.RFC3339}
return e.marshal(value)
@@ -270,7 +274,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc {
if encoded == nil {
continue
}
- json, err = sjson.SetRawBytes(json, ef.tag.name, encoded)
+ json, err = sjson.SetRawBytes(json, EscapeSJSONKey(ef.tag.name), encoded)
if err != nil {
return nil, err
}
@@ -348,7 +352,7 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error)
}
encodedKeyString = string(encodedKeyBytes)
}
- encodedKey := []byte(sjsonReplacer.Replace(encodedKeyString))
+ encodedKey := []byte(encodedKeyString)
pairs = append(pairs, mapPair{key: encodedKey, value: iter.Value()})
}
@@ -366,7 +370,7 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error)
if len(encodedValue) == 0 {
continue
}
- json, err = sjson.SetRawBytes(json, string(p.key), encodedValue)
+ json, err = sjson.SetRawBytes(json, EscapeSJSONKey(string(p.key)), encodedValue)
if err != nil {
return nil, err
}
@@ -386,7 +390,3 @@ func (e *encoder) newMapEncoder(_ reflect.Type) encoderFunc {
return json, nil
}
}
-
-// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
-// special characters that sjson interprets as a path.
-var sjsonReplacer *strings.Replacer = strings.NewReplacer(".", "\\.", ":", "\\:", "*", "\\*")
diff --git a/internal/apijson/union.go b/internal/apijson/union.go
index df51692..3222ae3 100644
--- a/internal/apijson/union.go
+++ b/internal/apijson/union.go
@@ -78,7 +78,7 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
return func(n gjson.Result, v reflect.Value, state *decoderState) error {
if discriminated && n.Type == gjson.JSON && len(unionEntry.discriminatorKey) != 0 {
- discriminator := n.Get(unionEntry.discriminatorKey).Value()
+ discriminator := n.Get(EscapeSJSONKey(unionEntry.discriminatorKey)).Value()
for _, decoder := range discriminatedDecoders {
if discriminator == decoder.discriminator {
inner := v.FieldByIndex(decoder.field.Index)
@@ -162,7 +162,7 @@ func (d *decoderBuilder) newUnionDecoder(t reflect.Type) decoderFunc {
}
if len(unionEntry.discriminatorKey) != 0 {
- discriminatorValue := n.Get(unionEntry.discriminatorKey).Value()
+ discriminatorValue := n.Get(EscapeSJSONKey(unionEntry.discriminatorKey)).Value()
if discriminatorValue == variant.DiscriminatorValue {
inner := reflect.New(variant.Type).Elem()
err := decoder(n, inner, state)
diff --git a/packages/param/encoder.go b/packages/param/encoder.go
index e403436..027f9bd 100644
--- a/packages/param/encoder.go
+++ b/packages/param/encoder.go
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"reflect"
+ "strings"
"time"
shimjson "github.com/llamastack/llama-stack-client-go/internal/encoding/json"
@@ -14,6 +15,10 @@ import (
// EncodedAsDate is not be stable and shouldn't be relied upon
type EncodedAsDate Opt[time.Time]
+// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
+// special characters that sjson interprets as a path.
+var EscapeSJSONKey = strings.NewReplacer("\\", "\\\\", "|", "\\|", "#", "\\#", "@", "\\@", "*", "\\*", ".", "\\.", ":", "\\:", "?", "\\?").Replace
+
type forceOmit int
func (m EncodedAsDate) MarshalJSON() ([]byte, error) {
@@ -52,7 +57,7 @@ func MarshalWithExtras[T ParamStruct, R any](f T, underlying any, extras map[str
}
continue
}
- bytes, err = sjson.SetBytes(bytes, k, v)
+ bytes, err = sjson.SetBytes(bytes, EscapeSJSONKey(k), v)
if err != nil {
return nil, err
}
From b8635d7781c593fc1fb4bda7311189428f5bc128 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 27 Sep 2025 20:32:24 +0000
Subject: [PATCH 16/33] feat(api): removing openai/v1
---
.stats.yml | 8 +-
README.md | 18 ++-
agent_test.go | 2 +
api.md | 68 +++++-----
chatcompletion.go | 8 +-
completion.go | 4 +-
embedding.go | 2 +-
file.go | 21 ++--
file_test.go | 6 +-
inference.go | 289 +------------------------------------------
inference_test.go | 168 +------------------------
model.go | 61 ++++++---
modelopenai.go | 2 +-
moderation.go | 2 +-
response.go | 10 +-
responseinputitem.go | 2 +-
shared.go | 51 +++++---
tool.go | 6 +
toolruntime.go | 10 ++
vectorstore.go | 12 +-
vectorstorefile.go | 12 +-
21 files changed, 191 insertions(+), 571 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index fa9edfc..e5bf0be 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 111
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
-openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
-config_hash: 0358112cc0f3d880b4d55debdbe1cfa3
+configured_endpoints: 107
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-1eddf141208c131ee4a64ef996f8f419b444f60450de6807a9f6bc711ed8b661.yml
+openapi_spec_hash: 94765c67ea99b1358169d41d810dd395
+config_hash: 7ec5a583f9c26b38993013bdfb0e7d46
diff --git a/README.md b/README.md
index 5d93ac3..78bf888 100644
--- a/README.md
+++ b/README.md
@@ -364,20 +364,26 @@ which can be used to wrap any `io.Reader` with the appropriate file name and con
// A file from the file system
file, err := os.Open("/path/to/file")
llamastackclient.FileNewParams{
- File: file,
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
+ ExpiresAfterSeconds: llamastackclient.Int(0),
+ File: file,
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
}
// A file from a string
llamastackclient.FileNewParams{
- File: strings.NewReader("my file contents"),
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
+ ExpiresAfterSeconds: llamastackclient.Int(0),
+ File: strings.NewReader("my file contents"),
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
}
// With a custom filename and contentType
llamastackclient.FileNewParams{
- File: llamastackclient.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
+ ExpiresAfterSeconds: llamastackclient.Int(0),
+ File: llamastackclient.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
}
```
diff --git a/agent_test.go b/agent_test.go
index 4d38d0e..7f85fec 100644
--- a/agent_test.go
+++ b/agent_test.go
@@ -44,6 +44,8 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
Default: llamastackclient.ToolDefParameterDefaultUnionParam{
OfBool: llamastackclient.Bool(true),
},
+ Items: map[string]interface{}{},
+ Title: llamastackclient.String("title"),
}},
}},
EnableSessionPersistence: llamastackclient.Bool(true),
diff --git a/api.md b/api.md
index 9188d71..7022b86 100644
--- a/api.md
+++ b/api.md
@@ -19,7 +19,6 @@
# Shared Response Types
- llamastackclient.AgentConfig
-- llamastackclient.BatchCompletion
- llamastackclient.ChatCompletionResponse
- llamastackclient.CompletionMessage
- llamastackclient.ContentDeltaUnion
@@ -95,10 +94,10 @@ Response Types:
Methods:
-- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseObject, error)
-- client.Responses.Get(ctx context.Context, responseID string) (llamastackclient.ResponseObject, error)
-- client.Responses.List(ctx context.Context, query llamastackclient.ResponseListParams) (pagination.OpenAICursorPage[llamastackclient.ResponseListResponse], error)
-- client.Responses.Delete(ctx context.Context, responseID string) (llamastackclient.ResponseDeleteResponse, error)
+- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseObject, error)
+- client.Responses.Get(ctx context.Context, responseID string) (llamastackclient.ResponseObject, error)
+- client.Responses.List(ctx context.Context, query llamastackclient.ResponseListParams) (pagination.OpenAICursorPage[llamastackclient.ResponseListResponse], error)
+- client.Responses.Delete(ctx context.Context, responseID string) (llamastackclient.ResponseDeleteResponse, error)
## InputItems
@@ -108,7 +107,7 @@ Response Types:
Methods:
-- client.Responses.InputItems.List(ctx context.Context, responseID string, query llamastackclient.ResponseInputItemListParams) (llamastackclient.ResponseInputItemListResponse, error)
+- client.Responses.InputItems.List(ctx context.Context, responseID string, query llamastackclient.ResponseInputItemListParams) (llamastackclient.ResponseInputItemListResponse, error)
# Agents
@@ -238,18 +237,13 @@ Methods:
Response Types:
- llamastackclient.ChatCompletionResponseStreamChunk
-- llamastackclient.CompletionResponse
- llamastackclient.EmbeddingsResponse
- llamastackclient.TokenLogProbs
-- llamastackclient.InferenceBatchChatCompletionResponse
- llamastackclient.InferenceRerankResponse
Methods:
-- client.Inference.BatchChatCompletion(ctx context.Context, body llamastackclient.InferenceBatchChatCompletionParams) (llamastackclient.InferenceBatchChatCompletionResponse, error)
-- client.Inference.BatchCompletion(ctx context.Context, body llamastackclient.InferenceBatchCompletionParams) (llamastackclient.BatchCompletion, error)
- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (llamastackclient.ChatCompletionResponse, error)
-- client.Inference.Completion(ctx context.Context, body llamastackclient.InferenceCompletionParams) (llamastackclient.CompletionResponse, error)
- client.Inference.Embeddings(ctx context.Context, body llamastackclient.InferenceEmbeddingsParams) (llamastackclient.EmbeddingsResponse, error)
- client.Inference.Rerank(ctx context.Context, body llamastackclient.InferenceRerankParams) ([]llamastackclient.InferenceRerankResponse, error)
@@ -261,7 +255,7 @@ Response Types:
Methods:
-- client.Embeddings.New(ctx context.Context, body llamastackclient.EmbeddingNewParams) (llamastackclient.CreateEmbeddingsResponse, error)
+- client.Embeddings.New(ctx context.Context, body llamastackclient.EmbeddingNewParams) (llamastackclient.CreateEmbeddingsResponse, error)
# Chat
@@ -279,9 +273,9 @@ Response Types:
Methods:
-- client.Chat.Completions.New(ctx context.Context, body llamastackclient.ChatCompletionNewParams) (llamastackclient.ChatCompletionNewResponseUnion, error)
-- client.Chat.Completions.Get(ctx context.Context, completionID string) (llamastackclient.ChatCompletionGetResponse, error)
-- client.Chat.Completions.List(ctx context.Context, query llamastackclient.ChatCompletionListParams) (pagination.OpenAICursorPage[llamastackclient.ChatCompletionListResponse], error)
+- client.Chat.Completions.New(ctx context.Context, body llamastackclient.ChatCompletionNewParams) (llamastackclient.ChatCompletionNewResponseUnion, error)
+- client.Chat.Completions.Get(ctx context.Context, completionID string) (llamastackclient.ChatCompletionGetResponse, error)
+- client.Chat.Completions.List(ctx context.Context, query llamastackclient.ChatCompletionListParams) (pagination.OpenAICursorPage[llamastackclient.ChatCompletionListResponse], error)
# Completions
@@ -291,7 +285,7 @@ Response Types:
Methods:
-- client.Completions.New(ctx context.Context, body llamastackclient.CompletionNewParams) (llamastackclient.CompletionNewResponse, error)
+- client.Completions.New(ctx context.Context, body llamastackclient.CompletionNewParams) (llamastackclient.CompletionNewResponse, error)
# VectorIo
@@ -330,12 +324,12 @@ Response Types:
Methods:
-- client.VectorStores.New(ctx context.Context, body llamastackclient.VectorStoreNewParams) (llamastackclient.VectorStore, error)
-- client.VectorStores.Get(ctx context.Context, vectorStoreID string) (llamastackclient.VectorStore, error)
-- client.VectorStores.Update(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreUpdateParams) (llamastackclient.VectorStore, error)
-- client.VectorStores.List(ctx context.Context, query llamastackclient.VectorStoreListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStore], error)
-- client.VectorStores.Delete(ctx context.Context, vectorStoreID string) (llamastackclient.VectorStoreDeleteResponse, error)
-- client.VectorStores.Search(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreSearchParams) (llamastackclient.VectorStoreSearchResponse, error)
+- client.VectorStores.New(ctx context.Context, body llamastackclient.VectorStoreNewParams) (llamastackclient.VectorStore, error)
+- client.VectorStores.Get(ctx context.Context, vectorStoreID string) (llamastackclient.VectorStore, error)
+- client.VectorStores.Update(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreUpdateParams) (llamastackclient.VectorStore, error)
+- client.VectorStores.List(ctx context.Context, query llamastackclient.VectorStoreListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStore], error)
+- client.VectorStores.Delete(ctx context.Context, vectorStoreID string) (llamastackclient.VectorStoreDeleteResponse, error)
+- client.VectorStores.Search(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreSearchParams) (llamastackclient.VectorStoreSearchResponse, error)
## Files
@@ -347,24 +341,24 @@ Response Types:
Methods:
-- client.VectorStores.Files.New(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreFileNewParams) (llamastackclient.VectorStoreFile, error)
-- client.VectorStores.Files.Get(ctx context.Context, fileID string, query llamastackclient.VectorStoreFileGetParams) (llamastackclient.VectorStoreFile, error)
-- client.VectorStores.Files.Update(ctx context.Context, fileID string, params llamastackclient.VectorStoreFileUpdateParams) (llamastackclient.VectorStoreFile, error)
-- client.VectorStores.Files.List(ctx context.Context, vectorStoreID string, query llamastackclient.VectorStoreFileListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
-- client.VectorStores.Files.Delete(ctx context.Context, fileID string, body llamastackclient.VectorStoreFileDeleteParams) (llamastackclient.VectorStoreFileDeleteResponse, error)
-- client.VectorStores.Files.Content(ctx context.Context, fileID string, query llamastackclient.VectorStoreFileContentParams) (llamastackclient.VectorStoreFileContentResponse, error)
+- client.VectorStores.Files.New(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreFileNewParams) (llamastackclient.VectorStoreFile, error)
+- client.VectorStores.Files.Get(ctx context.Context, fileID string, query llamastackclient.VectorStoreFileGetParams) (llamastackclient.VectorStoreFile, error)
+- client.VectorStores.Files.Update(ctx context.Context, fileID string, params llamastackclient.VectorStoreFileUpdateParams) (llamastackclient.VectorStoreFile, error)
+- client.VectorStores.Files.List(ctx context.Context, vectorStoreID string, query llamastackclient.VectorStoreFileListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
+- client.VectorStores.Files.Delete(ctx context.Context, fileID string, body llamastackclient.VectorStoreFileDeleteParams) (llamastackclient.VectorStoreFileDeleteResponse, error)
+- client.VectorStores.Files.Content(ctx context.Context, fileID string, query llamastackclient.VectorStoreFileContentParams) (llamastackclient.VectorStoreFileContentResponse, error)
# Models
Response Types:
-- llamastackclient.ListModelsResponse
- llamastackclient.Model
+- llamastackclient.ModelListResponse
Methods:
- client.Models.Get(ctx context.Context, modelID string) (llamastackclient.Model, error)
-- client.Models.List(ctx context.Context) ([]llamastackclient.Model, error)
+- client.Models.List(ctx context.Context) ([]llamastackclient.ModelListResponse, error)
- client.Models.Register(ctx context.Context, body llamastackclient.ModelRegisterParams) (llamastackclient.Model, error)
- client.Models.Unregister(ctx context.Context, modelID string) error
@@ -376,7 +370,7 @@ Response Types:
Methods:
-- client.Models.OpenAI.List(ctx context.Context) ([]llamastackclient.ModelOpenAIListResponse, error)
+- client.Models.OpenAI.List(ctx context.Context) ([]llamastackclient.ModelOpenAIListResponse, error)
# PostTraining
@@ -437,7 +431,7 @@ Response Types:
Methods:
-- client.Moderations.New(ctx context.Context, body llamastackclient.ModerationNewParams) (llamastackclient.CreateResponse, error)
+- client.Moderations.New(ctx context.Context, body llamastackclient.ModerationNewParams) (llamastackclient.CreateResponse, error)
# Safety
@@ -554,8 +548,8 @@ Response Types:
Methods:
-- client.Files.New(ctx context.Context, body llamastackclient.FileNewParams) (llamastackclient.File, error)
-- client.Files.Get(ctx context.Context, fileID string) (llamastackclient.File, error)
-- client.Files.List(ctx context.Context, query llamastackclient.FileListParams) (pagination.OpenAICursorPage[llamastackclient.File], error)
-- client.Files.Delete(ctx context.Context, fileID string) (llamastackclient.DeleteFileResponse, error)
-- client.Files.Content(ctx context.Context, fileID string) (llamastackclient.FileContentResponse, error)
+- client.Files.New(ctx context.Context, body llamastackclient.FileNewParams) (llamastackclient.File, error)
+- client.Files.Get(ctx context.Context, fileID string) (llamastackclient.File, error)
+- client.Files.List(ctx context.Context, query llamastackclient.FileListParams) (pagination.OpenAICursorPage[llamastackclient.File], error)
+- client.Files.Delete(ctx context.Context, fileID string) (llamastackclient.DeleteFileResponse, error)
+- client.Files.Content(ctx context.Context, fileID string) (llamastackclient.FileContentResponse, error)
diff --git a/chatcompletion.go b/chatcompletion.go
index ec13e29..d882370 100644
--- a/chatcompletion.go
+++ b/chatcompletion.go
@@ -45,7 +45,7 @@ func NewChatCompletionService(opts ...option.RequestOption) (r ChatCompletionSer
// specified model.
func (r *ChatCompletionService) New(ctx context.Context, body ChatCompletionNewParams, opts ...option.RequestOption) (res *ChatCompletionNewResponseUnion, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/chat/completions"
+ path := "v1/chat/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -59,7 +59,7 @@ func (r *ChatCompletionService) NewStreaming(ctx context.Context, body ChatCompl
)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- path := "v1/openai/v1/chat/completions"
+ path := "v1/chat/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
return ssestream.NewStream[ChatCompletionChunk](ssestream.NewDecoder(raw), err)
}
@@ -71,7 +71,7 @@ func (r *ChatCompletionService) Get(ctx context.Context, completionID string, op
err = errors.New("missing required completion_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/chat/completions/%s", completionID)
+ path := fmt.Sprintf("v1/chat/completions/%s", completionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -81,7 +81,7 @@ func (r *ChatCompletionService) List(ctx context.Context, query ChatCompletionLi
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
- path := "v1/openai/v1/chat/completions"
+ path := "v1/chat/completions"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
diff --git a/completion.go b/completion.go
index 41d3c3a..fc824a0 100644
--- a/completion.go
+++ b/completion.go
@@ -39,7 +39,7 @@ func NewCompletionService(opts ...option.RequestOption) (r CompletionService) {
// specified model.
func (r *CompletionService) New(ctx context.Context, body CompletionNewParams, opts ...option.RequestOption) (res *CompletionNewResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/completions"
+ path := "v1/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -53,7 +53,7 @@ func (r *CompletionService) NewStreaming(ctx context.Context, body CompletionNew
)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- path := "v1/openai/v1/completions"
+ path := "v1/completions"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
return ssestream.NewStream[CompletionNewResponse](ssestream.NewDecoder(raw), err)
}
diff --git a/embedding.go b/embedding.go
index c366f00..889a7c4 100644
--- a/embedding.go
+++ b/embedding.go
@@ -39,7 +39,7 @@ func NewEmbeddingService(opts ...option.RequestOption) (r EmbeddingService) {
// model.
func (r *EmbeddingService) New(ctx context.Context, body EmbeddingNewParams, opts ...option.RequestOption) (res *CreateEmbeddingsResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/embeddings"
+ path := "v1/embeddings"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
diff --git a/file.go b/file.go
index f7166ab..2b0bac4 100644
--- a/file.go
+++ b/file.go
@@ -46,11 +46,14 @@ func NewFileService(opts ...option.RequestOption) (r FileService) {
// Upload a file that can be used across various endpoints. The file upload should
// be a multipart form request with:
//
-// - file: The File object (not file name) to be uploaded.
-// - purpose: The intended purpose of the uploaded file.
+// - file: The File object (not file name) to be uploaded.
+// - purpose: The intended purpose of the uploaded file.
+// - expires_after: Optional form values describing expiration for the file.
+// Expected expires_after[anchor] = "created_at", expires_after[seconds] =
+// {integer}. Seconds must be between 3600 and 2592000 (1 hour to 30 days).
func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...option.RequestOption) (res *File, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/files"
+ path := "v1/files"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -62,7 +65,7 @@ func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.Req
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/files/%s", fileID)
+ path := fmt.Sprintf("v1/files/%s", fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -72,7 +75,7 @@ func (r *FileService) List(ctx context.Context, query FileListParams, opts ...op
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
- path := "v1/openai/v1/files"
+ path := "v1/files"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -97,7 +100,7 @@ func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/files/%s", fileID)
+ path := fmt.Sprintf("v1/files/%s", fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return
}
@@ -109,7 +112,7 @@ func (r *FileService) Content(ctx context.Context, fileID string, opts ...option
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/files/%s/content", fileID)
+ path := fmt.Sprintf("v1/files/%s/content", fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -217,7 +220,9 @@ func (r *ListFilesResponse) UnmarshalJSON(data []byte) error {
type FileContentResponse = any
type FileNewParams struct {
- File io.Reader `json:"file,omitzero,required" format:"binary"`
+ ExpiresAfterAnchor param.Opt[string] `json:"expires_after_anchor,omitzero,required"`
+ ExpiresAfterSeconds param.Opt[int64] `json:"expires_after_seconds,omitzero,required"`
+ File io.Reader `json:"file,omitzero,required" format:"binary"`
// Valid purpose values for OpenAI Files API.
//
// Any of "assistants", "batch".
diff --git a/file_test.go b/file_test.go
index 8f6b65c..9239b0d 100644
--- a/file_test.go
+++ b/file_test.go
@@ -27,8 +27,10 @@ func TestFileNew(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Files.New(context.TODO(), llamastackclient.FileNewParams{
- File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
+ ExpiresAfterSeconds: llamastackclient.Int(0),
+ File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/inference.go b/inference.go
index 7b928ad..aa2042e 100644
--- a/inference.go
+++ b/inference.go
@@ -35,26 +35,10 @@ func NewInferenceService(opts ...option.RequestOption) (r InferenceService) {
return
}
-// Generate chat completions for a batch of messages using the specified model.
-func (r *InferenceService) BatchChatCompletion(ctx context.Context, body InferenceBatchChatCompletionParams, opts ...option.RequestOption) (res *InferenceBatchChatCompletionResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- path := "v1/inference/batch-chat-completion"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
-// Generate completions for a batch of content using the specified model.
-func (r *InferenceService) BatchCompletion(ctx context.Context, body InferenceBatchCompletionParams, opts ...option.RequestOption) (res *BatchCompletion, err error) {
- opts = slices.Concat(r.Options, opts)
- path := "v1/inference/batch-completion"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
// Generate a chat completion for the given messages using the specified model.
//
// Deprecated: /v1/inference/chat-completion is deprecated. Please use
-// /v1/openai/v1/chat/completions.
+// /v1/chat/completions.
func (r *InferenceService) ChatCompletion(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (res *ChatCompletionResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/inference/chat-completion"
@@ -65,7 +49,7 @@ func (r *InferenceService) ChatCompletion(ctx context.Context, body InferenceCha
// Generate a chat completion for the given messages using the specified model.
//
// Deprecated: /v1/inference/chat-completion is deprecated. Please use
-// /v1/openai/v1/chat/completions.
+// /v1/chat/completions.
func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (stream *ssestream.Stream[ChatCompletionResponseStreamChunk]) {
var (
raw *http.Response
@@ -78,37 +62,9 @@ func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body Inf
return ssestream.NewStream[ChatCompletionResponseStreamChunk](ssestream.NewDecoder(raw), err)
}
-// Generate a completion for the given content using the specified model.
-//
-// Deprecated: /v1/inference/completion is deprecated. Please use
-// /v1/openai/v1/completions.
-func (r *InferenceService) Completion(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (res *CompletionResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- path := "v1/inference/completion"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
-// Generate a completion for the given content using the specified model.
-//
-// Deprecated: /v1/inference/completion is deprecated. Please use
-// /v1/openai/v1/completions.
-func (r *InferenceService) CompletionStreaming(ctx context.Context, body InferenceCompletionParams, opts ...option.RequestOption) (stream *ssestream.Stream[CompletionResponse]) {
- var (
- raw *http.Response
- err error
- )
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- path := "v1/inference/completion"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
- return ssestream.NewStream[CompletionResponse](ssestream.NewDecoder(raw), err)
-}
-
// Generate embeddings for content pieces using the specified model.
//
-// Deprecated: /v1/inference/embeddings is deprecated. Please use
-// /v1/openai/v1/embeddings.
+// Deprecated: /v1/inference/embeddings is deprecated. Please use /v1/embeddings.
func (r *InferenceService) Embeddings(ctx context.Context, body InferenceEmbeddingsParams, opts ...option.RequestOption) (res *EmbeddingsResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/inference/embeddings"
@@ -182,44 +138,6 @@ func (r *ChatCompletionResponseStreamChunkEvent) UnmarshalJSON(data []byte) erro
return apijson.UnmarshalRoot(data, r)
}
-// Response from a completion request.
-type CompletionResponse struct {
- // The generated completion text
- Content string `json:"content,required"`
- // Reason why generation stopped
- //
- // Any of "end_of_turn", "end_of_message", "out_of_tokens".
- StopReason CompletionResponseStopReason `json:"stop_reason,required"`
- // Optional log probabilities for generated tokens
- Logprobs []TokenLogProbs `json:"logprobs"`
- // (Optional) List of metrics associated with the API response
- Metrics []Metric `json:"metrics"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Content respjson.Field
- StopReason respjson.Field
- Logprobs respjson.Field
- Metrics respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r CompletionResponse) RawJSON() string { return r.JSON.raw }
-func (r *CompletionResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Reason why generation stopped
-type CompletionResponseStopReason string
-
-const (
- CompletionResponseStopReasonEndOfTurn CompletionResponseStopReason = "end_of_turn"
- CompletionResponseStopReasonEndOfMessage CompletionResponseStopReason = "end_of_message"
- CompletionResponseStopReasonOutOfTokens CompletionResponseStopReason = "out_of_tokens"
-)
-
// Response containing generated embeddings.
type EmbeddingsResponse struct {
// List of embedding vectors, one per input content. Each embedding is a list of
@@ -258,24 +176,6 @@ func (r *TokenLogProbs) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Response from a batch chat completion request.
-type InferenceBatchChatCompletionResponse struct {
- // List of chat completion responses, one for each conversation in the batch
- Batch []ChatCompletionResponse `json:"batch,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Batch respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r InferenceBatchChatCompletionResponse) RawJSON() string { return r.JSON.raw }
-func (r *InferenceBatchChatCompletionResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A single rerank result from a reranking response.
type InferenceRerankResponse struct {
// The original index of the document in the input list
@@ -298,149 +198,6 @@ func (r *InferenceRerankResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type InferenceBatchChatCompletionParams struct {
- // The messages to generate completions for.
- MessagesBatch [][]MessageUnionParam `json:"messages_batch,omitzero,required"`
- // The identifier of the model to use. The model must be registered with Llama
- // Stack and available via the /models endpoint.
- ModelID string `json:"model_id,required"`
- // (Optional) If specified, log probabilities for each token position will be
- // returned.
- Logprobs InferenceBatchChatCompletionParamsLogprobs `json:"logprobs,omitzero"`
- // (Optional) Grammar specification for guided (structured) decoding.
- ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
- // (Optional) Parameters to control the sampling strategy.
- SamplingParams SamplingParams `json:"sampling_params,omitzero"`
- // (Optional) Configuration for tool use.
- ToolConfig InferenceBatchChatCompletionParamsToolConfig `json:"tool_config,omitzero"`
- // (Optional) List of tool definitions available to the model.
- Tools []InferenceBatchChatCompletionParamsTool `json:"tools,omitzero"`
- paramObj
-}
-
-func (r InferenceBatchChatCompletionParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceBatchChatCompletionParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceBatchChatCompletionParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// (Optional) If specified, log probabilities for each token position will be
-// returned.
-type InferenceBatchChatCompletionParamsLogprobs struct {
- // How many tokens (for each position) to return log probabilities for.
- TopK param.Opt[int64] `json:"top_k,omitzero"`
- paramObj
-}
-
-func (r InferenceBatchChatCompletionParamsLogprobs) MarshalJSON() (data []byte, err error) {
- type shadow InferenceBatchChatCompletionParamsLogprobs
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceBatchChatCompletionParamsLogprobs) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// (Optional) Configuration for tool use.
-type InferenceBatchChatCompletionParamsToolConfig struct {
- // (Optional) Config for how to override the default system prompt. -
- // `SystemMessageBehavior.append`: Appends the provided system message to the
- // default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
- // system prompt with the provided system message. The system message can include
- // the string '{{function_definitions}}' to indicate where the function definitions
- // should be inserted.
- //
- // Any of "append", "replace".
- SystemMessageBehavior string `json:"system_message_behavior,omitzero"`
- // (Optional) Whether tool use is automatic, required, or none. Can also specify a
- // tool name to use a specific tool. Defaults to ToolChoice.auto.
- ToolChoice string `json:"tool_choice,omitzero"`
- // (Optional) Instructs the model how to format tool calls. By default, Llama Stack
- // will attempt to use a format that is best adapted to the model. -
- // `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
- // `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
- // tag. - `ToolPromptFormat.python_list`: The tool calls
- // are output as Python syntax -- a list of function calls.
- //
- // Any of "json", "function_tag", "python_list".
- ToolPromptFormat string `json:"tool_prompt_format,omitzero"`
- paramObj
-}
-
-func (r InferenceBatchChatCompletionParamsToolConfig) MarshalJSON() (data []byte, err error) {
- type shadow InferenceBatchChatCompletionParamsToolConfig
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceBatchChatCompletionParamsToolConfig) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func init() {
- apijson.RegisterFieldValidator[InferenceBatchChatCompletionParamsToolConfig](
- "system_message_behavior", "append", "replace",
- )
- apijson.RegisterFieldValidator[InferenceBatchChatCompletionParamsToolConfig](
- "tool_prompt_format", "json", "function_tag", "python_list",
- )
-}
-
-// The property ToolName is required.
-type InferenceBatchChatCompletionParamsTool struct {
- ToolName string `json:"tool_name,omitzero,required"`
- Description param.Opt[string] `json:"description,omitzero"`
- Parameters map[string]ToolParamDefinition `json:"parameters,omitzero"`
- paramObj
-}
-
-func (r InferenceBatchChatCompletionParamsTool) MarshalJSON() (data []byte, err error) {
- type shadow InferenceBatchChatCompletionParamsTool
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceBatchChatCompletionParamsTool) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type InferenceBatchCompletionParams struct {
- // The content to generate completions for.
- ContentBatch []InterleavedContentUnionParam `json:"content_batch,omitzero,required"`
- // The identifier of the model to use. The model must be registered with Llama
- // Stack and available via the /models endpoint.
- ModelID string `json:"model_id,required"`
- // (Optional) If specified, log probabilities for each token position will be
- // returned.
- Logprobs InferenceBatchCompletionParamsLogprobs `json:"logprobs,omitzero"`
- // (Optional) Grammar specification for guided (structured) decoding.
- ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
- // (Optional) Parameters to control the sampling strategy.
- SamplingParams SamplingParams `json:"sampling_params,omitzero"`
- paramObj
-}
-
-func (r InferenceBatchCompletionParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceBatchCompletionParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceBatchCompletionParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// (Optional) If specified, log probabilities for each token position will be
-// returned.
-type InferenceBatchCompletionParamsLogprobs struct {
- // How many tokens (for each position) to return log probabilities for.
- TopK param.Opt[int64] `json:"top_k,omitzero"`
- paramObj
-}
-
-func (r InferenceBatchCompletionParamsLogprobs) MarshalJSON() (data []byte, err error) {
- type shadow InferenceBatchCompletionParamsLogprobs
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceBatchCompletionParamsLogprobs) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type InferenceChatCompletionParams struct {
// List of messages in the conversation.
Messages []MessageUnionParam `json:"messages,omitzero,required"`
@@ -587,46 +344,6 @@ func (r *InferenceChatCompletionParamsTool) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type InferenceCompletionParams struct {
- // The content to generate a completion for.
- Content InterleavedContentUnionParam `json:"content,omitzero,required"`
- // The identifier of the model to use. The model must be registered with Llama
- // Stack and available via the /models endpoint.
- ModelID string `json:"model_id,required"`
- // (Optional) If specified, log probabilities for each token position will be
- // returned.
- Logprobs InferenceCompletionParamsLogprobs `json:"logprobs,omitzero"`
- // (Optional) Grammar specification for guided (structured) decoding.
- ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
- // (Optional) Parameters to control the sampling strategy.
- SamplingParams SamplingParams `json:"sampling_params,omitzero"`
- paramObj
-}
-
-func (r InferenceCompletionParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceCompletionParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceCompletionParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// (Optional) If specified, log probabilities for each token position will be
-// returned.
-type InferenceCompletionParamsLogprobs struct {
- // How many tokens (for each position) to return log probabilities for.
- TopK param.Opt[int64] `json:"top_k,omitzero"`
- paramObj
-}
-
-func (r InferenceCompletionParamsLogprobs) MarshalJSON() (data []byte, err error) {
- type shadow InferenceCompletionParamsLogprobs
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceCompletionParamsLogprobs) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type InferenceEmbeddingsParams struct {
// List of contents to generate embeddings for. Each content can be a string or an
// InterleavedContentItem (and hence can be multimodal). The behavior depends on
diff --git a/inference_test.go b/inference_test.go
index 92a81cc..9a33db4 100644
--- a/inference_test.go
+++ b/inference_test.go
@@ -13,124 +13,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestInferenceBatchChatCompletionWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Inference.BatchChatCompletion(context.TODO(), llamastackclient.InferenceBatchChatCompletionParams{
- MessagesBatch: [][]llamastackclient.MessageUnionParam{{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- Context: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }}},
- ModelID: "model_id",
- Logprobs: llamastackclient.InferenceBatchChatCompletionParamsLogprobs{
- TopK: llamastackclient.Int(0),
- },
- ResponseFormat: llamastackclient.ResponseFormatUnionParam{
- OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
- },
- },
- SamplingParams: llamastackclient.SamplingParams{
- Strategy: llamastackclient.SamplingParamsStrategyUnion{
- OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
- },
- MaxTokens: llamastackclient.Int(0),
- RepetitionPenalty: llamastackclient.Float(0),
- Stop: []string{"string"},
- },
- ToolConfig: llamastackclient.InferenceBatchChatCompletionParamsToolConfig{
- SystemMessageBehavior: "append",
- ToolChoice: "auto",
- ToolPromptFormat: "json",
- },
- Tools: []llamastackclient.InferenceBatchChatCompletionParamsTool{{
- ToolName: "brave_search",
- Description: llamastackclient.String("description"),
- Parameters: map[string]llamastackclient.ToolParamDefinition{
- "foo": {
- ParamType: "param_type",
- Default: llamastackclient.ToolParamDefinitionDefaultUnion{
- OfBool: llamastackclient.Bool(true),
- },
- Description: llamastackclient.String("description"),
- Required: llamastackclient.Bool(true),
- },
- },
- }},
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestInferenceBatchCompletionWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Inference.BatchCompletion(context.TODO(), llamastackclient.InferenceBatchCompletionParams{
- ContentBatch: []llamastackclient.InterleavedContentUnionParam{{
- OfString: llamastackclient.String("string"),
- }},
- ModelID: "model_id",
- Logprobs: llamastackclient.InferenceBatchCompletionParamsLogprobs{
- TopK: llamastackclient.Int(0),
- },
- ResponseFormat: llamastackclient.ResponseFormatUnionParam{
- OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
- },
- },
- SamplingParams: llamastackclient.SamplingParams{
- Strategy: llamastackclient.SamplingParamsStrategyUnion{
- OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
- },
- MaxTokens: llamastackclient.Int(0),
- RepetitionPenalty: llamastackclient.Float(0),
- Stop: []string{"string"},
- },
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -191,56 +73,14 @@ func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
OfBool: llamastackclient.Bool(true),
},
Description: llamastackclient.String("description"),
- Required: llamastackclient.Bool(true),
- },
- },
- }},
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestInferenceCompletionWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Inference.Completion(context.TODO(), llamastackclient.InferenceCompletionParams{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- ModelID: "model_id",
- Logprobs: llamastackclient.InferenceCompletionParamsLogprobs{
- TopK: llamastackclient.Int(0),
- },
- ResponseFormat: llamastackclient.ResponseFormatUnionParam{
- OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
- "foo": {
+ Items: llamastackclient.ToolParamDefinitionItemsUnion{
OfBool: llamastackclient.Bool(true),
},
+ Required: llamastackclient.Bool(true),
+ Title: llamastackclient.String("title"),
},
},
- },
- SamplingParams: llamastackclient.SamplingParams{
- Strategy: llamastackclient.SamplingParamsStrategyUnion{
- OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
- },
- MaxTokens: llamastackclient.Int(0),
- RepetitionPenalty: llamastackclient.Float(0),
- Stop: []string{"string"},
- },
+ }},
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/model.go b/model.go
index 8e92752..404b8e6 100644
--- a/model.go
+++ b/model.go
@@ -51,9 +51,9 @@ func (r *ModelService) Get(ctx context.Context, modelID string, opts ...option.R
return
}
-// List all models.
-func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Model, err error) {
- var env ListModelsResponse
+// List models using the OpenAI API.
+func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ModelListResponse, err error) {
+ var env ModelListResponseEnvelope
opts = slices.Concat(r.Options, opts)
path := "v1/models"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
@@ -85,22 +85,6 @@ func (r *ModelService) Unregister(ctx context.Context, modelID string, opts ...o
return
}
-type ListModelsResponse struct {
- Data []Model `json:"data,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 ListModelsResponse) RawJSON() string { return r.JSON.raw }
-func (r *ListModelsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A model resource representing an AI model registered in Llama Stack.
type Model struct {
// Unique identifier for this resource in llama stack
@@ -196,6 +180,45 @@ const (
ModelModelTypeEmbedding ModelModelType = "embedding"
)
+// A model from OpenAI.
+type ModelListResponse struct {
+ ID string `json:"id,required"`
+ Created int64 `json:"created,required"`
+ Object constant.Model `json:"object,required"`
+ OwnedBy string `json:"owned_by,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Created respjson.Field
+ Object respjson.Field
+ OwnedBy respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ModelListResponse) RawJSON() string { return r.JSON.raw }
+func (r *ModelListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ModelListResponseEnvelope struct {
+ Data []ModelListResponse `json:"data,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 ModelListResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *ModelListResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ModelRegisterParams struct {
// The identifier of the model to register.
ModelID string `json:"model_id,required"`
diff --git a/modelopenai.go b/modelopenai.go
index c35f871..a373572 100644
--- a/modelopenai.go
+++ b/modelopenai.go
@@ -37,7 +37,7 @@ func NewModelOpenAIService(opts ...option.RequestOption) (r ModelOpenAIService)
func (r *ModelOpenAIService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ModelOpenAIListResponse, err error) {
var env ModelOpenAIListResponseEnvelope
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/models"
+ path := "v1/models"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
return
diff --git a/moderation.go b/moderation.go
index b81aa7a..eb7ddab 100644
--- a/moderation.go
+++ b/moderation.go
@@ -37,7 +37,7 @@ func NewModerationService(opts ...option.RequestOption) (r ModerationService) {
// Classifies if text and/or image inputs are potentially harmful.
func (r *ModerationService) New(ctx context.Context, body ModerationNewParams, opts ...option.RequestOption) (res *CreateResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/moderations"
+ path := "v1/moderations"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
diff --git a/response.go b/response.go
index 4e5999b..96492b3 100644
--- a/response.go
+++ b/response.go
@@ -46,7 +46,7 @@ func NewResponseService(opts ...option.RequestOption) (r ResponseService) {
// Create a new OpenAI response.
func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *ResponseObject, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/responses"
+ path := "v1/responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -59,7 +59,7 @@ func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewPara
)
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- path := "v1/openai/v1/responses"
+ path := "v1/responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
return ssestream.NewStream[ResponseObjectStreamUnion](ssestream.NewDecoder(raw), err)
}
@@ -71,7 +71,7 @@ func (r *ResponseService) Get(ctx context.Context, responseID string, opts ...op
err = errors.New("missing required response_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/responses/%s", responseID)
+ path := fmt.Sprintf("v1/responses/%s", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -81,7 +81,7 @@ func (r *ResponseService) List(ctx context.Context, query ResponseListParams, op
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
- path := "v1/openai/v1/responses"
+ path := "v1/responses"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -106,7 +106,7 @@ func (r *ResponseService) Delete(ctx context.Context, responseID string, opts ..
err = errors.New("missing required response_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/responses/%s", responseID)
+ path := fmt.Sprintf("v1/responses/%s", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return
}
diff --git a/responseinputitem.go b/responseinputitem.go
index 5e83419..b708ae3 100644
--- a/responseinputitem.go
+++ b/responseinputitem.go
@@ -46,7 +46,7 @@ func (r *ResponseInputItemService) List(ctx context.Context, responseID string,
err = errors.New("missing required response_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/responses/%s/input_items", responseID)
+ path := fmt.Sprintf("v1/responses/%s/input_items", responseID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
diff --git a/shared.go b/shared.go
index f588447..88847bc 100644
--- a/shared.go
+++ b/shared.go
@@ -418,24 +418,6 @@ func (u *AgentConfigToolgroupAgentToolGroupWithArgsArgUnionParam) asAny() any {
return nil
}
-// Response from a batch completion request.
-type BatchCompletion struct {
- // List of completion responses, one for each input in the batch
- Batch []CompletionResponse `json:"batch,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Batch respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r BatchCompletion) RawJSON() string { return r.JSON.raw }
-func (r *BatchCompletion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// Response from a chat completion request.
type ChatCompletionResponse struct {
// The complete response message
@@ -3469,7 +3451,9 @@ type ToolParamDefinition struct {
ParamType string `json:"param_type,required"`
Description param.Opt[string] `json:"description,omitzero"`
Required param.Opt[bool] `json:"required,omitzero"`
+ Title param.Opt[string] `json:"title,omitzero"`
Default ToolParamDefinitionDefaultUnion `json:"default,omitzero"`
+ Items ToolParamDefinitionItemsUnion `json:"items,omitzero"`
paramObj
}
@@ -3512,6 +3496,37 @@ func (u *ToolParamDefinitionDefaultUnion) asAny() any {
return nil
}
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ToolParamDefinitionItemsUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ToolParamDefinitionItemsUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ToolParamDefinitionItemsUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ToolParamDefinitionItemsUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
// A message representing the result of a tool invocation.
type ToolResponseMessage struct {
// Unique identifier for the tool call this response is for
diff --git a/tool.go b/tool.go
index fabc9f6..adc6ac2 100644
--- a/tool.go
+++ b/tool.go
@@ -130,6 +130,10 @@ type ToolParameter struct {
Required bool `json:"required,required"`
// (Optional) Default value for the parameter if not provided
Default ToolParameterDefaultUnion `json:"default,nullable"`
+ // Type of the elements when parameter_type is array
+ Items any `json:"items"`
+ // (Optional) Title of the parameter
+ Title string `json:"title"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
@@ -137,6 +141,8 @@ type ToolParameter struct {
ParameterType respjson.Field
Required respjson.Field
Default respjson.Field
+ Items respjson.Field
+ Title respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
diff --git a/toolruntime.go b/toolruntime.go
index 7b09134..4336c9d 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -159,6 +159,10 @@ type ToolDefParameter struct {
Required bool `json:"required,required"`
// (Optional) Default value for the parameter if not provided
Default ToolDefParameterDefaultUnion `json:"default,nullable"`
+ // Type of the elements when parameter_type is array
+ Items any `json:"items"`
+ // (Optional) Title of the parameter
+ Title string `json:"title"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
@@ -166,6 +170,8 @@ type ToolDefParameter struct {
ParameterType respjson.Field
Required respjson.Field
Default respjson.Field
+ Items respjson.Field
+ Title respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -295,8 +301,12 @@ type ToolDefParameterParam struct {
ParameterType string `json:"parameter_type,required"`
// Whether this parameter is required for tool invocation
Required bool `json:"required,required"`
+ // (Optional) Title of the parameter
+ Title param.Opt[string] `json:"title,omitzero"`
// (Optional) Default value for the parameter if not provided
Default ToolDefParameterDefaultUnionParam `json:"default,omitzero"`
+ // Type of the elements when parameter_type is array
+ Items any `json:"items,omitzero"`
paramObj
}
diff --git a/vectorstore.go b/vectorstore.go
index 0a5042a..47cf622 100644
--- a/vectorstore.go
+++ b/vectorstore.go
@@ -45,7 +45,7 @@ func NewVectorStoreService(opts ...option.RequestOption) (r VectorStoreService)
// Creates a vector store.
func (r *VectorStoreService) New(ctx context.Context, body VectorStoreNewParams, opts ...option.RequestOption) (res *VectorStore, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/openai/v1/vector_stores"
+ path := "v1/vector_stores"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -57,7 +57,7 @@ func (r *VectorStoreService) Get(ctx context.Context, vectorStoreID string, opts
err = errors.New("missing required vector_store_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s", vectorStoreID)
+ path := fmt.Sprintf("v1/vector_stores/%s", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -69,7 +69,7 @@ func (r *VectorStoreService) Update(ctx context.Context, vectorStoreID string, b
err = errors.New("missing required vector_store_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s", vectorStoreID)
+ path := fmt.Sprintf("v1/vector_stores/%s", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -79,7 +79,7 @@ func (r *VectorStoreService) List(ctx context.Context, query VectorStoreListPara
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
- path := "v1/openai/v1/vector_stores"
+ path := "v1/vector_stores"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -104,7 +104,7 @@ func (r *VectorStoreService) Delete(ctx context.Context, vectorStoreID string, o
err = errors.New("missing required vector_store_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s", vectorStoreID)
+ path := fmt.Sprintf("v1/vector_stores/%s", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return
}
@@ -117,7 +117,7 @@ func (r *VectorStoreService) Search(ctx context.Context, vectorStoreID string, b
err = errors.New("missing required vector_store_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/search", vectorStoreID)
+ path := fmt.Sprintf("v1/vector_stores/%s/search", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
diff --git a/vectorstorefile.go b/vectorstorefile.go
index bcb31b0..3cabaac 100644
--- a/vectorstorefile.go
+++ b/vectorstorefile.go
@@ -47,7 +47,7 @@ func (r *VectorStoreFileService) New(ctx context.Context, vectorStoreID string,
err = errors.New("missing required vector_store_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/files", vectorStoreID)
+ path := fmt.Sprintf("v1/vector_stores/%s/files", vectorStoreID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -63,7 +63,7 @@ func (r *VectorStoreFileService) Get(ctx context.Context, fileID string, query V
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/files/%s", query.VectorStoreID, fileID)
+ path := fmt.Sprintf("v1/vector_stores/%s/files/%s", query.VectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -79,7 +79,7 @@ func (r *VectorStoreFileService) Update(ctx context.Context, fileID string, para
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/files/%s", params.VectorStoreID, fileID)
+ path := fmt.Sprintf("v1/vector_stores/%s/files/%s", params.VectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return
}
@@ -93,7 +93,7 @@ func (r *VectorStoreFileService) List(ctx context.Context, vectorStoreID string,
err = errors.New("missing required vector_store_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/files", vectorStoreID)
+ path := fmt.Sprintf("v1/vector_stores/%s/files", vectorStoreID)
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
@@ -122,7 +122,7 @@ func (r *VectorStoreFileService) Delete(ctx context.Context, fileID string, body
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/files/%s", body.VectorStoreID, fileID)
+ path := fmt.Sprintf("v1/vector_stores/%s/files/%s", body.VectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
return
}
@@ -138,7 +138,7 @@ func (r *VectorStoreFileService) Content(ctx context.Context, fileID string, que
err = errors.New("missing required file_id parameter")
return
}
- path := fmt.Sprintf("v1/openai/v1/vector_stores/%s/files/%s/content", query.VectorStoreID, fileID)
+ path := fmt.Sprintf("v1/vector_stores/%s/files/%s/content", query.VectorStoreID, fileID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
From 222bb4ed27e9a4afd247aacea50d1645326a6b54 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 01:55:27 +0000
Subject: [PATCH 17/33] feat(api): expires_after changes for /files
---
.stats.yml | 6 +-
README.md | 15 +-
api.md | 14 +-
file.go | 24 +--
file_test.go | 5 +-
inference.go | 413 ----------------------------------------------
inference_test.go | 59 -------
model.go | 61 +++----
modelopenai.go | 38 +----
response.go | 6 -
10 files changed, 40 insertions(+), 601 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index e5bf0be..016bf7b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 107
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-1eddf141208c131ee4a64ef996f8f419b444f60450de6807a9f6bc711ed8b661.yml
-openapi_spec_hash: 94765c67ea99b1358169d41d810dd395
+configured_endpoints: 105
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-adcfaad1990d45e42b20e200a9ecc35ee32df5692bd9cd18ae898b0b7728c919.yml
+openapi_spec_hash: 4f532287bafe5da0578a1c1a5e31c952
config_hash: 7ec5a583f9c26b38993013bdfb0e7d46
diff --git a/README.md b/README.md
index 78bf888..49216b3 100644
--- a/README.md
+++ b/README.md
@@ -364,26 +364,17 @@ which can be used to wrap any `io.Reader` with the appropriate file name and con
// A file from the file system
file, err := os.Open("/path/to/file")
llamastackclient.FileNewParams{
- ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
- ExpiresAfterSeconds: llamastackclient.Int(0),
- File: file,
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ File: file,
}
// A file from a string
llamastackclient.FileNewParams{
- ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
- ExpiresAfterSeconds: llamastackclient.Int(0),
- File: strings.NewReader("my file contents"),
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ File: strings.NewReader("my file contents"),
}
// With a custom filename and contentType
llamastackclient.FileNewParams{
- ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
- ExpiresAfterSeconds: llamastackclient.Int(0),
- File: llamastackclient.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ File: llamastackclient.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
}
```
diff --git a/api.md b/api.md
index 7022b86..e762099 100644
--- a/api.md
+++ b/api.md
@@ -237,15 +237,11 @@ Methods:
Response Types:
- llamastackclient.ChatCompletionResponseStreamChunk
-- llamastackclient.EmbeddingsResponse
- llamastackclient.TokenLogProbs
-- llamastackclient.InferenceRerankResponse
Methods:
- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (llamastackclient.ChatCompletionResponse, error)
-- client.Inference.Embeddings(ctx context.Context, body llamastackclient.InferenceEmbeddingsParams) (llamastackclient.EmbeddingsResponse, error)
-- client.Inference.Rerank(ctx context.Context, body llamastackclient.InferenceRerankParams) ([]llamastackclient.InferenceRerankResponse, error)
# Embeddings
@@ -352,25 +348,21 @@ Methods:
Response Types:
+- llamastackclient.ListModelsResponse
- llamastackclient.Model
-- llamastackclient.ModelListResponse
Methods:
- client.Models.Get(ctx context.Context, modelID string) (llamastackclient.Model, error)
-- client.Models.List(ctx context.Context) ([]llamastackclient.ModelListResponse, error)
+- client.Models.List(ctx context.Context) ([]llamastackclient.Model, error)
- client.Models.Register(ctx context.Context, body llamastackclient.ModelRegisterParams) (llamastackclient.Model, error)
- client.Models.Unregister(ctx context.Context, modelID string) error
## OpenAI
-Response Types:
-
-- llamastackclient.ModelOpenAIListResponse
-
Methods:
-- client.Models.OpenAI.List(ctx context.Context) ([]llamastackclient.ModelOpenAIListResponse, error)
+- client.Models.OpenAI.List(ctx context.Context) ([]llamastackclient.Model, error)
# PostTraining
diff --git a/file.go b/file.go
index 2b0bac4..06bc438 100644
--- a/file.go
+++ b/file.go
@@ -46,11 +46,9 @@ func NewFileService(opts ...option.RequestOption) (r FileService) {
// Upload a file that can be used across various endpoints. The file upload should
// be a multipart form request with:
//
-// - file: The File object (not file name) to be uploaded.
-// - purpose: The intended purpose of the uploaded file.
-// - expires_after: Optional form values describing expiration for the file.
-// Expected expires_after[anchor] = "created_at", expires_after[seconds] =
-// {integer}. Seconds must be between 3600 and 2592000 (1 hour to 30 days).
+// - file: The File object (not file name) to be uploaded.
+// - purpose: The intended purpose of the uploaded file.
+// - expires_after: Optional form values describing expiration for the file.
func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...option.RequestOption) (res *File, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/files"
@@ -220,13 +218,7 @@ func (r *ListFilesResponse) UnmarshalJSON(data []byte) error {
type FileContentResponse = any
type FileNewParams struct {
- ExpiresAfterAnchor param.Opt[string] `json:"expires_after_anchor,omitzero,required"`
- ExpiresAfterSeconds param.Opt[int64] `json:"expires_after_seconds,omitzero,required"`
- File io.Reader `json:"file,omitzero,required" format:"binary"`
- // Valid purpose values for OpenAI Files API.
- //
- // Any of "assistants", "batch".
- Purpose FileNewParamsPurpose `json:"purpose,omitzero,required"`
+ File io.Reader `json:"file,omitzero,required" format:"binary"`
paramObj
}
@@ -248,14 +240,6 @@ func (r FileNewParams) MarshalMultipart() (data []byte, contentType string, err
return buf.Bytes(), writer.FormDataContentType(), nil
}
-// Valid purpose values for OpenAI Files API.
-type FileNewParamsPurpose string
-
-const (
- FileNewParamsPurposeAssistants FileNewParamsPurpose = "assistants"
- FileNewParamsPurposeBatch FileNewParamsPurpose = "batch"
-)
-
type FileListParams struct {
// A cursor for use in pagination. `after` is an object ID that defines your place
// in the list. For instance, if you make a list request and receive 100 objects,
diff --git a/file_test.go b/file_test.go
index 9239b0d..f417f09 100644
--- a/file_test.go
+++ b/file_test.go
@@ -27,10 +27,7 @@ func TestFileNew(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Files.New(context.TODO(), llamastackclient.FileNewParams{
- ExpiresAfterAnchor: llamastackclient.String("expires_after_anchor"),
- ExpiresAfterSeconds: llamastackclient.Int(0),
- File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
- Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/inference.go b/inference.go
index aa2042e..ffd3723 100644
--- a/inference.go
+++ b/inference.go
@@ -13,7 +13,6 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
"github.com/llamastack/llama-stack-client-go/packages/ssestream"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// InferenceService contains methods and other services that help with interacting
@@ -62,29 +61,6 @@ func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body Inf
return ssestream.NewStream[ChatCompletionResponseStreamChunk](ssestream.NewDecoder(raw), err)
}
-// Generate embeddings for content pieces using the specified model.
-//
-// Deprecated: /v1/inference/embeddings is deprecated. Please use /v1/embeddings.
-func (r *InferenceService) Embeddings(ctx context.Context, body InferenceEmbeddingsParams, opts ...option.RequestOption) (res *EmbeddingsResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- path := "v1/inference/embeddings"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
-// Rerank a list of documents based on their relevance to a query.
-func (r *InferenceService) Rerank(ctx context.Context, body InferenceRerankParams, opts ...option.RequestOption) (res *[]InferenceRerankResponse, err error) {
- var env InferenceRerankResponseEnvelope
- opts = slices.Concat(r.Options, opts)
- path := "v1/inference/rerank"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
// A chunk of a streamed chat completion response.
type ChatCompletionResponseStreamChunk struct {
// The event containing the new content
@@ -138,26 +114,6 @@ func (r *ChatCompletionResponseStreamChunkEvent) UnmarshalJSON(data []byte) erro
return apijson.UnmarshalRoot(data, r)
}
-// Response containing generated embeddings.
-type EmbeddingsResponse struct {
- // List of embedding vectors, one per input content. Each embedding is a list of
- // floats. The dimensionality of the embedding is model-specific; you can check
- // model metadata using /models/{model_id}
- Embeddings [][]float64 `json:"embeddings,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Embeddings respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r EmbeddingsResponse) RawJSON() string { return r.JSON.raw }
-func (r *EmbeddingsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// Log probabilities for generated tokens.
type TokenLogProbs struct {
// Dictionary mapping tokens to their log probabilities
@@ -176,28 +132,6 @@ func (r *TokenLogProbs) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// A single rerank result from a reranking response.
-type InferenceRerankResponse struct {
- // The original index of the document in the input list
- Index int64 `json:"index,required"`
- // The relevance score from the model output. Values are inverted when applicable
- // so that higher scores indicate greater relevance.
- RelevanceScore float64 `json:"relevance_score,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Index respjson.Field
- RelevanceScore respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r InferenceRerankResponse) RawJSON() string { return r.JSON.raw }
-func (r *InferenceRerankResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type InferenceChatCompletionParams struct {
// List of messages in the conversation.
Messages []MessageUnionParam `json:"messages,omitzero,required"`
@@ -343,350 +277,3 @@ func (r InferenceChatCompletionParamsTool) MarshalJSON() (data []byte, err error
func (r *InferenceChatCompletionParamsTool) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-
-type InferenceEmbeddingsParams struct {
- // List of contents to generate embeddings for. Each content can be a string or an
- // InterleavedContentItem (and hence can be multimodal). The behavior depends on
- // the model and provider. Some models may only support text.
- Contents InferenceEmbeddingsParamsContentsUnion `json:"contents,omitzero,required"`
- // The identifier of the model to use. The model must be an embedding model
- // registered with Llama Stack and available via the /models endpoint.
- ModelID string `json:"model_id,required"`
- // (Optional) Output dimensionality for the embeddings. Only supported by
- // Matryoshka models.
- OutputDimension param.Opt[int64] `json:"output_dimension,omitzero"`
- // (Optional) How is the embedding being used? This is only supported by asymmetric
- // embedding models.
- //
- // Any of "query", "document".
- TaskType InferenceEmbeddingsParamsTaskType `json:"task_type,omitzero"`
- // (Optional) Config for how to truncate text for embedding when text is longer
- // than the model's max sequence length.
- //
- // Any of "none", "start", "end".
- TextTruncation InferenceEmbeddingsParamsTextTruncation `json:"text_truncation,omitzero"`
- paramObj
-}
-
-func (r InferenceEmbeddingsParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceEmbeddingsParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceEmbeddingsParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type InferenceEmbeddingsParamsContentsUnion struct {
- OfStringArray []string `json:",omitzero,inline"`
- OfInterleavedContentItemArray []InterleavedContentItemUnionParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u InferenceEmbeddingsParamsContentsUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfStringArray, u.OfInterleavedContentItemArray)
-}
-func (u *InferenceEmbeddingsParamsContentsUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *InferenceEmbeddingsParamsContentsUnion) asAny() any {
- if !param.IsOmitted(u.OfStringArray) {
- return &u.OfStringArray
- } else if !param.IsOmitted(u.OfInterleavedContentItemArray) {
- return &u.OfInterleavedContentItemArray
- }
- return nil
-}
-
-// (Optional) How is the embedding being used? This is only supported by asymmetric
-// embedding models.
-type InferenceEmbeddingsParamsTaskType string
-
-const (
- InferenceEmbeddingsParamsTaskTypeQuery InferenceEmbeddingsParamsTaskType = "query"
- InferenceEmbeddingsParamsTaskTypeDocument InferenceEmbeddingsParamsTaskType = "document"
-)
-
-// (Optional) Config for how to truncate text for embedding when text is longer
-// than the model's max sequence length.
-type InferenceEmbeddingsParamsTextTruncation string
-
-const (
- InferenceEmbeddingsParamsTextTruncationNone InferenceEmbeddingsParamsTextTruncation = "none"
- InferenceEmbeddingsParamsTextTruncationStart InferenceEmbeddingsParamsTextTruncation = "start"
- InferenceEmbeddingsParamsTextTruncationEnd InferenceEmbeddingsParamsTextTruncation = "end"
-)
-
-type InferenceRerankParams struct {
- // List of items to rerank. Each item can be a string, text content part, or image
- // content part. Each input must not exceed the model's max input token length.
- Items []InferenceRerankParamsItemUnion `json:"items,omitzero,required"`
- // The identifier of the reranking model to use.
- Model string `json:"model,required"`
- // The search query to rank items against. Can be a string, text content part, or
- // image content part. The input must not exceed the model's max input token
- // length.
- Query InferenceRerankParamsQueryUnion `json:"query,omitzero,required"`
- // (Optional) Maximum number of results to return. Default: returns all.
- MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
- paramObj
-}
-
-func (r InferenceRerankParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type InferenceRerankParamsItemUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartText *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u InferenceRerankParamsItemUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
-}
-func (u *InferenceRerankParamsItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *InferenceRerankParamsItemUnion) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
- return u.OfOpenAIChatCompletionContentPartText
- } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartImage) {
- return u.OfOpenAIChatCompletionContentPartImage
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsItemUnion) GetText() *string {
- if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
- return &vt.Text
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsItemUnion) GetImageURL() *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL {
- if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
- return &vt.ImageURL
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsItemUnion) GetType() *string {
- if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
-}
-
-// Text content part for OpenAI-compatible chat completion messages.
-//
-// The properties Text, Type are required.
-type InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam struct {
- // The text content of the message
- Text string `json:"text,required"`
- // Must be "text" to identify this as text content
- //
- // This field can be elided, and will marshal its zero value as "text".
- Type constant.Text `json:"type,required"`
- paramObj
-}
-
-func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image content part for OpenAI-compatible chat completion messages.
-//
-// The properties ImageURL, Type are required.
-type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam struct {
- // Image URL specification and processing details
- ImageURL InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
- // Must be "image_url" to identify this as image content
- //
- // This field can be elided, and will marshal its zero value as "image_url".
- Type constant.ImageURL `json:"type,required"`
- paramObj
-}
-
-func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image URL specification and processing details
-//
-// The property URL is required.
-type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL struct {
- // URL of the image to include in the message
- URL string `json:"url,required"`
- // (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
- Detail param.Opt[string] `json:"detail,omitzero"`
- paramObj
-}
-
-func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type InferenceRerankParamsQueryUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartText *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u InferenceRerankParamsQueryUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
-}
-func (u *InferenceRerankParamsQueryUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *InferenceRerankParamsQueryUnion) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
- return u.OfOpenAIChatCompletionContentPartText
- } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartImage) {
- return u.OfOpenAIChatCompletionContentPartImage
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsQueryUnion) GetText() *string {
- if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
- return &vt.Text
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsQueryUnion) GetImageURL() *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL {
- if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
- return &vt.ImageURL
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsQueryUnion) GetType() *string {
- if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
-}
-
-// Text content part for OpenAI-compatible chat completion messages.
-//
-// The properties Text, Type are required.
-type InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam struct {
- // The text content of the message
- Text string `json:"text,required"`
- // Must be "text" to identify this as text content
- //
- // This field can be elided, and will marshal its zero value as "text".
- Type constant.Text `json:"type,required"`
- paramObj
-}
-
-func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image content part for OpenAI-compatible chat completion messages.
-//
-// The properties ImageURL, Type are required.
-type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam struct {
- // Image URL specification and processing details
- ImageURL InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
- // Must be "image_url" to identify this as image content
- //
- // This field can be elided, and will marshal its zero value as "image_url".
- Type constant.ImageURL `json:"type,required"`
- paramObj
-}
-
-func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image URL specification and processing details
-//
-// The property URL is required.
-type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL struct {
- // URL of the image to include in the message
- URL string `json:"url,required"`
- // (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
- Detail param.Opt[string] `json:"detail,omitzero"`
- paramObj
-}
-
-func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Response from a reranking request.
-type InferenceRerankResponseEnvelope struct {
- // List of rerank result objects, sorted by relevance score (descending)
- Data []InferenceRerankResponse `json:"data,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 InferenceRerankResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *InferenceRerankResponseEnvelope) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
diff --git a/inference_test.go b/inference_test.go
index 9a33db4..f63e2dd 100644
--- a/inference_test.go
+++ b/inference_test.go
@@ -90,62 +90,3 @@ func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
-
-func TestInferenceEmbeddingsWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Inference.Embeddings(context.TODO(), llamastackclient.InferenceEmbeddingsParams{
- Contents: llamastackclient.InferenceEmbeddingsParamsContentsUnion{
- OfStringArray: []string{"string"},
- },
- ModelID: "model_id",
- OutputDimension: llamastackclient.Int(0),
- TaskType: llamastackclient.InferenceEmbeddingsParamsTaskTypeQuery,
- TextTruncation: llamastackclient.InferenceEmbeddingsParamsTextTruncationNone,
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestInferenceRerankWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Inference.Rerank(context.TODO(), llamastackclient.InferenceRerankParams{
- Items: []llamastackclient.InferenceRerankParamsItemUnion{{
- OfString: llamastackclient.String("string"),
- }},
- Model: "model",
- Query: llamastackclient.InferenceRerankParamsQueryUnion{
- OfString: llamastackclient.String("string"),
- },
- MaxNumResults: llamastackclient.Int(0),
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
diff --git a/model.go b/model.go
index 404b8e6..8e92752 100644
--- a/model.go
+++ b/model.go
@@ -51,9 +51,9 @@ func (r *ModelService) Get(ctx context.Context, modelID string, opts ...option.R
return
}
-// List models using the OpenAI API.
-func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ModelListResponse, err error) {
- var env ModelListResponseEnvelope
+// List all models.
+func (r *ModelService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Model, err error) {
+ var env ListModelsResponse
opts = slices.Concat(r.Options, opts)
path := "v1/models"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
@@ -85,6 +85,22 @@ func (r *ModelService) Unregister(ctx context.Context, modelID string, opts ...o
return
}
+type ListModelsResponse struct {
+ Data []Model `json:"data,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 ListModelsResponse) RawJSON() string { return r.JSON.raw }
+func (r *ListModelsResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// A model resource representing an AI model registered in Llama Stack.
type Model struct {
// Unique identifier for this resource in llama stack
@@ -180,45 +196,6 @@ const (
ModelModelTypeEmbedding ModelModelType = "embedding"
)
-// A model from OpenAI.
-type ModelListResponse struct {
- ID string `json:"id,required"`
- Created int64 `json:"created,required"`
- Object constant.Model `json:"object,required"`
- OwnedBy string `json:"owned_by,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Created respjson.Field
- Object respjson.Field
- OwnedBy respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ModelListResponse) RawJSON() string { return r.JSON.raw }
-func (r *ModelListResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ModelListResponseEnvelope struct {
- Data []ModelListResponse `json:"data,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 ModelListResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *ModelListResponseEnvelope) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type ModelRegisterParams struct {
// The identifier of the model to register.
ModelID string `json:"model_id,required"`
diff --git a/modelopenai.go b/modelopenai.go
index a373572..e2c51c1 100644
--- a/modelopenai.go
+++ b/modelopenai.go
@@ -11,7 +11,6 @@ import (
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// ModelOpenAIService contains methods and other services that help with
@@ -33,9 +32,9 @@ func NewModelOpenAIService(opts ...option.RequestOption) (r ModelOpenAIService)
return
}
-// List models using the OpenAI API.
-func (r *ModelOpenAIService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ModelOpenAIListResponse, err error) {
- var env ModelOpenAIListResponseEnvelope
+// List all models.
+func (r *ModelOpenAIService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Model, err error) {
+ var env ListModelsResponse
opts = slices.Concat(r.Options, opts)
path := "v1/models"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
@@ -46,31 +45,8 @@ func (r *ModelOpenAIService) List(ctx context.Context, opts ...option.RequestOpt
return
}
-// A model from OpenAI.
-type ModelOpenAIListResponse struct {
- ID string `json:"id,required"`
- Created int64 `json:"created,required"`
- Object constant.Model `json:"object,required"`
- OwnedBy string `json:"owned_by,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Created respjson.Field
- Object respjson.Field
- OwnedBy respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ModelOpenAIListResponse) RawJSON() string { return r.JSON.raw }
-func (r *ModelOpenAIListResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ModelOpenAIListResponseEnvelope struct {
- Data []ModelOpenAIListResponse `json:"data,required"`
+type ListModelsResponse struct {
+ Data []Model `json:"data,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
@@ -80,7 +56,7 @@ type ModelOpenAIListResponseEnvelope struct {
}
// Returns the unmodified JSON received from the API
-func (r ModelOpenAIListResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *ModelOpenAIListResponseEnvelope) UnmarshalJSON(data []byte) error {
+func (r ListModelsResponse) RawJSON() string { return r.JSON.raw }
+func (r *ListModelsResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/response.go b/response.go
index 96492b3..2038c62 100644
--- a/response.go
+++ b/response.go
@@ -139,8 +139,6 @@ type ResponseObject struct {
TopP float64 `json:"top_p"`
// (Optional) Truncation strategy applied to the response
Truncation string `json:"truncation"`
- // (Optional) User identifier associated with the request
- User string `json:"user"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -156,7 +154,6 @@ type ResponseObject struct {
Temperature respjson.Field
TopP respjson.Field
Truncation respjson.Field
- User respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
@@ -4427,8 +4424,6 @@ type ResponseListResponse struct {
TopP float64 `json:"top_p"`
// (Optional) Truncation strategy applied to the response
Truncation string `json:"truncation"`
- // (Optional) User identifier associated with the request
- User string `json:"user"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -4445,7 +4440,6 @@ type ResponseListResponse struct {
Temperature respjson.Field
TopP respjson.Field
Truncation respjson.Field
- User respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
From 9f926b25335010398c825844a60927709ccfc07f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 01:59:59 +0000
Subject: [PATCH 18/33] feat(api)!: fixes to remove deprecated inference
resources
---
.stats.yml | 2 +-
README.md | 59 +------
api.md | 8 +-
client_test.go | 118 ++-----------
inference.go | 432 ++++++++++++++++++++++++++--------------------
inference_test.go | 64 +------
shared.go | 129 --------------
7 files changed, 284 insertions(+), 528 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 016bf7b..ed58961 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 105
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-adcfaad1990d45e42b20e200a9ecc35ee32df5692bd9cd18ae898b0b7728c919.yml
openapi_spec_hash: 4f532287bafe5da0578a1c1a5e31c952
-config_hash: 7ec5a583f9c26b38993013bdfb0e7d46
+config_hash: 5b643c97c83a497d7d346253f1e175f3
diff --git a/README.md b/README.md
index 49216b3..63773e2 100644
--- a/README.md
+++ b/README.md
@@ -265,7 +265,7 @@ client := llamastackclient.NewClient(
option.WithHeader("X-Some-Header", "custom_header_info"),
)
-client.Inference.ChatCompletion(context.TODO(), ...,
+client.Toolgroups.List(context.TODO(), ...,
// Override the header
option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
// Add an undocumented field to the request body, using sjson syntax
@@ -296,23 +296,14 @@ When the API returns a non-success status code, we return an error with type
To handle errors, we recommend that you use the `errors.As` pattern:
```go
-_, err := client.Inference.ChatCompletion(context.TODO(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
-})
+_, err := client.Toolgroups.List(context.TODO())
if err != nil {
var apierr *llamastackclient.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
}
- panic(err.Error()) // GET "/v1/inference/chat-completion": 400 Bad Request { ... }
+ panic(err.Error()) // GET "/v1/toolgroups": 400 Bad Request { ... }
}
```
@@ -330,18 +321,8 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
-client.Inference.ChatCompletion(
+client.Toolgroups.List(
ctx,
- llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- },
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
)
@@ -393,20 +374,7 @@ client := llamastackclient.NewClient(
)
// Override per-request:
-client.Inference.ChatCompletion(
- context.TODO(),
- llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- },
- option.WithMaxRetries(5),
-)
+client.Toolgroups.List(context.TODO(), option.WithMaxRetries(5))
```
### Accessing raw response data (e.g. response headers)
@@ -417,24 +385,11 @@ you need to examine response headers, status codes, or other details.
```go
// Create a variable to store the HTTP response
var response *http.Response
-chatCompletionResponse, err := client.Inference.ChatCompletion(
- context.TODO(),
- llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- },
- option.WithResponseInto(&response),
-)
+toolGroups, err := client.Toolgroups.List(context.TODO(), option.WithResponseInto(&response))
if err != nil {
// handle error
}
-fmt.Printf("%+v\n", chatCompletionResponse)
+fmt.Printf("%+v\n", toolGroups)
fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
diff --git a/api.md b/api.md
index e762099..e0735ed 100644
--- a/api.md
+++ b/api.md
@@ -12,19 +12,16 @@
- llamastackclient.SamplingParams
- llamastackclient.SystemMessageParam
- llamastackclient.ToolCallParam
-- llamastackclient.ToolParamDefinition
- llamastackclient.ToolResponseMessageParam
- llamastackclient.UserMessageParam
# Shared Response Types
- llamastackclient.AgentConfig
-- llamastackclient.ChatCompletionResponse
- llamastackclient.CompletionMessage
- llamastackclient.ContentDeltaUnion
- llamastackclient.InterleavedContentUnion
- llamastackclient.InterleavedContentItemUnion
-- llamastackclient.Metric
- llamastackclient.QueryResult
- llamastackclient.ResponseFormatUnion
- llamastackclient.SafetyViolation
@@ -236,12 +233,11 @@ Methods:
Response Types:
-- llamastackclient.ChatCompletionResponseStreamChunk
-- llamastackclient.TokenLogProbs
+- llamastackclient.InferenceRerankResponse
Methods:
-- client.Inference.ChatCompletion(ctx context.Context, body llamastackclient.InferenceChatCompletionParams) (llamastackclient.ChatCompletionResponse, error)
+- client.Inference.Rerank(ctx context.Context, body llamastackclient.InferenceRerankParams) ([]llamastackclient.InferenceRerankResponse, error)
# Embeddings
diff --git a/client_test.go b/client_test.go
index 118fbe0..043643a 100644
--- a/client_test.go
+++ b/client_test.go
@@ -38,16 +38,7 @@ func TestUserAgentHeader(t *testing.T) {
},
}),
)
- client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ client.Toolgroups.List(context.Background())
if userAgent != fmt.Sprintf("LlamaStackClient/Go %s", internal.PackageVersion) {
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
}
@@ -70,16 +61,7 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
- _, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -113,16 +95,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
- _, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -151,16 +124,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
- _, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -188,16 +152,7 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
- _, err := client.Inference.ChatCompletion(context.Background(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -219,16 +174,7 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
- _, err := client.Inference.ChatCompletion(cancelCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(cancelCtx)
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -247,16 +193,7 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
- _, err := client.Inference.ChatCompletion(cancelCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(cancelCtx)
if err == nil {
t.Error("expected there to be a cancel error")
}
@@ -281,16 +218,7 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
- _, err := client.Inference.ChatCompletion(deadlineCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
- })
+ _, err := client.Toolgroups.List(deadlineCtx)
if err == nil {
t.Error("expected there to be a deadline error")
}
@@ -334,15 +262,11 @@ func TestContextDeadlineStreaming(t *testing.T) {
},
}),
)
- stream := client.Inference.ChatCompletionStreaming(deadlineCtx, llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
+ stream := client.Responses.NewStreaming(deadlineCtx, llamastackclient.ResponseNewParams{
+ Input: llamastackclient.ResponseNewParamsInputUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ Model: "model",
})
for stream.Next() {
_ = stream.Current()
@@ -387,17 +311,13 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
},
}),
)
- stream := client.Inference.ChatCompletionStreaming(
+ stream := client.Responses.NewStreaming(
context.Background(),
- llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
- }},
- ModelID: "model_id",
+ llamastackclient.ResponseNewParams{
+ Input: llamastackclient.ResponseNewParamsInputUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ Model: "model",
},
option.WithRequestTimeout((100 * time.Millisecond)),
)
diff --git a/inference.go b/inference.go
index ffd3723..6e93484 100644
--- a/inference.go
+++ b/inference.go
@@ -12,7 +12,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/packages/ssestream"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// InferenceService contains methods and other services that help with interacting
@@ -34,246 +34,308 @@ func NewInferenceService(opts ...option.RequestOption) (r InferenceService) {
return
}
-// Generate a chat completion for the given messages using the specified model.
-//
-// Deprecated: /v1/inference/chat-completion is deprecated. Please use
-// /v1/chat/completions.
-func (r *InferenceService) ChatCompletion(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (res *ChatCompletionResponse, err error) {
+// Rerank a list of documents based on their relevance to a query.
+func (r *InferenceService) Rerank(ctx context.Context, body InferenceRerankParams, opts ...option.RequestOption) (res *[]InferenceRerankResponse, err error) {
+ var env InferenceRerankResponseEnvelope
opts = slices.Concat(r.Options, opts)
- path := "v1/inference/chat-completion"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ path := "v1alpha/inference/rerank"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Data
return
}
-// Generate a chat completion for the given messages using the specified model.
-//
-// Deprecated: /v1/inference/chat-completion is deprecated. Please use
-// /v1/chat/completions.
-func (r *InferenceService) ChatCompletionStreaming(ctx context.Context, body InferenceChatCompletionParams, opts ...option.RequestOption) (stream *ssestream.Stream[ChatCompletionResponseStreamChunk]) {
- var (
- raw *http.Response
- err error
- )
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- path := "v1/inference/chat-completion"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
- return ssestream.NewStream[ChatCompletionResponseStreamChunk](ssestream.NewDecoder(raw), err)
-}
-
-// A chunk of a streamed chat completion response.
-type ChatCompletionResponseStreamChunk struct {
- // The event containing the new content
- Event ChatCompletionResponseStreamChunkEvent `json:"event,required"`
- // (Optional) List of metrics associated with the API response
- Metrics []Metric `json:"metrics"`
+// A single rerank result from a reranking response.
+type InferenceRerankResponse struct {
+ // The original index of the document in the input list
+ Index int64 `json:"index,required"`
+ // The relevance score from the model output. Values are inverted when applicable
+ // so that higher scores indicate greater relevance.
+ RelevanceScore float64 `json:"relevance_score,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Event respjson.Field
- Metrics respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Index respjson.Field
+ RelevanceScore respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponseStreamChunk) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponseStreamChunk) UnmarshalJSON(data []byte) error {
+func (r InferenceRerankResponse) RawJSON() string { return r.JSON.raw }
+func (r *InferenceRerankResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The event containing the new content
-type ChatCompletionResponseStreamChunkEvent struct {
- // Content generated since last event. This can be one or more tokens, or a tool
- // call.
- Delta ContentDeltaUnion `json:"delta,required"`
- // Type of the event
- //
- // Any of "start", "complete", "progress".
- EventType string `json:"event_type,required"`
- // Optional log probabilities for generated tokens
- Logprobs []TokenLogProbs `json:"logprobs"`
- // Optional reason why generation stopped, if complete
- //
- // Any of "end_of_turn", "end_of_message", "out_of_tokens".
- StopReason string `json:"stop_reason"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Delta respjson.Field
- EventType respjson.Field
- Logprobs respjson.Field
- StopReason respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+type InferenceRerankParams struct {
+ // List of items to rerank. Each item can be a string, text content part, or image
+ // content part. Each input must not exceed the model's max input token length.
+ Items []InferenceRerankParamsItemUnion `json:"items,omitzero,required"`
+ // The identifier of the reranking model to use.
+ Model string `json:"model,required"`
+ // The search query to rank items against. Can be a string, text content part, or
+ // image content part. The input must not exceed the model's max input token
+ // length.
+ Query InferenceRerankParamsQueryUnion `json:"query,omitzero,required"`
+ // (Optional) Maximum number of results to return. Default: returns all.
+ MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponseStreamChunkEvent) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponseStreamChunkEvent) UnmarshalJSON(data []byte) error {
+func (r InferenceRerankParams) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Log probabilities for generated tokens.
-type TokenLogProbs struct {
- // Dictionary mapping tokens to their log probabilities
- LogprobsByToken map[string]float64 `json:"logprobs_by_token,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- LogprobsByToken respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type InferenceRerankParamsItemUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartText *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
+ paramUnion
}
-// Returns the unmodified JSON received from the API
-func (r TokenLogProbs) RawJSON() string { return r.JSON.raw }
-func (r *TokenLogProbs) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func (u InferenceRerankParamsItemUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
+}
+func (u *InferenceRerankParamsItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *InferenceRerankParamsItemUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
+ return u.OfOpenAIChatCompletionContentPartText
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartImage) {
+ return u.OfOpenAIChatCompletionContentPartImage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsItemUnion) GetText() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsItemUnion) GetImageURL() *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL {
+ if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return &vt.ImageURL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsItemUnion) GetType() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
}
-type InferenceChatCompletionParams struct {
- // List of messages in the conversation.
- Messages []MessageUnionParam `json:"messages,omitzero,required"`
- // The identifier of the model to use. The model must be registered with Llama
- // Stack and available via the /models endpoint.
- ModelID string `json:"model_id,required"`
- // (Optional) If specified, log probabilities for each token position will be
- // returned.
- Logprobs InferenceChatCompletionParamsLogprobs `json:"logprobs,omitzero"`
- // (Optional) Grammar specification for guided (structured) decoding. There are two
- // options: - `ResponseFormat.json_schema`: The grammar is a JSON schema. Most
- // providers support this format. - `ResponseFormat.grammar`: The grammar is a BNF
- // grammar. This format is more flexible, but not all providers support it.
- ResponseFormat ResponseFormatUnionParam `json:"response_format,omitzero"`
- // Parameters to control the sampling strategy.
- SamplingParams SamplingParams `json:"sampling_params,omitzero"`
- // (Optional) Whether tool use is required or automatic. Defaults to
- // ToolChoice.auto. .. deprecated:: Use tool_config instead.
+// Text content part for OpenAI-compatible chat completion messages.
+//
+// The properties Text, Type are required.
+type InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam struct {
+ // The text content of the message
+ Text string `json:"text,required"`
+ // Must be "text" to identify this as text content
//
- // Any of "auto", "required", "none".
- ToolChoice InferenceChatCompletionParamsToolChoice `json:"tool_choice,omitzero"`
- // (Optional) Configuration for tool use.
- ToolConfig InferenceChatCompletionParamsToolConfig `json:"tool_config,omitzero"`
- // (Optional) Instructs the model how to format tool calls. By default, Llama Stack
- // will attempt to use a format that is best adapted to the model. -
- // `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
- // `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
- // tag. - `ToolPromptFormat.python_list`: The tool calls
- // are output as Python syntax -- a list of function calls. .. deprecated:: Use
- // tool_config instead.
+ // This field can be elided, and will marshal its zero value as "text".
+ Type constant.Text `json:"type,required"`
+ paramObj
+}
+
+func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image content part for OpenAI-compatible chat completion messages.
+//
+// The properties ImageURL, Type are required.
+type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam struct {
+ // Image URL specification and processing details
+ ImageURL InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
+ // Must be "image_url" to identify this as image content
//
- // Any of "json", "function_tag", "python_list".
- ToolPromptFormat InferenceChatCompletionParamsToolPromptFormat `json:"tool_prompt_format,omitzero"`
- // (Optional) List of tool definitions available to the model.
- Tools []InferenceChatCompletionParamsTool `json:"tools,omitzero"`
+ // This field can be elided, and will marshal its zero value as "image_url".
+ Type constant.ImageURL `json:"type,required"`
paramObj
}
-func (r InferenceChatCompletionParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceChatCompletionParams
+func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceChatCompletionParams) UnmarshalJSON(data []byte) error {
+func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// (Optional) If specified, log probabilities for each token position will be
-// returned.
-type InferenceChatCompletionParamsLogprobs struct {
- // How many tokens (for each position) to return log probabilities for.
- TopK param.Opt[int64] `json:"top_k,omitzero"`
+// Image URL specification and processing details
+//
+// The property URL is required.
+type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL struct {
+ // URL of the image to include in the message
+ URL string `json:"url,required"`
+ // (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
+ Detail param.Opt[string] `json:"detail,omitzero"`
paramObj
}
-func (r InferenceChatCompletionParamsLogprobs) MarshalJSON() (data []byte, err error) {
- type shadow InferenceChatCompletionParamsLogprobs
+func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceChatCompletionParamsLogprobs) UnmarshalJSON(data []byte) error {
+func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// (Optional) Whether tool use is required or automatic. Defaults to
-// ToolChoice.auto. .. deprecated:: Use tool_config instead.
-type InferenceChatCompletionParamsToolChoice string
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type InferenceRerankParamsQueryUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartText *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
+ paramUnion
+}
-const (
- InferenceChatCompletionParamsToolChoiceAuto InferenceChatCompletionParamsToolChoice = "auto"
- InferenceChatCompletionParamsToolChoiceRequired InferenceChatCompletionParamsToolChoice = "required"
- InferenceChatCompletionParamsToolChoiceNone InferenceChatCompletionParamsToolChoice = "none"
-)
+func (u InferenceRerankParamsQueryUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
+}
+func (u *InferenceRerankParamsQueryUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
-// (Optional) Configuration for tool use.
-type InferenceChatCompletionParamsToolConfig struct {
- // (Optional) Config for how to override the default system prompt. -
- // `SystemMessageBehavior.append`: Appends the provided system message to the
- // default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
- // system prompt with the provided system message. The system message can include
- // the string '{{function_definitions}}' to indicate where the function definitions
- // should be inserted.
- //
- // Any of "append", "replace".
- SystemMessageBehavior string `json:"system_message_behavior,omitzero"`
- // (Optional) Whether tool use is automatic, required, or none. Can also specify a
- // tool name to use a specific tool. Defaults to ToolChoice.auto.
- ToolChoice string `json:"tool_choice,omitzero"`
- // (Optional) Instructs the model how to format tool calls. By default, Llama Stack
- // will attempt to use a format that is best adapted to the model. -
- // `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
- // `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
- // tag. - `ToolPromptFormat.python_list`: The tool calls
- // are output as Python syntax -- a list of function calls.
+func (u *InferenceRerankParamsQueryUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
+ return u.OfOpenAIChatCompletionContentPartText
+ } else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartImage) {
+ return u.OfOpenAIChatCompletionContentPartImage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsQueryUnion) GetText() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsQueryUnion) GetImageURL() *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL {
+ if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return &vt.ImageURL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u InferenceRerankParamsQueryUnion) GetType() *string {
+ if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Text content part for OpenAI-compatible chat completion messages.
+//
+// The properties Text, Type are required.
+type InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam struct {
+ // The text content of the message
+ Text string `json:"text,required"`
+ // Must be "text" to identify this as text content
//
- // Any of "json", "function_tag", "python_list".
- ToolPromptFormat string `json:"tool_prompt_format,omitzero"`
+ // This field can be elided, and will marshal its zero value as "text".
+ Type constant.Text `json:"type,required"`
paramObj
}
-func (r InferenceChatCompletionParamsToolConfig) MarshalJSON() (data []byte, err error) {
- type shadow InferenceChatCompletionParamsToolConfig
+func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceChatCompletionParamsToolConfig) UnmarshalJSON(data []byte) error {
+func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-func init() {
- apijson.RegisterFieldValidator[InferenceChatCompletionParamsToolConfig](
- "system_message_behavior", "append", "replace",
- )
- apijson.RegisterFieldValidator[InferenceChatCompletionParamsToolConfig](
- "tool_prompt_format", "json", "function_tag", "python_list",
- )
-}
-
-// (Optional) Instructs the model how to format tool calls. By default, Llama Stack
-// will attempt to use a format that is best adapted to the model. -
-// `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
-// `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
-// tag. - `ToolPromptFormat.python_list`: The tool calls
-// are output as Python syntax -- a list of function calls. .. deprecated:: Use
-// tool_config instead.
-type InferenceChatCompletionParamsToolPromptFormat string
-
-const (
- InferenceChatCompletionParamsToolPromptFormatJson InferenceChatCompletionParamsToolPromptFormat = "json"
- InferenceChatCompletionParamsToolPromptFormatFunctionTag InferenceChatCompletionParamsToolPromptFormat = "function_tag"
- InferenceChatCompletionParamsToolPromptFormatPythonList InferenceChatCompletionParamsToolPromptFormat = "python_list"
-)
+// Image content part for OpenAI-compatible chat completion messages.
+//
+// The properties ImageURL, Type are required.
+type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam struct {
+ // Image URL specification and processing details
+ ImageURL InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
+ // Must be "image_url" to identify this as image content
+ //
+ // This field can be elided, and will marshal its zero value as "image_url".
+ Type constant.ImageURL `json:"type,required"`
+ paramObj
+}
+
+func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
-// The property ToolName is required.
-type InferenceChatCompletionParamsTool struct {
- ToolName string `json:"tool_name,omitzero,required"`
- Description param.Opt[string] `json:"description,omitzero"`
- Parameters map[string]ToolParamDefinition `json:"parameters,omitzero"`
+// Image URL specification and processing details
+//
+// The property URL is required.
+type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL struct {
+ // URL of the image to include in the message
+ URL string `json:"url,required"`
+ // (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
+ Detail param.Opt[string] `json:"detail,omitzero"`
paramObj
}
-func (r InferenceChatCompletionParamsTool) MarshalJSON() (data []byte, err error) {
- type shadow InferenceChatCompletionParamsTool
+func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceChatCompletionParamsTool) UnmarshalJSON(data []byte) error {
+func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Response from a reranking request.
+type InferenceRerankResponseEnvelope struct {
+ // List of rerank result objects, sorted by relevance score (descending)
+ Data []InferenceRerankResponse `json:"data,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 InferenceRerankResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *InferenceRerankResponseEnvelope) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/inference_test.go b/inference_test.go
index f63e2dd..e8cd44a 100644
--- a/inference_test.go
+++ b/inference_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
+func TestInferenceRerankWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,63 +24,15 @@ func TestInferenceChatCompletionWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Inference.ChatCompletion(context.TODO(), llamastackclient.InferenceChatCompletionParams{
- Messages: []llamastackclient.MessageUnionParam{{
- OfUser: &llamastackclient.UserMessageParam{
- Content: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- Context: llamastackclient.InterleavedContentUnionParam{
- OfString: llamastackclient.String("string"),
- },
- },
+ _, err := client.Inference.Rerank(context.TODO(), llamastackclient.InferenceRerankParams{
+ Items: []llamastackclient.InferenceRerankParamsItemUnion{{
+ OfString: llamastackclient.String("string"),
}},
- ModelID: "model_id",
- Logprobs: llamastackclient.InferenceChatCompletionParamsLogprobs{
- TopK: llamastackclient.Int(0),
+ Model: "model",
+ Query: llamastackclient.InferenceRerankParamsQueryUnion{
+ OfString: llamastackclient.String("string"),
},
- ResponseFormat: llamastackclient.ResponseFormatUnionParam{
- OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
- JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
- },
- },
- SamplingParams: llamastackclient.SamplingParams{
- Strategy: llamastackclient.SamplingParamsStrategyUnion{
- OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
- },
- MaxTokens: llamastackclient.Int(0),
- RepetitionPenalty: llamastackclient.Float(0),
- Stop: []string{"string"},
- },
- ToolChoice: llamastackclient.InferenceChatCompletionParamsToolChoiceAuto,
- ToolConfig: llamastackclient.InferenceChatCompletionParamsToolConfig{
- SystemMessageBehavior: "append",
- ToolChoice: "auto",
- ToolPromptFormat: "json",
- },
- ToolPromptFormat: llamastackclient.InferenceChatCompletionParamsToolPromptFormatJson,
- Tools: []llamastackclient.InferenceChatCompletionParamsTool{{
- ToolName: "brave_search",
- Description: llamastackclient.String("description"),
- Parameters: map[string]llamastackclient.ToolParamDefinition{
- "foo": {
- ParamType: "param_type",
- Default: llamastackclient.ToolParamDefinitionDefaultUnion{
- OfBool: llamastackclient.Bool(true),
- },
- Description: llamastackclient.String("description"),
- Items: llamastackclient.ToolParamDefinitionItemsUnion{
- OfBool: llamastackclient.Bool(true),
- },
- Required: llamastackclient.Bool(true),
- Title: llamastackclient.String("title"),
- },
- },
- }},
+ MaxNumResults: llamastackclient.Int(0),
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/shared.go b/shared.go
index 88847bc..2fc29f0 100644
--- a/shared.go
+++ b/shared.go
@@ -418,30 +418,6 @@ func (u *AgentConfigToolgroupAgentToolGroupWithArgsArgUnionParam) asAny() any {
return nil
}
-// Response from a chat completion request.
-type ChatCompletionResponse struct {
- // The complete response message
- CompletionMessage CompletionMessage `json:"completion_message,required"`
- // Optional log probabilities for generated tokens
- Logprobs []TokenLogProbs `json:"logprobs"`
- // (Optional) List of metrics associated with the API response
- Metrics []Metric `json:"metrics"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- CompletionMessage respjson.Field
- Logprobs respjson.Field
- Metrics respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ChatCompletionResponse) RawJSON() string { return r.JSON.raw }
-func (r *ChatCompletionResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A message containing the model's (assistant) response in a chat conversation.
type CompletionMessage struct {
// The content of the model's response
@@ -1722,30 +1698,6 @@ func init() {
)
}
-// A metric value included in API responses.
-type Metric struct {
- // The name of the metric
- Metric string `json:"metric,required"`
- // The numeric value of the metric
- Value float64 `json:"value,required"`
- // (Optional) The unit of measurement for the metric value
- Unit string `json:"unit"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Metric respjson.Field
- Value respjson.Field
- Unit respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r Metric) RawJSON() string { return r.JSON.raw }
-func (r *Metric) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// Configuration for the RAG query generation.
//
// The properties ChunkTemplate, MaxChunks, MaxTokensInContext,
@@ -3446,87 +3398,6 @@ func (u *ToolCallArgumentsMapItemMapItemUnionParam) asAny() any {
return nil
}
-// The property ParamType is required.
-type ToolParamDefinition struct {
- ParamType string `json:"param_type,required"`
- Description param.Opt[string] `json:"description,omitzero"`
- Required param.Opt[bool] `json:"required,omitzero"`
- Title param.Opt[string] `json:"title,omitzero"`
- Default ToolParamDefinitionDefaultUnion `json:"default,omitzero"`
- Items ToolParamDefinitionItemsUnion `json:"items,omitzero"`
- paramObj
-}
-
-func (r ToolParamDefinition) MarshalJSON() (data []byte, err error) {
- type shadow ToolParamDefinition
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ToolParamDefinition) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolParamDefinitionDefaultUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ToolParamDefinitionDefaultUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ToolParamDefinitionDefaultUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ToolParamDefinitionDefaultUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolParamDefinitionItemsUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ToolParamDefinitionItemsUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ToolParamDefinitionItemsUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ToolParamDefinitionItemsUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
// A message representing the result of a tool invocation.
type ToolResponseMessage struct {
// Unique identifier for the tool call this response is for
From a3d6051547ce2b9cbd5af96b6b802515b737e7fb Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 03:36:59 +0000
Subject: [PATCH 19/33] feat(api): updating post /v1/files to have correct
multipart/form-data
---
.stats.yml | 4 +-
README.md | 9 +-
agentturn.go | 206 ++++++++++++++++-
api.md | 4 -
eval.go | 59 ++---
eval_test.go | 16 +-
file.go | 38 ++++
file_test.go | 8 +-
shared.go | 430 +++++++++--------------------------
shared/constant/constants.go | 3 +
toolruntimeragtool_test.go | 4 +-
11 files changed, 403 insertions(+), 378 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index ed58961..20dba32 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 105
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-adcfaad1990d45e42b20e200a9ecc35ee32df5692bd9cd18ae898b0b7728c919.yml
-openapi_spec_hash: 4f532287bafe5da0578a1c1a5e31c952
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-d7bea816190382a93511491e33d1f37f707620926ab133ae8ce0883d763df741.yml
+openapi_spec_hash: f73b3af77108625edae3f25972b9e665
config_hash: 5b643c97c83a497d7d346253f1e175f3
diff --git a/README.md b/README.md
index 63773e2..7836be3 100644
--- a/README.md
+++ b/README.md
@@ -345,17 +345,20 @@ which can be used to wrap any `io.Reader` with the appropriate file name and con
// A file from the file system
file, err := os.Open("/path/to/file")
llamastackclient.FileNewParams{
- File: file,
+ File: file,
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
}
// A file from a string
llamastackclient.FileNewParams{
- File: strings.NewReader("my file contents"),
+ File: strings.NewReader("my file contents"),
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
}
// With a custom filename and contentType
llamastackclient.FileNewParams{
- File: llamastackclient.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
+ File: llamastackclient.NewFile(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
}
```
diff --git a/agentturn.go b/agentturn.go
index f153688..9bb43e5 100644
--- a/agentturn.go
+++ b/agentturn.go
@@ -568,7 +568,7 @@ type TurnResponseEventPayloadUnion struct {
// This field is from variant [TurnResponseEventPayloadStepStart].
Metadata map[string]TurnResponseEventPayloadStepStartMetadataUnion `json:"metadata"`
// This field is from variant [TurnResponseEventPayloadStepProgress].
- Delta ContentDeltaUnion `json:"delta"`
+ Delta TurnResponseEventPayloadStepProgressDeltaUnion `json:"delta"`
// This field is from variant [TurnResponseEventPayloadStepComplete].
StepDetails TurnResponseEventPayloadStepCompleteStepDetailsUnion `json:"step_details"`
// This field is from variant [TurnResponseEventPayloadTurnStart].
@@ -753,7 +753,7 @@ func (r *TurnResponseEventPayloadStepStartMetadataUnion) UnmarshalJSON(data []by
// Payload for step progress events in agent turn responses.
type TurnResponseEventPayloadStepProgress struct {
// Incremental content changes during step execution
- Delta ContentDeltaUnion `json:"delta,required"`
+ Delta TurnResponseEventPayloadStepProgressDeltaUnion `json:"delta,required"`
// Type of event being reported
EventType constant.StepProgress `json:"event_type,required"`
// Unique identifier for the step within a turn
@@ -779,6 +779,208 @@ func (r *TurnResponseEventPayloadStepProgress) UnmarshalJSON(data []byte) error
return apijson.UnmarshalRoot(data, r)
}
+// TurnResponseEventPayloadStepProgressDeltaUnion contains all possible properties
+// and values from [TurnResponseEventPayloadStepProgressDeltaText],
+// [TurnResponseEventPayloadStepProgressDeltaImage],
+// [TurnResponseEventPayloadStepProgressDeltaToolCall].
+//
+// Use the [TurnResponseEventPayloadStepProgressDeltaUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type TurnResponseEventPayloadStepProgressDeltaUnion struct {
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaText].
+ Text string `json:"text"`
+ // Any of "text", "image", "tool_call".
+ Type string `json:"type"`
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaImage].
+ Image string `json:"image"`
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaToolCall].
+ ParseStatus string `json:"parse_status"`
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaToolCall].
+ ToolCall TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion `json:"tool_call"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ Image respjson.Field
+ ParseStatus respjson.Field
+ ToolCall respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyTurnResponseEventPayloadStepProgressDelta is implemented by each variant of
+// [TurnResponseEventPayloadStepProgressDeltaUnion] to add type safety for the
+// return type of [TurnResponseEventPayloadStepProgressDeltaUnion.AsAny]
+type anyTurnResponseEventPayloadStepProgressDelta interface {
+ implTurnResponseEventPayloadStepProgressDeltaUnion()
+}
+
+func (TurnResponseEventPayloadStepProgressDeltaText) implTurnResponseEventPayloadStepProgressDeltaUnion() {
+}
+func (TurnResponseEventPayloadStepProgressDeltaImage) implTurnResponseEventPayloadStepProgressDeltaUnion() {
+}
+func (TurnResponseEventPayloadStepProgressDeltaToolCall) implTurnResponseEventPayloadStepProgressDeltaUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := TurnResponseEventPayloadStepProgressDeltaUnion.AsAny().(type) {
+// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaText:
+// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaImage:
+// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaToolCall:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsAny() anyTurnResponseEventPayloadStepProgressDelta {
+ switch u.Type {
+ case "text":
+ return u.AsText()
+ case "image":
+ return u.AsImage()
+ case "tool_call":
+ return u.AsToolCall()
+ }
+ return nil
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsText() (v TurnResponseEventPayloadStepProgressDeltaText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsImage() (v TurnResponseEventPayloadStepProgressDeltaImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsToolCall() (v TurnResponseEventPayloadStepProgressDeltaToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnResponseEventPayloadStepProgressDeltaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text content delta for streaming responses.
+type TurnResponseEventPayloadStepProgressDeltaText struct {
+ // The incremental text content
+ Text string `json:"text,required"`
+ // Discriminator type of the delta. Always "text"
+ Type constant.Text `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgressDeltaText) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgressDeltaText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image content delta for streaming responses.
+type TurnResponseEventPayloadStepProgressDeltaImage struct {
+ // The incremental image data as bytes
+ Image string `json:"image,required"`
+ // Discriminator type of the delta. Always "image"
+ Type constant.Image `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Image respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgressDeltaImage) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgressDeltaImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call content delta for streaming responses.
+type TurnResponseEventPayloadStepProgressDeltaToolCall struct {
+ // Current parsing status of the tool call
+ //
+ // Any of "started", "in_progress", "failed", "succeeded".
+ ParseStatus string `json:"parse_status,required"`
+ // Either an in-progress tool call string or the final parsed tool call
+ ToolCall TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion `json:"tool_call,required"`
+ // Discriminator type of the delta. Always "tool_call"
+ Type constant.ToolCall `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ParseStatus respjson.Field
+ ToolCall respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgressDeltaToolCall) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgressDeltaToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion contains all
+// possible properties and values from [string], [ToolCall].
+//
+// 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: OfString]
+type TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field is from variant [ToolCall].
+ Arguments ToolCallArgumentsUnion `json:"arguments"`
+ // This field is from variant [ToolCall].
+ CallID string `json:"call_id"`
+ // This field is from variant [ToolCall].
+ ToolName ToolCallToolName `json:"tool_name"`
+ // This field is from variant [ToolCall].
+ ArgumentsJson string `json:"arguments_json"`
+ JSON struct {
+ OfString respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ ToolName respjson.Field
+ ArgumentsJson respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) AsToolCall() (v ToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Payload for step completion events in agent turn responses.
type TurnResponseEventPayloadStepComplete struct {
// Type of event being reported
diff --git a/api.md b/api.md
index e0735ed..57e44e3 100644
--- a/api.md
+++ b/api.md
@@ -7,7 +7,6 @@
- llamastackclient.InterleavedContentItemUnionParam
- llamastackclient.MessageUnionParam
- llamastackclient.QueryConfigParam
-- llamastackclient.QueryGeneratorConfigUnionParam
- llamastackclient.ResponseFormatUnionParam
- llamastackclient.SamplingParams
- llamastackclient.SystemMessageParam
@@ -19,7 +18,6 @@
- llamastackclient.AgentConfig
- llamastackclient.CompletionMessage
-- llamastackclient.ContentDeltaUnion
- llamastackclient.InterleavedContentUnion
- llamastackclient.InterleavedContentItemUnion
- llamastackclient.QueryResult
@@ -162,7 +160,6 @@ Response Types:
- llamastackclient.AgentTurnResponseStreamChunk
- llamastackclient.Turn
- llamastackclient.TurnResponseEvent
-- llamastackclient.TurnResponseEventPayloadUnion
Methods:
@@ -193,7 +190,6 @@ Methods:
Params Types:
- llamastackclient.BenchmarkConfigParam
-- llamastackclient.EvalCandidateUnionParam
Response Types:
diff --git a/eval.go b/eval.go
index ba9511f..e9208b3 100644
--- a/eval.go
+++ b/eval.go
@@ -92,7 +92,7 @@ func (r *EvalService) RunEvalAlpha(ctx context.Context, benchmarkID string, body
// The properties EvalCandidate, ScoringParams are required.
type BenchmarkConfigParam struct {
// The candidate to evaluate.
- EvalCandidate EvalCandidateUnionParam `json:"eval_candidate,omitzero,required"`
+ EvalCandidate BenchmarkConfigEvalCandidateUnionParam `json:"eval_candidate,omitzero,required"`
// Map between scoring function id and parameters for each scoring function you
// want to run
ScoringParams map[string]ScoringFnParamsUnion `json:"scoring_params,omitzero,required"`
@@ -110,36 +110,23 @@ func (r *BenchmarkConfigParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-func EvalCandidateParamOfModel(model string, samplingParams SamplingParams) EvalCandidateUnionParam {
- var variant EvalCandidateModelParam
- variant.Model = model
- variant.SamplingParams = samplingParams
- return EvalCandidateUnionParam{OfModel: &variant}
-}
-
-func EvalCandidateParamOfAgent(config AgentConfigParam) EvalCandidateUnionParam {
- var agent EvalCandidateAgentParam
- agent.Config = config
- return EvalCandidateUnionParam{OfAgent: &agent}
-}
-
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type EvalCandidateUnionParam struct {
- OfModel *EvalCandidateModelParam `json:",omitzero,inline"`
- OfAgent *EvalCandidateAgentParam `json:",omitzero,inline"`
+type BenchmarkConfigEvalCandidateUnionParam struct {
+ OfModel *BenchmarkConfigEvalCandidateModelParam `json:",omitzero,inline"`
+ OfAgent *BenchmarkConfigEvalCandidateAgentParam `json:",omitzero,inline"`
paramUnion
}
-func (u EvalCandidateUnionParam) MarshalJSON() ([]byte, error) {
+func (u BenchmarkConfigEvalCandidateUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfModel, u.OfAgent)
}
-func (u *EvalCandidateUnionParam) UnmarshalJSON(data []byte) error {
+func (u *BenchmarkConfigEvalCandidateUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *EvalCandidateUnionParam) asAny() any {
+func (u *BenchmarkConfigEvalCandidateUnionParam) asAny() any {
if !param.IsOmitted(u.OfModel) {
return u.OfModel
} else if !param.IsOmitted(u.OfAgent) {
@@ -149,7 +136,7 @@ func (u *EvalCandidateUnionParam) asAny() any {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetModel() *string {
+func (u BenchmarkConfigEvalCandidateUnionParam) GetModel() *string {
if vt := u.OfModel; vt != nil {
return &vt.Model
}
@@ -157,7 +144,7 @@ func (u EvalCandidateUnionParam) GetModel() *string {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetSamplingParams() *SamplingParams {
+func (u BenchmarkConfigEvalCandidateUnionParam) GetSamplingParams() *SamplingParams {
if vt := u.OfModel; vt != nil {
return &vt.SamplingParams
}
@@ -165,7 +152,7 @@ func (u EvalCandidateUnionParam) GetSamplingParams() *SamplingParams {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetSystemMessage() *SystemMessageParam {
+func (u BenchmarkConfigEvalCandidateUnionParam) GetSystemMessage() *SystemMessageParam {
if vt := u.OfModel; vt != nil {
return &vt.SystemMessage
}
@@ -173,7 +160,7 @@ func (u EvalCandidateUnionParam) GetSystemMessage() *SystemMessageParam {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetConfig() *AgentConfigParam {
+func (u BenchmarkConfigEvalCandidateUnionParam) GetConfig() *AgentConfigParam {
if vt := u.OfAgent; vt != nil {
return &vt.Config
}
@@ -181,7 +168,7 @@ func (u EvalCandidateUnionParam) GetConfig() *AgentConfigParam {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u EvalCandidateUnionParam) GetType() *string {
+func (u BenchmarkConfigEvalCandidateUnionParam) GetType() *string {
if vt := u.OfModel; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfAgent; vt != nil {
@@ -191,17 +178,17 @@ func (u EvalCandidateUnionParam) GetType() *string {
}
func init() {
- apijson.RegisterUnion[EvalCandidateUnionParam](
+ apijson.RegisterUnion[BenchmarkConfigEvalCandidateUnionParam](
"type",
- apijson.Discriminator[EvalCandidateModelParam]("model"),
- apijson.Discriminator[EvalCandidateAgentParam]("agent"),
+ apijson.Discriminator[BenchmarkConfigEvalCandidateModelParam]("model"),
+ apijson.Discriminator[BenchmarkConfigEvalCandidateAgentParam]("agent"),
)
}
// A model candidate for evaluation.
//
// The properties Model, SamplingParams, Type are required.
-type EvalCandidateModelParam struct {
+type BenchmarkConfigEvalCandidateModelParam struct {
// The model ID to evaluate.
Model string `json:"model,required"`
// The sampling parameters for the model.
@@ -213,18 +200,18 @@ type EvalCandidateModelParam struct {
paramObj
}
-func (r EvalCandidateModelParam) MarshalJSON() (data []byte, err error) {
- type shadow EvalCandidateModelParam
+func (r BenchmarkConfigEvalCandidateModelParam) MarshalJSON() (data []byte, err error) {
+ type shadow BenchmarkConfigEvalCandidateModelParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EvalCandidateModelParam) UnmarshalJSON(data []byte) error {
+func (r *BenchmarkConfigEvalCandidateModelParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// An agent candidate for evaluation.
//
// The properties Config, Type are required.
-type EvalCandidateAgentParam struct {
+type BenchmarkConfigEvalCandidateAgentParam struct {
// The configuration for the agent candidate.
Config AgentConfigParam `json:"config,omitzero,required"`
// This field can be elided, and will marshal its zero value as "agent".
@@ -232,11 +219,11 @@ type EvalCandidateAgentParam struct {
paramObj
}
-func (r EvalCandidateAgentParam) MarshalJSON() (data []byte, err error) {
- type shadow EvalCandidateAgentParam
+func (r BenchmarkConfigEvalCandidateAgentParam) MarshalJSON() (data []byte, err error) {
+ type shadow BenchmarkConfigEvalCandidateAgentParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EvalCandidateAgentParam) UnmarshalJSON(data []byte) error {
+func (r *BenchmarkConfigEvalCandidateAgentParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/eval_test.go b/eval_test.go
index 407c1d4..f3d1608 100644
--- a/eval_test.go
+++ b/eval_test.go
@@ -29,8 +29,8 @@ func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
"benchmark_id",
llamastackclient.EvalEvaluateRowsParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
- EvalCandidate: llamastackclient.EvalCandidateUnionParam{
- OfModel: &llamastackclient.EvalCandidateModelParam{
+ EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
+ OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
Model: "model",
SamplingParams: llamastackclient.SamplingParams{
Strategy: llamastackclient.SamplingParamsStrategyUnion{
@@ -92,8 +92,8 @@ func TestEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
"benchmark_id",
llamastackclient.EvalEvaluateRowsAlphaParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
- EvalCandidate: llamastackclient.EvalCandidateUnionParam{
- OfModel: &llamastackclient.EvalCandidateModelParam{
+ EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
+ OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
Model: "model",
SamplingParams: llamastackclient.SamplingParams{
Strategy: llamastackclient.SamplingParamsStrategyUnion{
@@ -155,8 +155,8 @@ func TestEvalRunEvalWithOptionalParams(t *testing.T) {
"benchmark_id",
llamastackclient.EvalRunEvalParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
- EvalCandidate: llamastackclient.EvalCandidateUnionParam{
- OfModel: &llamastackclient.EvalCandidateModelParam{
+ EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
+ OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
Model: "model",
SamplingParams: llamastackclient.SamplingParams{
Strategy: llamastackclient.SamplingParamsStrategyUnion{
@@ -212,8 +212,8 @@ func TestEvalRunEvalAlphaWithOptionalParams(t *testing.T) {
"benchmark_id",
llamastackclient.EvalRunEvalAlphaParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
- EvalCandidate: llamastackclient.EvalCandidateUnionParam{
- OfModel: &llamastackclient.EvalCandidateModelParam{
+ EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
+ OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
Model: "model",
SamplingParams: llamastackclient.SamplingParams{
Strategy: llamastackclient.SamplingParamsStrategyUnion{
diff --git a/file.go b/file.go
index 06bc438..49fbbe3 100644
--- a/file.go
+++ b/file.go
@@ -219,6 +219,15 @@ type FileContentResponse = any
type FileNewParams struct {
File io.Reader `json:"file,omitzero,required" format:"binary"`
+ // Valid purpose values for OpenAI Files API.
+ //
+ // Any of "assistants", "batch".
+ Purpose FileNewParamsPurpose `json:"purpose,omitzero,required"`
+ // Control expiration of uploaded files. Params:
+ //
+ // - anchor, must be "created_at"
+ // - seconds, must be int between 3600 and 2592000 (1 hour to 30 days)
+ ExpiresAfter FileNewParamsExpiresAfter `json:"expires_after,omitzero"`
paramObj
}
@@ -240,6 +249,35 @@ func (r FileNewParams) MarshalMultipart() (data []byte, contentType string, err
return buf.Bytes(), writer.FormDataContentType(), nil
}
+// Valid purpose values for OpenAI Files API.
+type FileNewParamsPurpose string
+
+const (
+ FileNewParamsPurposeAssistants FileNewParamsPurpose = "assistants"
+ FileNewParamsPurposeBatch FileNewParamsPurpose = "batch"
+)
+
+// Control expiration of uploaded files. Params:
+//
+// - anchor, must be "created_at"
+// - seconds, must be int between 3600 and 2592000 (1 hour to 30 days)
+//
+// The properties Anchor, Seconds are required.
+type FileNewParamsExpiresAfter struct {
+ Seconds int64 `json:"seconds,required"`
+ // This field can be elided, and will marshal its zero value as "created_at".
+ Anchor constant.CreatedAt `json:"anchor,required"`
+ paramObj
+}
+
+func (r FileNewParamsExpiresAfter) MarshalJSON() (data []byte, err error) {
+ type shadow FileNewParamsExpiresAfter
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *FileNewParamsExpiresAfter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type FileListParams struct {
// A cursor for use in pagination. `after` is an object ID that defines your place
// in the list. For instance, if you make a list request and receive 100 objects,
diff --git a/file_test.go b/file_test.go
index f417f09..d00c0a7 100644
--- a/file_test.go
+++ b/file_test.go
@@ -15,7 +15,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestFileNew(t *testing.T) {
+func TestFileNewWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -27,7 +27,11 @@ func TestFileNew(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Files.New(context.TODO(), llamastackclient.FileNewParams{
- File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
+ File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
+ Purpose: llamastackclient.FileNewParamsPurposeAssistants,
+ ExpiresAfter: llamastackclient.FileNewParamsExpiresAfter{
+ Seconds: 0,
+ },
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/shared.go b/shared.go
index 2fc29f0..f87b0a5 100644
--- a/shared.go
+++ b/shared.go
@@ -507,201 +507,6 @@ func (r *CompletionMessageParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ContentDeltaUnion contains all possible properties and values from
-// [ContentDeltaText], [ContentDeltaImage], [ContentDeltaToolCall].
-//
-// Use the [ContentDeltaUnion.AsAny] method to switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ContentDeltaUnion struct {
- // This field is from variant [ContentDeltaText].
- Text string `json:"text"`
- // Any of "text", "image", "tool_call".
- Type string `json:"type"`
- // This field is from variant [ContentDeltaImage].
- Image string `json:"image"`
- // This field is from variant [ContentDeltaToolCall].
- ParseStatus string `json:"parse_status"`
- // This field is from variant [ContentDeltaToolCall].
- ToolCall ContentDeltaToolCallToolCallUnion `json:"tool_call"`
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- Image respjson.Field
- ParseStatus respjson.Field
- ToolCall respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyContentDelta is implemented by each variant of [ContentDeltaUnion] to add
-// type safety for the return type of [ContentDeltaUnion.AsAny]
-type anyContentDelta interface {
- implContentDeltaUnion()
-}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ContentDeltaUnion.AsAny().(type) {
-// case llamastackclient.ContentDeltaText:
-// case llamastackclient.ContentDeltaImage:
-// case llamastackclient.ContentDeltaToolCall:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ContentDeltaUnion) AsAny() anyContentDelta {
- switch u.Type {
- case "text":
- return u.AsText()
- case "image":
- return u.AsImage()
- case "tool_call":
- return u.AsToolCall()
- }
- return nil
-}
-
-func (u ContentDeltaUnion) AsText() (v ContentDeltaText) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ContentDeltaUnion) AsImage() (v ContentDeltaImage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ContentDeltaUnion) AsToolCall() (v ContentDeltaToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ContentDeltaUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ContentDeltaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A text content delta for streaming responses.
-type ContentDeltaText struct {
- // The incremental text content
- Text string `json:"text,required"`
- // Discriminator type of the delta. Always "text"
- Type constant.Text `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ContentDeltaText) RawJSON() string { return r.JSON.raw }
-func (r *ContentDeltaText) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (ContentDeltaText) implContentDeltaUnion() {}
-
-// An image content delta for streaming responses.
-type ContentDeltaImage struct {
- // The incremental image data as bytes
- Image string `json:"image,required"`
- // Discriminator type of the delta. Always "image"
- Type constant.Image `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Image respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ContentDeltaImage) RawJSON() string { return r.JSON.raw }
-func (r *ContentDeltaImage) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (ContentDeltaImage) implContentDeltaUnion() {}
-
-// A tool call content delta for streaming responses.
-type ContentDeltaToolCall struct {
- // Current parsing status of the tool call
- //
- // Any of "started", "in_progress", "failed", "succeeded".
- ParseStatus string `json:"parse_status,required"`
- // Either an in-progress tool call string or the final parsed tool call
- ToolCall ContentDeltaToolCallToolCallUnion `json:"tool_call,required"`
- // Discriminator type of the delta. Always "tool_call"
- Type constant.ToolCall `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ParseStatus respjson.Field
- ToolCall respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ContentDeltaToolCall) RawJSON() string { return r.JSON.raw }
-func (r *ContentDeltaToolCall) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (ContentDeltaToolCall) implContentDeltaUnion() {}
-
-// ContentDeltaToolCallToolCallUnion contains all possible properties and values
-// from [string], [ToolCall].
-//
-// 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: OfString]
-type ContentDeltaToolCallToolCallUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field is from variant [ToolCall].
- Arguments ToolCallArgumentsUnion `json:"arguments"`
- // This field is from variant [ToolCall].
- CallID string `json:"call_id"`
- // This field is from variant [ToolCall].
- ToolName ToolCallToolName `json:"tool_name"`
- // This field is from variant [ToolCall].
- ArgumentsJson string `json:"arguments_json"`
- JSON struct {
- OfString respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- ToolName respjson.Field
- ArgumentsJson respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ContentDeltaToolCallToolCallUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ContentDeltaToolCallToolCallUnion) AsToolCall() (v ToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ContentDeltaToolCallToolCallUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ContentDeltaToolCallToolCallUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// A document to be used for document ingestion in the RAG Tool.
//
// The properties Content, DocumentID, Metadata are required.
@@ -1713,7 +1518,7 @@ type QueryConfigParam struct {
// Maximum number of tokens in the context.
MaxTokensInContext int64 `json:"max_tokens_in_context,required"`
// Configuration for the query generator.
- QueryGeneratorConfig QueryGeneratorConfigUnionParam `json:"query_generator_config,omitzero,required"`
+ QueryGeneratorConfig QueryConfigQueryGeneratorConfigUnionParam `json:"query_generator_config,omitzero,required"`
// Search mode for retrieval—either "vector", "keyword", or "hybrid". Default
// "vector".
//
@@ -1732,240 +1537,227 @@ func (r *QueryConfigParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Search mode for retrieval—either "vector", "keyword", or "hybrid". Default
-// "vector".
-type QueryConfigMode string
-
-const (
- QueryConfigModeVector QueryConfigMode = "vector"
- QueryConfigModeKeyword QueryConfigMode = "keyword"
- QueryConfigModeHybrid QueryConfigMode = "hybrid"
-)
-
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type QueryConfigRankerUnionParam struct {
- OfRrf *QueryConfigRankerRrfParam `json:",omitzero,inline"`
- OfWeighted *QueryConfigRankerWeightedParam `json:",omitzero,inline"`
+type QueryConfigQueryGeneratorConfigUnionParam struct {
+ OfDefault *QueryConfigQueryGeneratorConfigDefaultParam `json:",omitzero,inline"`
+ OfLlm *QueryConfigQueryGeneratorConfigLlmParam `json:",omitzero,inline"`
paramUnion
}
-func (u QueryConfigRankerUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfRrf, u.OfWeighted)
+func (u QueryConfigQueryGeneratorConfigUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfDefault, u.OfLlm)
}
-func (u *QueryConfigRankerUnionParam) UnmarshalJSON(data []byte) error {
+func (u *QueryConfigQueryGeneratorConfigUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *QueryConfigRankerUnionParam) asAny() any {
- if !param.IsOmitted(u.OfRrf) {
- return u.OfRrf
- } else if !param.IsOmitted(u.OfWeighted) {
- return u.OfWeighted
+func (u *QueryConfigQueryGeneratorConfigUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfDefault) {
+ return u.OfDefault
+ } else if !param.IsOmitted(u.OfLlm) {
+ return u.OfLlm
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u QueryConfigRankerUnionParam) GetImpactFactor() *float64 {
- if vt := u.OfRrf; vt != nil {
- return &vt.ImpactFactor
+func (u QueryConfigQueryGeneratorConfigUnionParam) GetSeparator() *string {
+ if vt := u.OfDefault; vt != nil {
+ return &vt.Separator
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u QueryConfigRankerUnionParam) GetAlpha() *float64 {
- if vt := u.OfWeighted; vt != nil {
- return &vt.Alpha
+func (u QueryConfigQueryGeneratorConfigUnionParam) GetModel() *string {
+ if vt := u.OfLlm; vt != nil {
+ return &vt.Model
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u QueryConfigRankerUnionParam) GetType() *string {
- if vt := u.OfRrf; vt != nil {
+func (u QueryConfigQueryGeneratorConfigUnionParam) GetTemplate() *string {
+ if vt := u.OfLlm; vt != nil {
+ return &vt.Template
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u QueryConfigQueryGeneratorConfigUnionParam) GetType() *string {
+ if vt := u.OfDefault; vt != nil {
return (*string)(&vt.Type)
- } else if vt := u.OfWeighted; vt != nil {
+ } else if vt := u.OfLlm; vt != nil {
return (*string)(&vt.Type)
}
return nil
}
func init() {
- apijson.RegisterUnion[QueryConfigRankerUnionParam](
+ apijson.RegisterUnion[QueryConfigQueryGeneratorConfigUnionParam](
"type",
- apijson.Discriminator[QueryConfigRankerRrfParam]("rrf"),
- apijson.Discriminator[QueryConfigRankerWeightedParam]("weighted"),
+ apijson.Discriminator[QueryConfigQueryGeneratorConfigDefaultParam]("default"),
+ apijson.Discriminator[QueryConfigQueryGeneratorConfigLlmParam]("llm"),
)
}
-// Reciprocal Rank Fusion (RRF) ranker configuration.
+// Configuration for the default RAG query generator.
//
-// The properties ImpactFactor, Type are required.
-type QueryConfigRankerRrfParam struct {
- // The impact factor for RRF scoring. Higher values give more weight to
- // higher-ranked results. Must be greater than 0
- ImpactFactor float64 `json:"impact_factor,required"`
- // The type of ranker, always "rrf"
+// The properties Separator, Type are required.
+type QueryConfigQueryGeneratorConfigDefaultParam struct {
+ // String separator used to join query terms
+ Separator string `json:"separator,required"`
+ // Type of query generator, always 'default'
//
- // This field can be elided, and will marshal its zero value as "rrf".
- Type constant.Rrf `json:"type,required"`
+ // This field can be elided, and will marshal its zero value as "default".
+ Type constant.Default `json:"type,required"`
paramObj
}
-func (r QueryConfigRankerRrfParam) MarshalJSON() (data []byte, err error) {
- type shadow QueryConfigRankerRrfParam
+func (r QueryConfigQueryGeneratorConfigDefaultParam) MarshalJSON() (data []byte, err error) {
+ type shadow QueryConfigQueryGeneratorConfigDefaultParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *QueryConfigRankerRrfParam) UnmarshalJSON(data []byte) error {
+func (r *QueryConfigQueryGeneratorConfigDefaultParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Weighted ranker configuration that combines vector and keyword scores.
+// Configuration for the LLM-based RAG query generator.
//
-// The properties Alpha, Type are required.
-type QueryConfigRankerWeightedParam struct {
- // Weight factor between 0 and 1. 0 means only use keyword scores, 1 means only use
- // vector scores, values in between blend both scores.
- Alpha float64 `json:"alpha,required"`
- // The type of ranker, always "weighted"
+// The properties Model, Template, Type are required.
+type QueryConfigQueryGeneratorConfigLlmParam struct {
+ // Name of the language model to use for query generation
+ Model string `json:"model,required"`
+ // Template string for formatting the query generation prompt
+ Template string `json:"template,required"`
+ // Type of query generator, always 'llm'
//
- // This field can be elided, and will marshal its zero value as "weighted".
- Type constant.Weighted `json:"type,required"`
+ // This field can be elided, and will marshal its zero value as "llm".
+ Type constant.Llm `json:"type,required"`
paramObj
}
-func (r QueryConfigRankerWeightedParam) MarshalJSON() (data []byte, err error) {
- type shadow QueryConfigRankerWeightedParam
+func (r QueryConfigQueryGeneratorConfigLlmParam) MarshalJSON() (data []byte, err error) {
+ type shadow QueryConfigQueryGeneratorConfigLlmParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *QueryConfigRankerWeightedParam) UnmarshalJSON(data []byte) error {
+func (r *QueryConfigQueryGeneratorConfigLlmParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-func QueryGeneratorConfigParamOfDefault(separator string) QueryGeneratorConfigUnionParam {
- var default_ QueryGeneratorConfigDefaultParam
- default_.Separator = separator
- return QueryGeneratorConfigUnionParam{OfDefault: &default_}
-}
+// Search mode for retrieval—either "vector", "keyword", or "hybrid". Default
+// "vector".
+type QueryConfigMode string
-func QueryGeneratorConfigParamOfLlm(model string, template string) QueryGeneratorConfigUnionParam {
- var llm QueryGeneratorConfigLlmParam
- llm.Model = model
- llm.Template = template
- return QueryGeneratorConfigUnionParam{OfLlm: &llm}
-}
+const (
+ QueryConfigModeVector QueryConfigMode = "vector"
+ QueryConfigModeKeyword QueryConfigMode = "keyword"
+ QueryConfigModeHybrid QueryConfigMode = "hybrid"
+)
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type QueryGeneratorConfigUnionParam struct {
- OfDefault *QueryGeneratorConfigDefaultParam `json:",omitzero,inline"`
- OfLlm *QueryGeneratorConfigLlmParam `json:",omitzero,inline"`
+type QueryConfigRankerUnionParam struct {
+ OfRrf *QueryConfigRankerRrfParam `json:",omitzero,inline"`
+ OfWeighted *QueryConfigRankerWeightedParam `json:",omitzero,inline"`
paramUnion
}
-func (u QueryGeneratorConfigUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfDefault, u.OfLlm)
+func (u QueryConfigRankerUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfRrf, u.OfWeighted)
}
-func (u *QueryGeneratorConfigUnionParam) UnmarshalJSON(data []byte) error {
+func (u *QueryConfigRankerUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *QueryGeneratorConfigUnionParam) asAny() any {
- if !param.IsOmitted(u.OfDefault) {
- return u.OfDefault
- } else if !param.IsOmitted(u.OfLlm) {
- return u.OfLlm
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u QueryGeneratorConfigUnionParam) GetSeparator() *string {
- if vt := u.OfDefault; vt != nil {
- return &vt.Separator
+func (u *QueryConfigRankerUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfRrf) {
+ return u.OfRrf
+ } else if !param.IsOmitted(u.OfWeighted) {
+ return u.OfWeighted
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u QueryGeneratorConfigUnionParam) GetModel() *string {
- if vt := u.OfLlm; vt != nil {
- return &vt.Model
+func (u QueryConfigRankerUnionParam) GetImpactFactor() *float64 {
+ if vt := u.OfRrf; vt != nil {
+ return &vt.ImpactFactor
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u QueryGeneratorConfigUnionParam) GetTemplate() *string {
- if vt := u.OfLlm; vt != nil {
- return &vt.Template
+func (u QueryConfigRankerUnionParam) GetAlpha() *float64 {
+ if vt := u.OfWeighted; vt != nil {
+ return &vt.Alpha
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u QueryGeneratorConfigUnionParam) GetType() *string {
- if vt := u.OfDefault; vt != nil {
+func (u QueryConfigRankerUnionParam) GetType() *string {
+ if vt := u.OfRrf; vt != nil {
return (*string)(&vt.Type)
- } else if vt := u.OfLlm; vt != nil {
+ } else if vt := u.OfWeighted; vt != nil {
return (*string)(&vt.Type)
}
return nil
}
func init() {
- apijson.RegisterUnion[QueryGeneratorConfigUnionParam](
+ apijson.RegisterUnion[QueryConfigRankerUnionParam](
"type",
- apijson.Discriminator[QueryGeneratorConfigDefaultParam]("default"),
- apijson.Discriminator[QueryGeneratorConfigLlmParam]("llm"),
+ apijson.Discriminator[QueryConfigRankerRrfParam]("rrf"),
+ apijson.Discriminator[QueryConfigRankerWeightedParam]("weighted"),
)
}
-// Configuration for the default RAG query generator.
+// Reciprocal Rank Fusion (RRF) ranker configuration.
//
-// The properties Separator, Type are required.
-type QueryGeneratorConfigDefaultParam struct {
- // String separator used to join query terms
- Separator string `json:"separator,required"`
- // Type of query generator, always 'default'
+// The properties ImpactFactor, Type are required.
+type QueryConfigRankerRrfParam struct {
+ // The impact factor for RRF scoring. Higher values give more weight to
+ // higher-ranked results. Must be greater than 0
+ ImpactFactor float64 `json:"impact_factor,required"`
+ // The type of ranker, always "rrf"
//
- // This field can be elided, and will marshal its zero value as "default".
- Type constant.Default `json:"type,required"`
+ // This field can be elided, and will marshal its zero value as "rrf".
+ Type constant.Rrf `json:"type,required"`
paramObj
}
-func (r QueryGeneratorConfigDefaultParam) MarshalJSON() (data []byte, err error) {
- type shadow QueryGeneratorConfigDefaultParam
+func (r QueryConfigRankerRrfParam) MarshalJSON() (data []byte, err error) {
+ type shadow QueryConfigRankerRrfParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *QueryGeneratorConfigDefaultParam) UnmarshalJSON(data []byte) error {
+func (r *QueryConfigRankerRrfParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Configuration for the LLM-based RAG query generator.
+// Weighted ranker configuration that combines vector and keyword scores.
//
-// The properties Model, Template, Type are required.
-type QueryGeneratorConfigLlmParam struct {
- // Name of the language model to use for query generation
- Model string `json:"model,required"`
- // Template string for formatting the query generation prompt
- Template string `json:"template,required"`
- // Type of query generator, always 'llm'
+// The properties Alpha, Type are required.
+type QueryConfigRankerWeightedParam struct {
+ // Weight factor between 0 and 1. 0 means only use keyword scores, 1 means only use
+ // vector scores, values in between blend both scores.
+ Alpha float64 `json:"alpha,required"`
+ // The type of ranker, always "weighted"
//
- // This field can be elided, and will marshal its zero value as "llm".
- Type constant.Llm `json:"type,required"`
+ // This field can be elided, and will marshal its zero value as "weighted".
+ Type constant.Weighted `json:"type,required"`
paramObj
}
-func (r QueryGeneratorConfigLlmParam) MarshalJSON() (data []byte, err error) {
- type shadow QueryGeneratorConfigLlmParam
+func (r QueryConfigRankerWeightedParam) MarshalJSON() (data []byte, err error) {
+ type shadow QueryConfigRankerWeightedParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *QueryGeneratorConfigLlmParam) UnmarshalJSON(data []byte) error {
+func (r *QueryConfigRankerWeightedParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index 9a0304b..3d4d419 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -31,6 +31,7 @@ type ChatCompletion string // Always "chat.completion"
type ChatCompletionChunk string // Always "chat.completion.chunk"
type CompletionInput string // Always "completion_input"
type ContainerFileCitation string // Always "container_file_citation"
+type CreatedAt string // Always "created_at"
type Dataset string // Always "dataset"
type Default string // Always "default"
type Developer string // Always "developer"
@@ -139,6 +140,7 @@ func (c ChatCompletion) Default() ChatCompletion { return "chat.co
func (c ChatCompletionChunk) Default() ChatCompletionChunk { return "chat.completion.chunk" }
func (c CompletionInput) Default() CompletionInput { return "completion_input" }
func (c ContainerFileCitation) Default() ContainerFileCitation { return "container_file_citation" }
+func (c CreatedAt) Default() CreatedAt { return "created_at" }
func (c Dataset) Default() Dataset { return "dataset" }
func (c Default) Default() Default { return "default" }
func (c Developer) Default() Developer { return "developer" }
@@ -279,6 +281,7 @@ func (c ChatCompletion) MarshalJSON() ([]byte, error) { retu
func (c ChatCompletionChunk) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c CompletionInput) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c ContainerFileCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c CreatedAt) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Dataset) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Default) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Developer) MarshalJSON() ([]byte, error) { return marshalString(c) }
diff --git a/toolruntimeragtool_test.go b/toolruntimeragtool_test.go
index a0a2c54..670e0e3 100644
--- a/toolruntimeragtool_test.go
+++ b/toolruntimeragtool_test.go
@@ -69,8 +69,8 @@ func TestToolRuntimeRagToolQueryWithOptionalParams(t *testing.T) {
ChunkTemplate: "chunk_template",
MaxChunks: 0,
MaxTokensInContext: 0,
- QueryGeneratorConfig: llamastackclient.QueryGeneratorConfigUnionParam{
- OfDefault: &llamastackclient.QueryGeneratorConfigDefaultParam{
+ QueryGeneratorConfig: llamastackclient.QueryConfigQueryGeneratorConfigUnionParam{
+ OfDefault: &llamastackclient.QueryConfigQueryGeneratorConfigDefaultParam{
Separator: "separator",
},
},
From 245c643bb01b573243c31bea5f66761ef7e3fba1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 03:38:23 +0000
Subject: [PATCH 20/33] docs: update examples
---
.stats.yml | 2 +-
README.md | 59 ++++++++++++++++++++++---
client_test.go | 114 +++++++++++++++++++++++++++++++++++++++++--------
3 files changed, 150 insertions(+), 25 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 20dba32..36fa92d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 105
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-d7bea816190382a93511491e33d1f37f707620926ab133ae8ce0883d763df741.yml
openapi_spec_hash: f73b3af77108625edae3f25972b9e665
-config_hash: 5b643c97c83a497d7d346253f1e175f3
+config_hash: 06f95bf1b7786cfe2470af8f238fc36d
diff --git a/README.md b/README.md
index 7836be3..fdf215f 100644
--- a/README.md
+++ b/README.md
@@ -265,7 +265,7 @@ client := llamastackclient.NewClient(
option.WithHeader("X-Some-Header", "custom_header_info"),
)
-client.Toolgroups.List(context.TODO(), ...,
+client.Chat.Completions.New(context.TODO(), ...,
// Override the header
option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
// Add an undocumented field to the request body, using sjson syntax
@@ -296,14 +296,23 @@ When the API returns a non-success status code, we return an error with type
To handle errors, we recommend that you use the `errors.As` pattern:
```go
-_, err := client.Toolgroups.List(context.TODO())
+_, err := client.Chat.Completions.New(context.TODO(), llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+})
if err != nil {
var apierr *llamastackclient.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
}
- panic(err.Error()) // GET "/v1/toolgroups": 400 Bad Request { ... }
+ panic(err.Error()) // GET "/v1/chat/completions": 400 Bad Request { ... }
}
```
@@ -321,8 +330,18 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
-client.Toolgroups.List(
+client.Chat.Completions.New(
ctx,
+ llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ },
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
)
@@ -377,7 +396,20 @@ client := llamastackclient.NewClient(
)
// Override per-request:
-client.Toolgroups.List(context.TODO(), option.WithMaxRetries(5))
+client.Chat.Completions.New(
+ context.TODO(),
+ llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ },
+ option.WithMaxRetries(5),
+)
```
### Accessing raw response data (e.g. response headers)
@@ -388,11 +420,24 @@ you need to examine response headers, status codes, or other details.
```go
// Create a variable to store the HTTP response
var response *http.Response
-toolGroups, err := client.Toolgroups.List(context.TODO(), option.WithResponseInto(&response))
+completion, err := client.Chat.Completions.New(
+ context.TODO(),
+ llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ },
+ option.WithResponseInto(&response),
+)
if err != nil {
// handle error
}
-fmt.Printf("%+v\n", toolGroups)
+fmt.Printf("%+v\n", completion)
fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
diff --git a/client_test.go b/client_test.go
index 043643a..f518596 100644
--- a/client_test.go
+++ b/client_test.go
@@ -38,7 +38,16 @@ func TestUserAgentHeader(t *testing.T) {
},
}),
)
- client.Toolgroups.List(context.Background())
+ client.Chat.Completions.New(context.Background(), llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if userAgent != fmt.Sprintf("LlamaStackClient/Go %s", internal.PackageVersion) {
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
}
@@ -61,7 +70,16 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
- _, err := client.Toolgroups.List(context.Background())
+ _, err := client.Chat.Completions.New(context.Background(), llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -95,7 +113,16 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
- _, err := client.Toolgroups.List(context.Background())
+ _, err := client.Chat.Completions.New(context.Background(), llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -124,7 +151,16 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
- _, err := client.Toolgroups.List(context.Background())
+ _, err := client.Chat.Completions.New(context.Background(), llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -152,7 +188,16 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
- _, err := client.Toolgroups.List(context.Background())
+ _, err := client.Chat.Completions.New(context.Background(), llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -174,7 +219,16 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
- _, err := client.Toolgroups.List(cancelCtx)
+ _, err := client.Chat.Completions.New(cancelCtx, llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -193,7 +247,16 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
- _, err := client.Toolgroups.List(cancelCtx)
+ _, err := client.Chat.Completions.New(cancelCtx, llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("expected there to be a cancel error")
}
@@ -218,7 +281,16 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
- _, err := client.Toolgroups.List(deadlineCtx)
+ _, err := client.Chat.Completions.New(deadlineCtx, llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
+ Model: "model",
+ })
if err == nil {
t.Error("expected there to be a deadline error")
}
@@ -262,10 +334,14 @@ func TestContextDeadlineStreaming(t *testing.T) {
},
}),
)
- stream := client.Responses.NewStreaming(deadlineCtx, llamastackclient.ResponseNewParams{
- Input: llamastackclient.ResponseNewParamsInputUnion{
- OfString: llamastackclient.String("string"),
- },
+ stream := client.Chat.Completions.NewStreaming(deadlineCtx, llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
Model: "model",
})
for stream.Next() {
@@ -311,12 +387,16 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
},
}),
)
- stream := client.Responses.NewStreaming(
+ stream := client.Chat.Completions.NewStreaming(
context.Background(),
- llamastackclient.ResponseNewParams{
- Input: llamastackclient.ResponseNewParamsInputUnion{
- OfString: llamastackclient.String("string"),
- },
+ llamastackclient.ChatCompletionNewParams{
+ Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
+ OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
+ Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ },
+ }},
Model: "model",
},
option.WithRequestTimeout((100 * time.Millisecond)),
From 55b38d575f59c4e55ea00da7700f433b901091cf Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 03:39:26 +0000
Subject: [PATCH 21/33] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 36fa92d..755df45 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 105
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-d7bea816190382a93511491e33d1f37f707620926ab133ae8ce0883d763df741.yml
openapi_spec_hash: f73b3af77108625edae3f25972b9e665
-config_hash: 06f95bf1b7786cfe2470af8f238fc36d
+config_hash: 548f336ac1b68ab1dfe385b79df764dd
From 2060878c2b6b81c76b65f56dab6d699df12fb7d0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 17:55:44 +0000
Subject: [PATCH 22/33] feat(api): SDKs for vector store file batches
---
.stats.yml | 8 +--
api.md | 7 +--
file.go | 48 ----------------
file_test.go | 42 --------------
vectorstore.go | 6 +-
vectorstorefile.go | 121 ----------------------------------------
vectorstorefile_test.go | 27 ---------
vectorstorefilebatch.go | 26 +++++++++
8 files changed, 36 insertions(+), 249 deletions(-)
create mode 100644 vectorstorefilebatch.go
diff --git a/.stats.yml b/.stats.yml
index 755df45..cbb0181 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 105
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-d7bea816190382a93511491e33d1f37f707620926ab133ae8ce0883d763df741.yml
-openapi_spec_hash: f73b3af77108625edae3f25972b9e665
-config_hash: 548f336ac1b68ab1dfe385b79df764dd
+configured_endpoints: 102
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-3c569913f686c852ab392d470b9d905cc944d5a46a2324a21aa1376fb24e6714.yml
+openapi_spec_hash: 455f397c5f401ea425a4064bb39c6801
+config_hash: 53c09ba1fdae5045de1860c479a51dc7
diff --git a/api.md b/api.md
index 57e44e3..aa4d82e 100644
--- a/api.md
+++ b/api.md
@@ -325,7 +325,6 @@ Response Types:
- llamastackclient.VectorStoreFile
- llamastackclient.VectorStoreFileDeleteResponse
-- llamastackclient.VectorStoreFileContentResponse
Methods:
@@ -334,7 +333,8 @@ Methods:
- client.VectorStores.Files.Update(ctx context.Context, fileID string, params llamastackclient.VectorStoreFileUpdateParams) (llamastackclient.VectorStoreFile, error)
- client.VectorStores.Files.List(ctx context.Context, vectorStoreID string, query llamastackclient.VectorStoreFileListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
- client.VectorStores.Files.Delete(ctx context.Context, fileID string, body llamastackclient.VectorStoreFileDeleteParams) (llamastackclient.VectorStoreFileDeleteResponse, error)
-- client.VectorStores.Files.Content(ctx context.Context, fileID string, query llamastackclient.VectorStoreFileContentParams) (llamastackclient.VectorStoreFileContentResponse, error)
+
+## FileBatches
# Models
@@ -525,7 +525,6 @@ Methods:
Response Types:
-- llamastackclient.DeleteFileResponse
- llamastackclient.File
- llamastackclient.ListFilesResponse
- llamastackclient.FileContentResponse
@@ -533,7 +532,5 @@ Response Types:
Methods:
- client.Files.New(ctx context.Context, body llamastackclient.FileNewParams) (llamastackclient.File, error)
-- client.Files.Get(ctx context.Context, fileID string) (llamastackclient.File, error)
- client.Files.List(ctx context.Context, query llamastackclient.FileListParams) (pagination.OpenAICursorPage[llamastackclient.File], error)
-- client.Files.Delete(ctx context.Context, fileID string) (llamastackclient.DeleteFileResponse, error)
- client.Files.Content(ctx context.Context, fileID string) (llamastackclient.FileContentResponse, error)
diff --git a/file.go b/file.go
index 49fbbe3..9e9305c 100644
--- a/file.go
+++ b/file.go
@@ -56,18 +56,6 @@ func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...optio
return
}
-// Returns information about a specific file.
-func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *File, err error) {
- opts = slices.Concat(r.Options, opts)
- if fileID == "" {
- err = errors.New("missing required file_id parameter")
- return
- }
- path := fmt.Sprintf("v1/files/%s", fileID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
// Returns a list of files that belong to the user's organization.
func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[File], err error) {
var raw *http.Response
@@ -91,18 +79,6 @@ func (r *FileService) ListAutoPaging(ctx context.Context, query FileListParams,
return pagination.NewOpenAICursorPageAutoPager(r.List(ctx, query, opts...))
}
-// Delete a file.
-func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (res *DeleteFileResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- if fileID == "" {
- err = errors.New("missing required file_id parameter")
- return
- }
- path := fmt.Sprintf("v1/files/%s", fileID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
- return
-}
-
// Returns the contents of the specified file.
func (r *FileService) Content(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileContentResponse, err error) {
opts = slices.Concat(r.Options, opts)
@@ -115,30 +91,6 @@ func (r *FileService) Content(ctx context.Context, fileID string, opts ...option
return
}
-// Response for deleting a file in OpenAI Files API.
-type DeleteFileResponse struct {
- // The file identifier that was deleted
- ID string `json:"id,required"`
- // Whether the file was successfully deleted
- Deleted bool `json:"deleted,required"`
- // The object type, which is always "file"
- Object constant.File `json:"object,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Deleted respjson.Field
- Object respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DeleteFileResponse) RawJSON() string { return r.JSON.raw }
-func (r *DeleteFileResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// OpenAI File object as defined in the OpenAI Files API.
type File struct {
// The file identifier, which can be referenced in the API endpoints
diff --git a/file_test.go b/file_test.go
index d00c0a7..21a87b1 100644
--- a/file_test.go
+++ b/file_test.go
@@ -42,27 +42,6 @@ func TestFileNewWithOptionalParams(t *testing.T) {
}
}
-func TestFileGet(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Files.Get(context.TODO(), "file_id")
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
func TestFileListWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -89,27 +68,6 @@ func TestFileListWithOptionalParams(t *testing.T) {
}
}
-func TestFileDelete(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Files.Delete(context.TODO(), "file_id")
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
func TestFileContent(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
diff --git a/vectorstore.go b/vectorstore.go
index 47cf622..dbb740d 100644
--- a/vectorstore.go
+++ b/vectorstore.go
@@ -28,8 +28,9 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewVectorStoreService] method instead.
type VectorStoreService struct {
- Options []option.RequestOption
- Files VectorStoreFileService
+ Options []option.RequestOption
+ Files VectorStoreFileService
+ FileBatches VectorStoreFileBatchService
}
// NewVectorStoreService generates a new service that applies the given options to
@@ -39,6 +40,7 @@ func NewVectorStoreService(opts ...option.RequestOption) (r VectorStoreService)
r = VectorStoreService{}
r.Options = opts
r.Files = NewVectorStoreFileService(opts...)
+ r.FileBatches = NewVectorStoreFileBatchService(opts...)
return
}
diff --git a/vectorstorefile.go b/vectorstorefile.go
index 3cabaac..8c011b3 100644
--- a/vectorstorefile.go
+++ b/vectorstorefile.go
@@ -127,22 +127,6 @@ func (r *VectorStoreFileService) Delete(ctx context.Context, fileID string, body
return
}
-// Retrieves the contents of a vector store file.
-func (r *VectorStoreFileService) Content(ctx context.Context, fileID string, query VectorStoreFileContentParams, opts ...option.RequestOption) (res *VectorStoreFileContentResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- if query.VectorStoreID == "" {
- err = errors.New("missing required vector_store_id parameter")
- return
- }
- if fileID == "" {
- err = errors.New("missing required file_id parameter")
- return
- }
- path := fmt.Sprintf("v1/vector_stores/%s/files/%s/content", query.VectorStoreID, fileID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
// OpenAI Vector Store File object.
type VectorStoreFile struct {
// Unique identifier for the file
@@ -429,106 +413,6 @@ func (r *VectorStoreFileDeleteResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Response from retrieving the contents of a vector store file.
-type VectorStoreFileContentResponse struct {
- // Key-value attributes associated with the file
- Attributes map[string]VectorStoreFileContentResponseAttributeUnion `json:"attributes,required"`
- // List of content items from the file
- Content []VectorStoreFileContentResponseContent `json:"content,required"`
- // Unique identifier for the file
- FileID string `json:"file_id,required"`
- // Name of the file
- Filename string `json:"filename,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Attributes respjson.Field
- Content respjson.Field
- FileID respjson.Field
- Filename respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r VectorStoreFileContentResponse) RawJSON() string { return r.JSON.raw }
-func (r *VectorStoreFileContentResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// VectorStoreFileContentResponseAttributeUnion contains all possible properties
-// and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type VectorStoreFileContentResponseAttributeUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u VectorStoreFileContentResponseAttributeUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u VectorStoreFileContentResponseAttributeUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u VectorStoreFileContentResponseAttributeUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u VectorStoreFileContentResponseAttributeUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u VectorStoreFileContentResponseAttributeUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *VectorStoreFileContentResponseAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Content item from a vector store file or search result.
-type VectorStoreFileContentResponseContent struct {
- // The actual text content
- Text string `json:"text,required"`
- // Content type, currently only "text" is supported
- Type constant.Text `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r VectorStoreFileContentResponseContent) RawJSON() string { return r.JSON.raw }
-func (r *VectorStoreFileContentResponseContent) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type VectorStoreFileNewParams struct {
// The ID of the file to attach to the vector store.
FileID string `json:"file_id,required"`
@@ -787,8 +671,3 @@ type VectorStoreFileDeleteParams struct {
VectorStoreID string `path:"vector_store_id,required" json:"-"`
paramObj
}
-
-type VectorStoreFileContentParams struct {
- VectorStoreID string `path:"vector_store_id,required" json:"-"`
- paramObj
-}
diff --git a/vectorstorefile_test.go b/vectorstorefile_test.go
index f1e7836..926547b 100644
--- a/vectorstorefile_test.go
+++ b/vectorstorefile_test.go
@@ -164,30 +164,3 @@ func TestVectorStoreFileDelete(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
-
-func TestVectorStoreFileContent(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.VectorStores.Files.Content(
- context.TODO(),
- "file_id",
- llamastackclient.VectorStoreFileContentParams{
- VectorStoreID: "vector_store_id",
- },
- )
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
diff --git a/vectorstorefilebatch.go b/vectorstorefilebatch.go
new file mode 100644
index 0000000..6b55ff1
--- /dev/null
+++ b/vectorstorefilebatch.go
@@ -0,0 +1,26 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient
+
+import (
+ "github.com/llamastack/llama-stack-client-go/option"
+)
+
+// VectorStoreFileBatchService contains methods and other services that help with
+// interacting with the llama-stack-client 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 [NewVectorStoreFileBatchService] method instead.
+type VectorStoreFileBatchService struct {
+ Options []option.RequestOption
+}
+
+// NewVectorStoreFileBatchService 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 NewVectorStoreFileBatchService(opts ...option.RequestOption) (r VectorStoreFileBatchService) {
+ r = VectorStoreFileBatchService{}
+ r.Options = opts
+ return
+}
From e5f679f8f193fcdf76aba82288130854e9b86819 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 17:58:51 +0000
Subject: [PATCH 23/33] feat(api): SDKs for vector store file batches apis
---
.stats.yml | 6 +-
api.md | 17 ++
file.go | 48 +++++
file_test.go | 42 ++++
vectorstorefile.go | 121 +++++++++++
vectorstorefile_test.go | 27 +++
vectorstorefilebatch.go | 396 +++++++++++++++++++++++++++++++++++
vectorstorefilebatch_test.go | 135 ++++++++++++
8 files changed, 789 insertions(+), 3 deletions(-)
create mode 100644 vectorstorefilebatch_test.go
diff --git a/.stats.yml b/.stats.yml
index cbb0181..b453267 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 102
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-3c569913f686c852ab392d470b9d905cc944d5a46a2324a21aa1376fb24e6714.yml
-openapi_spec_hash: 455f397c5f401ea425a4064bb39c6801
+configured_endpoints: 109
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-05bb7b0636a86ad0b485a5f2abfbd6b9e1873e802235f340af291f9ad9fb03b3.yml
+openapi_spec_hash: a78c30e308bc39473ea8e9ae9d0b726c
config_hash: 53c09ba1fdae5045de1860c479a51dc7
diff --git a/api.md b/api.md
index aa4d82e..5d0b18d 100644
--- a/api.md
+++ b/api.md
@@ -325,6 +325,7 @@ Response Types:
- llamastackclient.VectorStoreFile
- llamastackclient.VectorStoreFileDeleteResponse
+- llamastackclient.VectorStoreFileContentResponse
Methods:
@@ -333,9 +334,22 @@ Methods:
- client.VectorStores.Files.Update(ctx context.Context, fileID string, params llamastackclient.VectorStoreFileUpdateParams) (llamastackclient.VectorStoreFile, error)
- client.VectorStores.Files.List(ctx context.Context, vectorStoreID string, query llamastackclient.VectorStoreFileListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
- client.VectorStores.Files.Delete(ctx context.Context, fileID string, body llamastackclient.VectorStoreFileDeleteParams) (llamastackclient.VectorStoreFileDeleteResponse, error)
+- client.VectorStores.Files.Content(ctx context.Context, fileID string, query llamastackclient.VectorStoreFileContentParams) (llamastackclient.VectorStoreFileContentResponse, error)
## FileBatches
+Response Types:
+
+- llamastackclient.ListVectorStoreFilesInBatchResponse
+- llamastackclient.VectorStoreFileBatches
+
+Methods:
+
+- client.VectorStores.FileBatches.New(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreFileBatchNewParams) (llamastackclient.VectorStoreFileBatches, error)
+- client.VectorStores.FileBatches.Get(ctx context.Context, batchID string, query llamastackclient.VectorStoreFileBatchGetParams) (llamastackclient.VectorStoreFileBatches, error)
+- client.VectorStores.FileBatches.List(ctx context.Context, batchID string, params llamastackclient.VectorStoreFileBatchListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
+- client.VectorStores.FileBatches.Cancel(ctx context.Context, batchID string, body llamastackclient.VectorStoreFileBatchCancelParams) (llamastackclient.VectorStoreFileBatches, error)
+
# Models
Response Types:
@@ -525,6 +539,7 @@ Methods:
Response Types:
+- llamastackclient.DeleteFileResponse
- llamastackclient.File
- llamastackclient.ListFilesResponse
- llamastackclient.FileContentResponse
@@ -532,5 +547,7 @@ Response Types:
Methods:
- client.Files.New(ctx context.Context, body llamastackclient.FileNewParams) (llamastackclient.File, error)
+- client.Files.Get(ctx context.Context, fileID string) (llamastackclient.File, error)
- client.Files.List(ctx context.Context, query llamastackclient.FileListParams) (pagination.OpenAICursorPage[llamastackclient.File], error)
+- client.Files.Delete(ctx context.Context, fileID string) (llamastackclient.DeleteFileResponse, error)
- client.Files.Content(ctx context.Context, fileID string) (llamastackclient.FileContentResponse, error)
diff --git a/file.go b/file.go
index 9e9305c..49fbbe3 100644
--- a/file.go
+++ b/file.go
@@ -56,6 +56,18 @@ func (r *FileService) New(ctx context.Context, body FileNewParams, opts ...optio
return
}
+// Returns information about a specific file.
+func (r *FileService) Get(ctx context.Context, fileID string, opts ...option.RequestOption) (res *File, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if fileID == "" {
+ err = errors.New("missing required file_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/files/%s", fileID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
// Returns a list of files that belong to the user's organization.
func (r *FileService) List(ctx context.Context, query FileListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[File], err error) {
var raw *http.Response
@@ -79,6 +91,18 @@ func (r *FileService) ListAutoPaging(ctx context.Context, query FileListParams,
return pagination.NewOpenAICursorPageAutoPager(r.List(ctx, query, opts...))
}
+// Delete a file.
+func (r *FileService) Delete(ctx context.Context, fileID string, opts ...option.RequestOption) (res *DeleteFileResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if fileID == "" {
+ err = errors.New("missing required file_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/files/%s", fileID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, &res, opts...)
+ return
+}
+
// Returns the contents of the specified file.
func (r *FileService) Content(ctx context.Context, fileID string, opts ...option.RequestOption) (res *FileContentResponse, err error) {
opts = slices.Concat(r.Options, opts)
@@ -91,6 +115,30 @@ func (r *FileService) Content(ctx context.Context, fileID string, opts ...option
return
}
+// Response for deleting a file in OpenAI Files API.
+type DeleteFileResponse struct {
+ // The file identifier that was deleted
+ ID string `json:"id,required"`
+ // Whether the file was successfully deleted
+ Deleted bool `json:"deleted,required"`
+ // The object type, which is always "file"
+ Object constant.File `json:"object,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Deleted respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DeleteFileResponse) RawJSON() string { return r.JSON.raw }
+func (r *DeleteFileResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// OpenAI File object as defined in the OpenAI Files API.
type File struct {
// The file identifier, which can be referenced in the API endpoints
diff --git a/file_test.go b/file_test.go
index 21a87b1..d00c0a7 100644
--- a/file_test.go
+++ b/file_test.go
@@ -42,6 +42,27 @@ func TestFileNewWithOptionalParams(t *testing.T) {
}
}
+func TestFileGet(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Files.Get(context.TODO(), "file_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestFileListWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -68,6 +89,27 @@ func TestFileListWithOptionalParams(t *testing.T) {
}
}
+func TestFileDelete(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Files.Delete(context.TODO(), "file_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
func TestFileContent(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
diff --git a/vectorstorefile.go b/vectorstorefile.go
index 8c011b3..3cabaac 100644
--- a/vectorstorefile.go
+++ b/vectorstorefile.go
@@ -127,6 +127,22 @@ func (r *VectorStoreFileService) Delete(ctx context.Context, fileID string, body
return
}
+// Retrieves the contents of a vector store file.
+func (r *VectorStoreFileService) Content(ctx context.Context, fileID string, query VectorStoreFileContentParams, opts ...option.RequestOption) (res *VectorStoreFileContentResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if query.VectorStoreID == "" {
+ err = errors.New("missing required vector_store_id parameter")
+ return
+ }
+ if fileID == "" {
+ err = errors.New("missing required file_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/vector_stores/%s/files/%s/content", query.VectorStoreID, fileID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
// OpenAI Vector Store File object.
type VectorStoreFile struct {
// Unique identifier for the file
@@ -413,6 +429,106 @@ func (r *VectorStoreFileDeleteResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// Response from retrieving the contents of a vector store file.
+type VectorStoreFileContentResponse struct {
+ // Key-value attributes associated with the file
+ Attributes map[string]VectorStoreFileContentResponseAttributeUnion `json:"attributes,required"`
+ // List of content items from the file
+ Content []VectorStoreFileContentResponseContent `json:"content,required"`
+ // Unique identifier for the file
+ FileID string `json:"file_id,required"`
+ // Name of the file
+ Filename string `json:"filename,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Attributes respjson.Field
+ Content respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r VectorStoreFileContentResponse) RawJSON() string { return r.JSON.raw }
+func (r *VectorStoreFileContentResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// VectorStoreFileContentResponseAttributeUnion contains all possible properties
+// and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type VectorStoreFileContentResponseAttributeUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u VectorStoreFileContentResponseAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u VectorStoreFileContentResponseAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u VectorStoreFileContentResponseAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u VectorStoreFileContentResponseAttributeUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u VectorStoreFileContentResponseAttributeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *VectorStoreFileContentResponseAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Content item from a vector store file or search result.
+type VectorStoreFileContentResponseContent struct {
+ // The actual text content
+ Text string `json:"text,required"`
+ // Content type, currently only "text" is supported
+ Type constant.Text `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r VectorStoreFileContentResponseContent) RawJSON() string { return r.JSON.raw }
+func (r *VectorStoreFileContentResponseContent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type VectorStoreFileNewParams struct {
// The ID of the file to attach to the vector store.
FileID string `json:"file_id,required"`
@@ -671,3 +787,8 @@ type VectorStoreFileDeleteParams struct {
VectorStoreID string `path:"vector_store_id,required" json:"-"`
paramObj
}
+
+type VectorStoreFileContentParams struct {
+ VectorStoreID string `path:"vector_store_id,required" json:"-"`
+ paramObj
+}
diff --git a/vectorstorefile_test.go b/vectorstorefile_test.go
index 926547b..f1e7836 100644
--- a/vectorstorefile_test.go
+++ b/vectorstorefile_test.go
@@ -164,3 +164,30 @@ func TestVectorStoreFileDelete(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestVectorStoreFileContent(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.VectorStores.Files.Content(
+ context.TODO(),
+ "file_id",
+ llamastackclient.VectorStoreFileContentParams{
+ VectorStoreID: "vector_store_id",
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/vectorstorefilebatch.go b/vectorstorefilebatch.go
index 6b55ff1..48cc9e4 100644
--- a/vectorstorefilebatch.go
+++ b/vectorstorefilebatch.go
@@ -3,7 +3,21 @@
package llamastackclient
import (
+ "context"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/llamastack/llama-stack-client-go/internal/apijson"
+ "github.com/llamastack/llama-stack-client-go/internal/apiquery"
+ "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
+ "github.com/llamastack/llama-stack-client-go/packages/pagination"
+ "github.com/llamastack/llama-stack-client-go/packages/param"
+ "github.com/llamastack/llama-stack-client-go/packages/respjson"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// VectorStoreFileBatchService contains methods and other services that help with
@@ -24,3 +38,385 @@ func NewVectorStoreFileBatchService(opts ...option.RequestOption) (r VectorStore
r.Options = opts
return
}
+
+// Create a vector store file batch.
+func (r *VectorStoreFileBatchService) New(ctx context.Context, vectorStoreID string, body VectorStoreFileBatchNewParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if vectorStoreID == "" {
+ err = errors.New("missing required vector_store_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/vector_stores/%s/file_batches", vectorStoreID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Retrieve a vector store file batch.
+func (r *VectorStoreFileBatchService) Get(ctx context.Context, batchID string, query VectorStoreFileBatchGetParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if query.VectorStoreID == "" {
+ err = errors.New("missing required vector_store_id parameter")
+ return
+ }
+ if batchID == "" {
+ err = errors.New("missing required batch_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s", query.VectorStoreID, batchID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
+// Returns a list of vector store files in a batch.
+func (r *VectorStoreFileBatchService) List(ctx context.Context, batchID string, params VectorStoreFileBatchListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStoreFile], err error) {
+ var raw *http.Response
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
+ if params.VectorStoreID == "" {
+ err = errors.New("missing required vector_store_id parameter")
+ return
+ }
+ if batchID == "" {
+ err = errors.New("missing required batch_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s/files", params.VectorStoreID, batchID)
+ cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, params, &res, opts...)
+ if err != nil {
+ return nil, err
+ }
+ err = cfg.Execute()
+ if err != nil {
+ return nil, err
+ }
+ res.SetPageConfig(cfg, raw)
+ return res, nil
+}
+
+// Returns a list of vector store files in a batch.
+func (r *VectorStoreFileBatchService) ListAutoPaging(ctx context.Context, batchID string, params VectorStoreFileBatchListParams, opts ...option.RequestOption) *pagination.OpenAICursorPageAutoPager[VectorStoreFile] {
+ return pagination.NewOpenAICursorPageAutoPager(r.List(ctx, batchID, params, opts...))
+}
+
+// Cancels a vector store file batch.
+func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, batchID string, body VectorStoreFileBatchCancelParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if body.VectorStoreID == "" {
+ err = errors.New("missing required vector_store_id parameter")
+ return
+ }
+ if batchID == "" {
+ err = errors.New("missing required batch_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s/cancel", body.VectorStoreID, batchID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
+ return
+}
+
+// Response from listing files in a vector store file batch.
+type ListVectorStoreFilesInBatchResponse struct {
+ // List of vector store file objects in the batch
+ Data []VectorStoreFile `json:"data,required"`
+ // Whether there are more files available beyond this page
+ HasMore bool `json:"has_more,required"`
+ // Object type identifier, always "list"
+ Object string `json:"object,required"`
+ // (Optional) ID of the first file in the list for pagination
+ FirstID string `json:"first_id"`
+ // (Optional) ID of the last file in the list for pagination
+ LastID string `json:"last_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ HasMore respjson.Field
+ Object respjson.Field
+ FirstID respjson.Field
+ LastID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ListVectorStoreFilesInBatchResponse) RawJSON() string { return r.JSON.raw }
+func (r *ListVectorStoreFilesInBatchResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// OpenAI Vector Store File Batch object.
+type VectorStoreFileBatches struct {
+ // Unique identifier for the file batch
+ ID string `json:"id,required"`
+ // Timestamp when the file batch was created
+ CreatedAt int64 `json:"created_at,required"`
+ // File processing status counts for the batch
+ FileCounts VectorStoreFileBatchesFileCounts `json:"file_counts,required"`
+ // Object type identifier, always "vector_store.file_batch"
+ Object string `json:"object,required"`
+ // Current processing status of the file batch
+ //
+ // Any of "completed", "in_progress", "cancelled", "failed".
+ Status VectorStoreFileBatchesStatus `json:"status,required"`
+ // ID of the vector store containing the file batch
+ VectorStoreID string `json:"vector_store_id,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CreatedAt respjson.Field
+ FileCounts respjson.Field
+ Object respjson.Field
+ Status respjson.Field
+ VectorStoreID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r VectorStoreFileBatches) RawJSON() string { return r.JSON.raw }
+func (r *VectorStoreFileBatches) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// File processing status counts for the batch
+type VectorStoreFileBatchesFileCounts struct {
+ // Number of files that had their processing cancelled
+ Cancelled int64 `json:"cancelled,required"`
+ // Number of files that have been successfully processed
+ Completed int64 `json:"completed,required"`
+ // Number of files that failed to process
+ Failed int64 `json:"failed,required"`
+ // Number of files currently being processed
+ InProgress int64 `json:"in_progress,required"`
+ // Total number of files in the vector store
+ Total int64 `json:"total,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Cancelled respjson.Field
+ Completed respjson.Field
+ Failed respjson.Field
+ InProgress respjson.Field
+ Total respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r VectorStoreFileBatchesFileCounts) RawJSON() string { return r.JSON.raw }
+func (r *VectorStoreFileBatchesFileCounts) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Current processing status of the file batch
+type VectorStoreFileBatchesStatus string
+
+const (
+ VectorStoreFileBatchesStatusCompleted VectorStoreFileBatchesStatus = "completed"
+ VectorStoreFileBatchesStatusInProgress VectorStoreFileBatchesStatus = "in_progress"
+ VectorStoreFileBatchesStatusCancelled VectorStoreFileBatchesStatus = "cancelled"
+ VectorStoreFileBatchesStatusFailed VectorStoreFileBatchesStatus = "failed"
+)
+
+type VectorStoreFileBatchNewParams struct {
+ // A list of File IDs that the vector store should use.
+ FileIDs []string `json:"file_ids,omitzero,required"`
+ // (Optional) Key-value attributes to store with the files.
+ Attributes map[string]VectorStoreFileBatchNewParamsAttributeUnion `json:"attributes,omitzero"`
+ // (Optional) The chunking strategy used to chunk the file(s). Defaults to auto.
+ ChunkingStrategy VectorStoreFileBatchNewParamsChunkingStrategyUnion `json:"chunking_strategy,omitzero"`
+ paramObj
+}
+
+func (r VectorStoreFileBatchNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow VectorStoreFileBatchNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *VectorStoreFileBatchNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type VectorStoreFileBatchNewParamsAttributeUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u VectorStoreFileBatchNewParamsAttributeUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *VectorStoreFileBatchNewParamsAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *VectorStoreFileBatchNewParamsAttributeUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type VectorStoreFileBatchNewParamsChunkingStrategyUnion struct {
+ OfAuto *VectorStoreFileBatchNewParamsChunkingStrategyAuto `json:",omitzero,inline"`
+ OfStatic *VectorStoreFileBatchNewParamsChunkingStrategyStatic `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u VectorStoreFileBatchNewParamsChunkingStrategyUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfAuto, u.OfStatic)
+}
+func (u *VectorStoreFileBatchNewParamsChunkingStrategyUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *VectorStoreFileBatchNewParamsChunkingStrategyUnion) asAny() any {
+ if !param.IsOmitted(u.OfAuto) {
+ return u.OfAuto
+ } else if !param.IsOmitted(u.OfStatic) {
+ return u.OfStatic
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u VectorStoreFileBatchNewParamsChunkingStrategyUnion) GetStatic() *VectorStoreFileBatchNewParamsChunkingStrategyStaticStatic {
+ if vt := u.OfStatic; vt != nil {
+ return &vt.Static
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u VectorStoreFileBatchNewParamsChunkingStrategyUnion) GetType() *string {
+ if vt := u.OfAuto; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfStatic; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[VectorStoreFileBatchNewParamsChunkingStrategyUnion](
+ "type",
+ apijson.Discriminator[VectorStoreFileBatchNewParamsChunkingStrategyAuto]("auto"),
+ apijson.Discriminator[VectorStoreFileBatchNewParamsChunkingStrategyStatic]("static"),
+ )
+}
+
+func NewVectorStoreFileBatchNewParamsChunkingStrategyAuto() VectorStoreFileBatchNewParamsChunkingStrategyAuto {
+ return VectorStoreFileBatchNewParamsChunkingStrategyAuto{
+ Type: "auto",
+ }
+}
+
+// Automatic chunking strategy for vector store files.
+//
+// This struct has a constant value, construct it with
+// [NewVectorStoreFileBatchNewParamsChunkingStrategyAuto].
+type VectorStoreFileBatchNewParamsChunkingStrategyAuto struct {
+ // Strategy type, always "auto" for automatic chunking
+ Type constant.Auto `json:"type,required"`
+ paramObj
+}
+
+func (r VectorStoreFileBatchNewParamsChunkingStrategyAuto) MarshalJSON() (data []byte, err error) {
+ type shadow VectorStoreFileBatchNewParamsChunkingStrategyAuto
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *VectorStoreFileBatchNewParamsChunkingStrategyAuto) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Static chunking strategy with configurable parameters.
+//
+// The properties Static, Type are required.
+type VectorStoreFileBatchNewParamsChunkingStrategyStatic struct {
+ // Configuration parameters for the static chunking strategy
+ Static VectorStoreFileBatchNewParamsChunkingStrategyStaticStatic `json:"static,omitzero,required"`
+ // Strategy type, always "static" for static chunking
+ //
+ // This field can be elided, and will marshal its zero value as "static".
+ Type constant.Static `json:"type,required"`
+ paramObj
+}
+
+func (r VectorStoreFileBatchNewParamsChunkingStrategyStatic) MarshalJSON() (data []byte, err error) {
+ type shadow VectorStoreFileBatchNewParamsChunkingStrategyStatic
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *VectorStoreFileBatchNewParamsChunkingStrategyStatic) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Configuration parameters for the static chunking strategy
+//
+// The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.
+type VectorStoreFileBatchNewParamsChunkingStrategyStaticStatic struct {
+ // Number of tokens to overlap between adjacent chunks
+ ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
+ // Maximum number of tokens per chunk, must be between 100 and 4096
+ MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
+ paramObj
+}
+
+func (r VectorStoreFileBatchNewParamsChunkingStrategyStaticStatic) MarshalJSON() (data []byte, err error) {
+ type shadow VectorStoreFileBatchNewParamsChunkingStrategyStaticStatic
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *VectorStoreFileBatchNewParamsChunkingStrategyStaticStatic) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type VectorStoreFileBatchGetParams struct {
+ VectorStoreID string `path:"vector_store_id,required" json:"-"`
+ paramObj
+}
+
+type VectorStoreFileBatchListParams struct {
+ VectorStoreID string `path:"vector_store_id,required" json:"-"`
+ // A cursor for use in pagination. `after` is an object ID that defines your place
+ // in the list.
+ After param.Opt[string] `query:"after,omitzero" json:"-"`
+ // A cursor for use in pagination. `before` is an object ID that defines your place
+ // in the list.
+ Before param.Opt[string] `query:"before,omitzero" json:"-"`
+ // Filter by file status. One of in_progress, completed, failed, cancelled.
+ Filter param.Opt[string] `query:"filter,omitzero" json:"-"`
+ // A limit on the number of objects to be returned. Limit can range between 1 and
+ // 100, and the default is 20.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Sort order by the `created_at` timestamp of the objects. `asc` for ascending
+ // order and `desc` for descending order.
+ Order param.Opt[string] `query:"order,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [VectorStoreFileBatchListParams]'s query parameters as
+// `url.Values`.
+func (r VectorStoreFileBatchListParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type VectorStoreFileBatchCancelParams struct {
+ VectorStoreID string `path:"vector_store_id,required" json:"-"`
+ paramObj
+}
diff --git a/vectorstorefilebatch_test.go b/vectorstorefilebatch_test.go
new file mode 100644
index 0000000..7842ea9
--- /dev/null
+++ b/vectorstorefilebatch_test.go
@@ -0,0 +1,135 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/llamastack/llama-stack-client-go"
+ "github.com/llamastack/llama-stack-client-go/internal/testutil"
+ "github.com/llamastack/llama-stack-client-go/option"
+)
+
+func TestVectorStoreFileBatchNewWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.VectorStores.FileBatches.New(
+ context.TODO(),
+ "vector_store_id",
+ llamastackclient.VectorStoreFileBatchNewParams{
+ FileIDs: []string{"string"},
+ Attributes: map[string]llamastackclient.VectorStoreFileBatchNewParamsAttributeUnion{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ },
+ ChunkingStrategy: llamastackclient.VectorStoreFileBatchNewParamsChunkingStrategyUnion{
+ OfAuto: &llamastackclient.VectorStoreFileBatchNewParamsChunkingStrategyAuto{},
+ },
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestVectorStoreFileBatchGet(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.VectorStores.FileBatches.Get(
+ context.TODO(),
+ "batch_id",
+ llamastackclient.VectorStoreFileBatchGetParams{
+ VectorStoreID: "vector_store_id",
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.VectorStores.FileBatches.List(
+ context.TODO(),
+ "batch_id",
+ llamastackclient.VectorStoreFileBatchListParams{
+ VectorStoreID: "vector_store_id",
+ After: llamastackclient.String("after"),
+ Before: llamastackclient.String("before"),
+ Filter: llamastackclient.String("filter"),
+ Limit: llamastackclient.Int(0),
+ Order: llamastackclient.String("order"),
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestVectorStoreFileBatchCancel(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.VectorStores.FileBatches.Cancel(
+ context.TODO(),
+ "batch_id",
+ llamastackclient.VectorStoreFileBatchCancelParams{
+ VectorStoreID: "vector_store_id",
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
From f12fecf6d892348ebee06652255f6ac66f38e0bb Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 19:35:38 +0000
Subject: [PATCH 24/33] feat(api): moving { rerank, agents } to `client.alpha.`
---
.stats.yml | 6 +-
agentturn.go | 1588 -----------------
alpha.go | 30 +
agent.go => alphaagent.go | 88 +-
agent_test.go => alphaagent_test.go | 16 +-
agentsession.go => alphaagentsession.go | 80 +-
...ssion_test.go => alphaagentsession_test.go | 24 +-
agentstep.go => alphaagentstep.go | 72 +-
agentstep_test.go => alphaagentstep_test.go | 6 +-
alphaagentturn.go | 922 ++++++++++
agentturn_test.go => alphaagentturn_test.go | 28 +-
inference.go => alphainference.go | 138 +-
inference_test.go => alphainference_test.go | 8 +-
api.md | 146 +-
client.go | 6 +-
15 files changed, 1262 insertions(+), 1896 deletions(-)
delete mode 100644 agentturn.go
create mode 100644 alpha.go
rename agent.go => alphaagent.go (84%)
rename agent_test.go => alphaagent_test.go (89%)
rename agentsession.go => alphaagentsession.go (69%)
rename agentsession_test.go => alphaagentsession_test.go (80%)
rename agentstep.go => alphaagentstep.go (63%)
rename agentstep_test.go => alphaagentstep_test.go (87%)
create mode 100644 alphaagentturn.go
rename agentturn_test.go => alphaagentturn_test.go (78%)
rename inference.go => alphainference.go (56%)
rename inference_test.go => alphainference_test.go (76%)
diff --git a/.stats.yml b/.stats.yml
index b453267..35d7077 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 109
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-05bb7b0636a86ad0b485a5f2abfbd6b9e1873e802235f340af291f9ad9fb03b3.yml
-openapi_spec_hash: a78c30e308bc39473ea8e9ae9d0b726c
-config_hash: 53c09ba1fdae5045de1860c479a51dc7
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
+openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
+config_hash: 03aab396899c7d9aa3fba867ce54824b
diff --git a/agentturn.go b/agentturn.go
deleted file mode 100644
index 9bb43e5..0000000
--- a/agentturn.go
+++ /dev/null
@@ -1,1588 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package llamastackclient
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "slices"
- "time"
-
- "github.com/llamastack/llama-stack-client-go/internal/apijson"
- "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
- "github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/packages/ssestream"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
-)
-
-// AgentTurnService contains methods and other services that help with interacting
-// with the llama-stack-client 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 [NewAgentTurnService] method instead.
-type AgentTurnService struct {
- Options []option.RequestOption
-}
-
-// NewAgentTurnService 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 NewAgentTurnService(opts ...option.RequestOption) (r AgentTurnService) {
- r = AgentTurnService{}
- r.Options = opts
- return
-}
-
-// Create a new turn for an agent.
-func (r *AgentTurnService) New(ctx context.Context, sessionID string, params AgentTurnNewParams, opts ...option.RequestOption) (res *Turn, err error) {
- opts = slices.Concat(r.Options, opts)
- if params.AgentID == "" {
- err = errors.New("missing required agent_id parameter")
- return
- }
- if sessionID == "" {
- err = errors.New("missing required session_id parameter")
- return
- }
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
- return
-}
-
-// Create a new turn for an agent.
-func (r *AgentTurnService) NewStreaming(ctx context.Context, sessionID string, params AgentTurnNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[AgentTurnResponseStreamChunk]) {
- var (
- raw *http.Response
- err error
- )
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- if params.AgentID == "" {
- err = errors.New("missing required agent_id parameter")
- return
- }
- if sessionID == "" {
- err = errors.New("missing required session_id parameter")
- return
- }
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
- return ssestream.NewStream[AgentTurnResponseStreamChunk](ssestream.NewDecoder(raw), err)
-}
-
-// Retrieve an agent turn by its ID.
-func (r *AgentTurnService) Get(ctx context.Context, turnID string, query AgentTurnGetParams, opts ...option.RequestOption) (res *Turn, err error) {
- opts = slices.Concat(r.Options, opts)
- if query.AgentID == "" {
- err = errors.New("missing required agent_id parameter")
- return
- }
- if query.SessionID == "" {
- err = errors.New("missing required session_id parameter")
- return
- }
- if turnID == "" {
- err = errors.New("missing required turn_id parameter")
- return
- }
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s", query.AgentID, query.SessionID, turnID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
-// Resume an agent turn with executed tool call responses. When a Turn has the
-// status `awaiting_input` due to pending input from client side tool calls, this
-// endpoint can be used to submit the outputs from the tool calls once they are
-// ready.
-func (r *AgentTurnService) Resume(ctx context.Context, turnID string, params AgentTurnResumeParams, opts ...option.RequestOption) (res *Turn, err error) {
- opts = slices.Concat(r.Options, opts)
- if params.AgentID == "" {
- err = errors.New("missing required agent_id parameter")
- return
- }
- if params.SessionID == "" {
- err = errors.New("missing required session_id parameter")
- return
- }
- if turnID == "" {
- err = errors.New("missing required turn_id parameter")
- return
- }
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
- return
-}
-
-// Resume an agent turn with executed tool call responses. When a Turn has the
-// status `awaiting_input` due to pending input from client side tool calls, this
-// endpoint can be used to submit the outputs from the tool calls once they are
-// ready.
-func (r *AgentTurnService) ResumeStreaming(ctx context.Context, turnID string, params AgentTurnResumeParams, opts ...option.RequestOption) (stream *ssestream.Stream[AgentTurnResponseStreamChunk]) {
- var (
- raw *http.Response
- err error
- )
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
- if params.AgentID == "" {
- err = errors.New("missing required agent_id parameter")
- return
- }
- if params.SessionID == "" {
- err = errors.New("missing required session_id parameter")
- return
- }
- if turnID == "" {
- err = errors.New("missing required turn_id parameter")
- return
- }
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
- return ssestream.NewStream[AgentTurnResponseStreamChunk](ssestream.NewDecoder(raw), err)
-}
-
-// Streamed agent turn completion response.
-type AgentTurnResponseStreamChunk struct {
- // Individual event in the agent turn response stream
- Event TurnResponseEvent `json:"event,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Event respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r AgentTurnResponseStreamChunk) RawJSON() string { return r.JSON.raw }
-func (r *AgentTurnResponseStreamChunk) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A single turn in an interaction with an Agentic System.
-type Turn struct {
- // List of messages that initiated this turn
- InputMessages []TurnInputMessageUnion `json:"input_messages,required"`
- // The model's generated response containing content and metadata
- OutputMessage CompletionMessage `json:"output_message,required"`
- // Unique identifier for the conversation session
- SessionID string `json:"session_id,required"`
- // Timestamp when the turn began
- StartedAt time.Time `json:"started_at,required" format:"date-time"`
- // Ordered list of processing steps executed during this turn
- Steps []TurnStepUnion `json:"steps,required"`
- // Unique identifier for the turn within a session
- TurnID string `json:"turn_id,required"`
- // (Optional) Timestamp when the turn finished, if completed
- CompletedAt time.Time `json:"completed_at" format:"date-time"`
- // (Optional) Files or media attached to the agent's response
- OutputAttachments []TurnOutputAttachment `json:"output_attachments"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- InputMessages respjson.Field
- OutputMessage respjson.Field
- SessionID respjson.Field
- StartedAt respjson.Field
- Steps respjson.Field
- TurnID respjson.Field
- CompletedAt respjson.Field
- OutputAttachments respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r Turn) RawJSON() string { return r.JSON.raw }
-func (r *Turn) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnInputMessageUnion contains all possible properties and values from
-// [UserMessage], [ToolResponseMessage].
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type TurnInputMessageUnion struct {
- // This field is from variant [UserMessage].
- Content InterleavedContentUnion `json:"content"`
- Role string `json:"role"`
- // This field is from variant [UserMessage].
- Context InterleavedContentUnion `json:"context"`
- // This field is from variant [ToolResponseMessage].
- CallID string `json:"call_id"`
- JSON struct {
- Content respjson.Field
- Role respjson.Field
- Context respjson.Field
- CallID respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u TurnInputMessageUnion) AsUserMessage() (v UserMessage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnInputMessageUnion) AsToolResponseMessage() (v ToolResponseMessage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnInputMessageUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnInputMessageUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnStepUnion contains all possible properties and values from [InferenceStep],
-// [ToolExecutionStep], [ShieldCallStep], [MemoryRetrievalStep].
-//
-// Use the [TurnStepUnion.AsAny] method to switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type TurnStepUnion struct {
- // This field is from variant [InferenceStep].
- ModelResponse CompletionMessage `json:"model_response"`
- StepID string `json:"step_id"`
- // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
- StepType string `json:"step_type"`
- TurnID string `json:"turn_id"`
- CompletedAt time.Time `json:"completed_at"`
- StartedAt time.Time `json:"started_at"`
- // This field is from variant [ToolExecutionStep].
- ToolCalls []ToolCall `json:"tool_calls"`
- // This field is from variant [ToolExecutionStep].
- ToolResponses []ToolResponse `json:"tool_responses"`
- // This field is from variant [ShieldCallStep].
- Violation SafetyViolation `json:"violation"`
- // This field is from variant [MemoryRetrievalStep].
- InsertedContext InterleavedContentUnion `json:"inserted_context"`
- // This field is from variant [MemoryRetrievalStep].
- VectorDBIDs string `json:"vector_db_ids"`
- JSON struct {
- ModelResponse respjson.Field
- StepID respjson.Field
- StepType respjson.Field
- TurnID respjson.Field
- CompletedAt respjson.Field
- StartedAt respjson.Field
- ToolCalls respjson.Field
- ToolResponses respjson.Field
- Violation respjson.Field
- InsertedContext respjson.Field
- VectorDBIDs respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyTurnStep is implemented by each variant of [TurnStepUnion] to add type safety
-// for the return type of [TurnStepUnion.AsAny]
-type anyTurnStep interface {
- implTurnStepUnion()
-}
-
-func (InferenceStep) implTurnStepUnion() {}
-func (ToolExecutionStep) implTurnStepUnion() {}
-func (ShieldCallStep) implTurnStepUnion() {}
-func (MemoryRetrievalStep) implTurnStepUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := TurnStepUnion.AsAny().(type) {
-// case llamastackclient.InferenceStep:
-// case llamastackclient.ToolExecutionStep:
-// case llamastackclient.ShieldCallStep:
-// case llamastackclient.MemoryRetrievalStep:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u TurnStepUnion) AsAny() anyTurnStep {
- switch u.StepType {
- case "inference":
- return u.AsInference()
- case "tool_execution":
- return u.AsToolExecution()
- case "shield_call":
- return u.AsShieldCall()
- case "memory_retrieval":
- return u.AsMemoryRetrieval()
- }
- return nil
-}
-
-func (u TurnStepUnion) AsInference() (v InferenceStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnStepUnion) AsToolExecution() (v ToolExecutionStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnStepUnion) AsShieldCall() (v ShieldCallStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnStepUnion) AsMemoryRetrieval() (v MemoryRetrievalStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnStepUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnStepUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// An attachment to an agent turn.
-type TurnOutputAttachment struct {
- // The content of the attachment.
- Content TurnOutputAttachmentContentUnion `json:"content,required"`
- // The MIME type of the attachment.
- MimeType string `json:"mime_type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Content respjson.Field
- MimeType respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnOutputAttachment) RawJSON() string { return r.JSON.raw }
-func (r *TurnOutputAttachment) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnOutputAttachmentContentUnion contains all possible properties and values
-// from [string], [TurnOutputAttachmentContentImageContentItem],
-// [TurnOutputAttachmentContentTextContentItem], [[]InterleavedContentItemUnion],
-// [TurnOutputAttachmentContentURL].
-//
-// 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: OfString OfInterleavedContentItemArray]
-type TurnOutputAttachmentContentUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]InterleavedContentItemUnion]
- // instead of an object.
- OfInterleavedContentItemArray []InterleavedContentItemUnion `json:",inline"`
- // This field is from variant [TurnOutputAttachmentContentImageContentItem].
- Image TurnOutputAttachmentContentImageContentItemImage `json:"image"`
- Type string `json:"type"`
- // This field is from variant [TurnOutputAttachmentContentTextContentItem].
- Text string `json:"text"`
- // This field is from variant [TurnOutputAttachmentContentURL].
- Uri string `json:"uri"`
- JSON struct {
- OfString respjson.Field
- OfInterleavedContentItemArray respjson.Field
- Image respjson.Field
- Type respjson.Field
- Text respjson.Field
- Uri respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u TurnOutputAttachmentContentUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnOutputAttachmentContentUnion) AsImageContentItem() (v TurnOutputAttachmentContentImageContentItem) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnOutputAttachmentContentUnion) AsTextContentItem() (v TurnOutputAttachmentContentTextContentItem) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnOutputAttachmentContentUnion) AsInterleavedContentItemArray() (v []InterleavedContentItemUnion) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnOutputAttachmentContentUnion) AsURL() (v TurnOutputAttachmentContentURL) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnOutputAttachmentContentUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnOutputAttachmentContentUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A image content item
-type TurnOutputAttachmentContentImageContentItem struct {
- // Image as a base64 encoded string or an URL
- Image TurnOutputAttachmentContentImageContentItemImage `json:"image,required"`
- // Discriminator type of the content item. Always "image"
- Type constant.Image `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Image respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnOutputAttachmentContentImageContentItem) RawJSON() string { return r.JSON.raw }
-func (r *TurnOutputAttachmentContentImageContentItem) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image as a base64 encoded string or an URL
-type TurnOutputAttachmentContentImageContentItemImage struct {
- // base64 encoded image data as string
- Data string `json:"data"`
- // A URL of the image or data URL in the format of data:image/{type};base64,{data}.
- // Note that URL could have length limits.
- URL TurnOutputAttachmentContentImageContentItemImageURL `json:"url"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Data respjson.Field
- URL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnOutputAttachmentContentImageContentItemImage) RawJSON() string { return r.JSON.raw }
-func (r *TurnOutputAttachmentContentImageContentItemImage) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-type TurnOutputAttachmentContentImageContentItemImageURL struct {
- // The URL string pointing to the resource
- Uri string `json:"uri,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Uri respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnOutputAttachmentContentImageContentItemImageURL) RawJSON() string { return r.JSON.raw }
-func (r *TurnOutputAttachmentContentImageContentItemImageURL) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A text content item
-type TurnOutputAttachmentContentTextContentItem struct {
- // Text content
- Text string `json:"text,required"`
- // Discriminator type of the content item. Always "text"
- Type constant.Text `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnOutputAttachmentContentTextContentItem) RawJSON() string { return r.JSON.raw }
-func (r *TurnOutputAttachmentContentTextContentItem) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A URL reference to external content.
-type TurnOutputAttachmentContentURL struct {
- // The URL string pointing to the resource
- Uri string `json:"uri,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Uri respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnOutputAttachmentContentURL) RawJSON() string { return r.JSON.raw }
-func (r *TurnOutputAttachmentContentURL) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// An event in an agent turn response stream.
-type TurnResponseEvent struct {
- // Event-specific payload containing event data
- Payload TurnResponseEventPayloadUnion `json:"payload,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Payload respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEvent) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEvent) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnResponseEventPayloadUnion contains all possible properties and values from
-// [TurnResponseEventPayloadStepStart], [TurnResponseEventPayloadStepProgress],
-// [TurnResponseEventPayloadStepComplete], [TurnResponseEventPayloadTurnStart],
-// [TurnResponseEventPayloadTurnComplete],
-// [TurnResponseEventPayloadTurnAwaitingInput].
-//
-// Use the [TurnResponseEventPayloadUnion.AsAny] method to switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type TurnResponseEventPayloadUnion struct {
- // Any of "step_start", "step_progress", "step_complete", "turn_start",
- // "turn_complete", "turn_awaiting_input".
- EventType string `json:"event_type"`
- StepID string `json:"step_id"`
- StepType string `json:"step_type"`
- // This field is from variant [TurnResponseEventPayloadStepStart].
- Metadata map[string]TurnResponseEventPayloadStepStartMetadataUnion `json:"metadata"`
- // This field is from variant [TurnResponseEventPayloadStepProgress].
- Delta TurnResponseEventPayloadStepProgressDeltaUnion `json:"delta"`
- // This field is from variant [TurnResponseEventPayloadStepComplete].
- StepDetails TurnResponseEventPayloadStepCompleteStepDetailsUnion `json:"step_details"`
- // This field is from variant [TurnResponseEventPayloadTurnStart].
- TurnID string `json:"turn_id"`
- // This field is from variant [TurnResponseEventPayloadTurnComplete].
- Turn Turn `json:"turn"`
- JSON struct {
- EventType respjson.Field
- StepID respjson.Field
- StepType respjson.Field
- Metadata respjson.Field
- Delta respjson.Field
- StepDetails respjson.Field
- TurnID respjson.Field
- Turn respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyTurnResponseEventPayload is implemented by each variant of
-// [TurnResponseEventPayloadUnion] to add type safety for the return type of
-// [TurnResponseEventPayloadUnion.AsAny]
-type anyTurnResponseEventPayload interface {
- implTurnResponseEventPayloadUnion()
-}
-
-func (TurnResponseEventPayloadStepStart) implTurnResponseEventPayloadUnion() {}
-func (TurnResponseEventPayloadStepProgress) implTurnResponseEventPayloadUnion() {}
-func (TurnResponseEventPayloadStepComplete) implTurnResponseEventPayloadUnion() {}
-func (TurnResponseEventPayloadTurnStart) implTurnResponseEventPayloadUnion() {}
-func (TurnResponseEventPayloadTurnComplete) implTurnResponseEventPayloadUnion() {}
-func (TurnResponseEventPayloadTurnAwaitingInput) implTurnResponseEventPayloadUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := TurnResponseEventPayloadUnion.AsAny().(type) {
-// case llamastackclient.TurnResponseEventPayloadStepStart:
-// case llamastackclient.TurnResponseEventPayloadStepProgress:
-// case llamastackclient.TurnResponseEventPayloadStepComplete:
-// case llamastackclient.TurnResponseEventPayloadTurnStart:
-// case llamastackclient.TurnResponseEventPayloadTurnComplete:
-// case llamastackclient.TurnResponseEventPayloadTurnAwaitingInput:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u TurnResponseEventPayloadUnion) AsAny() anyTurnResponseEventPayload {
- switch u.EventType {
- case "step_start":
- return u.AsStepStart()
- case "step_progress":
- return u.AsStepProgress()
- case "step_complete":
- return u.AsStepComplete()
- case "turn_start":
- return u.AsTurnStart()
- case "turn_complete":
- return u.AsTurnComplete()
- case "turn_awaiting_input":
- return u.AsTurnAwaitingInput()
- }
- return nil
-}
-
-func (u TurnResponseEventPayloadUnion) AsStepStart() (v TurnResponseEventPayloadStepStart) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadUnion) AsStepProgress() (v TurnResponseEventPayloadStepProgress) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadUnion) AsStepComplete() (v TurnResponseEventPayloadStepComplete) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadUnion) AsTurnStart() (v TurnResponseEventPayloadTurnStart) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadUnion) AsTurnComplete() (v TurnResponseEventPayloadTurnComplete) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadUnion) AsTurnAwaitingInput() (v TurnResponseEventPayloadTurnAwaitingInput) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnResponseEventPayloadUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnResponseEventPayloadUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Payload for step start events in agent turn responses.
-type TurnResponseEventPayloadStepStart struct {
- // Type of event being reported
- EventType constant.StepStart `json:"event_type,required"`
- // Unique identifier for the step within a turn
- StepID string `json:"step_id,required"`
- // Type of step being executed
- //
- // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
- StepType string `json:"step_type,required"`
- // (Optional) Additional metadata for the step
- Metadata map[string]TurnResponseEventPayloadStepStartMetadataUnion `json:"metadata"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EventType respjson.Field
- StepID respjson.Field
- StepType respjson.Field
- Metadata respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadStepStart) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadStepStart) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnResponseEventPayloadStepStartMetadataUnion contains all possible properties
-// and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type TurnResponseEventPayloadStepStartMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u TurnResponseEventPayloadStepStartMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepStartMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepStartMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepStartMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnResponseEventPayloadStepStartMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnResponseEventPayloadStepStartMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Payload for step progress events in agent turn responses.
-type TurnResponseEventPayloadStepProgress struct {
- // Incremental content changes during step execution
- Delta TurnResponseEventPayloadStepProgressDeltaUnion `json:"delta,required"`
- // Type of event being reported
- EventType constant.StepProgress `json:"event_type,required"`
- // Unique identifier for the step within a turn
- StepID string `json:"step_id,required"`
- // Type of step being executed
- //
- // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
- StepType string `json:"step_type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Delta respjson.Field
- EventType respjson.Field
- StepID respjson.Field
- StepType respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadStepProgress) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadStepProgress) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnResponseEventPayloadStepProgressDeltaUnion contains all possible properties
-// and values from [TurnResponseEventPayloadStepProgressDeltaText],
-// [TurnResponseEventPayloadStepProgressDeltaImage],
-// [TurnResponseEventPayloadStepProgressDeltaToolCall].
-//
-// Use the [TurnResponseEventPayloadStepProgressDeltaUnion.AsAny] method to switch
-// on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type TurnResponseEventPayloadStepProgressDeltaUnion struct {
- // This field is from variant [TurnResponseEventPayloadStepProgressDeltaText].
- Text string `json:"text"`
- // Any of "text", "image", "tool_call".
- Type string `json:"type"`
- // This field is from variant [TurnResponseEventPayloadStepProgressDeltaImage].
- Image string `json:"image"`
- // This field is from variant [TurnResponseEventPayloadStepProgressDeltaToolCall].
- ParseStatus string `json:"parse_status"`
- // This field is from variant [TurnResponseEventPayloadStepProgressDeltaToolCall].
- ToolCall TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion `json:"tool_call"`
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- Image respjson.Field
- ParseStatus respjson.Field
- ToolCall respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyTurnResponseEventPayloadStepProgressDelta is implemented by each variant of
-// [TurnResponseEventPayloadStepProgressDeltaUnion] to add type safety for the
-// return type of [TurnResponseEventPayloadStepProgressDeltaUnion.AsAny]
-type anyTurnResponseEventPayloadStepProgressDelta interface {
- implTurnResponseEventPayloadStepProgressDeltaUnion()
-}
-
-func (TurnResponseEventPayloadStepProgressDeltaText) implTurnResponseEventPayloadStepProgressDeltaUnion() {
-}
-func (TurnResponseEventPayloadStepProgressDeltaImage) implTurnResponseEventPayloadStepProgressDeltaUnion() {
-}
-func (TurnResponseEventPayloadStepProgressDeltaToolCall) implTurnResponseEventPayloadStepProgressDeltaUnion() {
-}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := TurnResponseEventPayloadStepProgressDeltaUnion.AsAny().(type) {
-// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaText:
-// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaImage:
-// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaToolCall:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsAny() anyTurnResponseEventPayloadStepProgressDelta {
- switch u.Type {
- case "text":
- return u.AsText()
- case "image":
- return u.AsImage()
- case "tool_call":
- return u.AsToolCall()
- }
- return nil
-}
-
-func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsText() (v TurnResponseEventPayloadStepProgressDeltaText) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsImage() (v TurnResponseEventPayloadStepProgressDeltaImage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsToolCall() (v TurnResponseEventPayloadStepProgressDeltaToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnResponseEventPayloadStepProgressDeltaUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnResponseEventPayloadStepProgressDeltaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A text content delta for streaming responses.
-type TurnResponseEventPayloadStepProgressDeltaText struct {
- // The incremental text content
- Text string `json:"text,required"`
- // Discriminator type of the delta. Always "text"
- Type constant.Text `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadStepProgressDeltaText) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadStepProgressDeltaText) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// An image content delta for streaming responses.
-type TurnResponseEventPayloadStepProgressDeltaImage struct {
- // The incremental image data as bytes
- Image string `json:"image,required"`
- // Discriminator type of the delta. Always "image"
- Type constant.Image `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Image respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadStepProgressDeltaImage) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadStepProgressDeltaImage) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A tool call content delta for streaming responses.
-type TurnResponseEventPayloadStepProgressDeltaToolCall struct {
- // Current parsing status of the tool call
- //
- // Any of "started", "in_progress", "failed", "succeeded".
- ParseStatus string `json:"parse_status,required"`
- // Either an in-progress tool call string or the final parsed tool call
- ToolCall TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion `json:"tool_call,required"`
- // Discriminator type of the delta. Always "tool_call"
- Type constant.ToolCall `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ParseStatus respjson.Field
- ToolCall respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadStepProgressDeltaToolCall) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadStepProgressDeltaToolCall) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion contains all
-// possible properties and values from [string], [ToolCall].
-//
-// 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: OfString]
-type TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field is from variant [ToolCall].
- Arguments ToolCallArgumentsUnion `json:"arguments"`
- // This field is from variant [ToolCall].
- CallID string `json:"call_id"`
- // This field is from variant [ToolCall].
- ToolName ToolCallToolName `json:"tool_name"`
- // This field is from variant [ToolCall].
- ArgumentsJson string `json:"arguments_json"`
- JSON struct {
- OfString respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- ToolName respjson.Field
- ArgumentsJson respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) AsToolCall() (v ToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) RawJSON() string {
- return u.JSON.raw
-}
-
-func (r *TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Payload for step completion events in agent turn responses.
-type TurnResponseEventPayloadStepComplete struct {
- // Type of event being reported
- EventType constant.StepComplete `json:"event_type,required"`
- // Complete details of the executed step
- StepDetails TurnResponseEventPayloadStepCompleteStepDetailsUnion `json:"step_details,required"`
- // Unique identifier for the step within a turn
- StepID string `json:"step_id,required"`
- // Type of step being executed
- //
- // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
- StepType string `json:"step_type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EventType respjson.Field
- StepDetails respjson.Field
- StepID respjson.Field
- StepType respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadStepComplete) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadStepComplete) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TurnResponseEventPayloadStepCompleteStepDetailsUnion contains all possible
-// properties and values from [InferenceStep], [ToolExecutionStep],
-// [ShieldCallStep], [MemoryRetrievalStep].
-//
-// Use the [TurnResponseEventPayloadStepCompleteStepDetailsUnion.AsAny] method to
-// switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type TurnResponseEventPayloadStepCompleteStepDetailsUnion struct {
- // This field is from variant [InferenceStep].
- ModelResponse CompletionMessage `json:"model_response"`
- StepID string `json:"step_id"`
- // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
- StepType string `json:"step_type"`
- TurnID string `json:"turn_id"`
- CompletedAt time.Time `json:"completed_at"`
- StartedAt time.Time `json:"started_at"`
- // This field is from variant [ToolExecutionStep].
- ToolCalls []ToolCall `json:"tool_calls"`
- // This field is from variant [ToolExecutionStep].
- ToolResponses []ToolResponse `json:"tool_responses"`
- // This field is from variant [ShieldCallStep].
- Violation SafetyViolation `json:"violation"`
- // This field is from variant [MemoryRetrievalStep].
- InsertedContext InterleavedContentUnion `json:"inserted_context"`
- // This field is from variant [MemoryRetrievalStep].
- VectorDBIDs string `json:"vector_db_ids"`
- JSON struct {
- ModelResponse respjson.Field
- StepID respjson.Field
- StepType respjson.Field
- TurnID respjson.Field
- CompletedAt respjson.Field
- StartedAt respjson.Field
- ToolCalls respjson.Field
- ToolResponses respjson.Field
- Violation respjson.Field
- InsertedContext respjson.Field
- VectorDBIDs respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyTurnResponseEventPayloadStepCompleteStepDetails is implemented by each
-// variant of [TurnResponseEventPayloadStepCompleteStepDetailsUnion] to add type
-// safety for the return type of
-// [TurnResponseEventPayloadStepCompleteStepDetailsUnion.AsAny]
-type anyTurnResponseEventPayloadStepCompleteStepDetails interface {
- implTurnResponseEventPayloadStepCompleteStepDetailsUnion()
-}
-
-func (InferenceStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
-func (ToolExecutionStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
-func (ShieldCallStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
-func (MemoryRetrievalStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := TurnResponseEventPayloadStepCompleteStepDetailsUnion.AsAny().(type) {
-// case llamastackclient.InferenceStep:
-// case llamastackclient.ToolExecutionStep:
-// case llamastackclient.ShieldCallStep:
-// case llamastackclient.MemoryRetrievalStep:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsAny() anyTurnResponseEventPayloadStepCompleteStepDetails {
- switch u.StepType {
- case "inference":
- return u.AsInference()
- case "tool_execution":
- return u.AsToolExecution()
- case "shield_call":
- return u.AsShieldCall()
- case "memory_retrieval":
- return u.AsMemoryRetrieval()
- }
- return nil
-}
-
-func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsInference() (v InferenceStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsToolExecution() (v ToolExecutionStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsShieldCall() (v ShieldCallStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsMemoryRetrieval() (v MemoryRetrievalStep) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TurnResponseEventPayloadStepCompleteStepDetailsUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Payload for turn start events in agent turn responses.
-type TurnResponseEventPayloadTurnStart struct {
- // Type of event being reported
- EventType constant.TurnStart `json:"event_type,required"`
- // Unique identifier for the turn within a session
- TurnID string `json:"turn_id,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EventType respjson.Field
- TurnID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadTurnStart) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadTurnStart) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Payload for turn completion events in agent turn responses.
-type TurnResponseEventPayloadTurnComplete struct {
- // Type of event being reported
- EventType constant.TurnComplete `json:"event_type,required"`
- // Complete turn data including all steps and results
- Turn Turn `json:"turn,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EventType respjson.Field
- Turn respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadTurnComplete) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadTurnComplete) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Payload for turn awaiting input events in agent turn responses.
-type TurnResponseEventPayloadTurnAwaitingInput struct {
- // Type of event being reported
- EventType constant.TurnAwaitingInput `json:"event_type,required"`
- // Turn data when waiting for external tool responses
- Turn Turn `json:"turn,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EventType respjson.Field
- Turn respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TurnResponseEventPayloadTurnAwaitingInput) RawJSON() string { return r.JSON.raw }
-func (r *TurnResponseEventPayloadTurnAwaitingInput) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type AgentTurnNewParams struct {
- AgentID string `path:"agent_id,required" json:"-"`
- // List of messages to start the turn with.
- Messages []AgentTurnNewParamsMessageUnion `json:"messages,omitzero,required"`
- // (Optional) List of documents to create the turn with.
- Documents []AgentTurnNewParamsDocument `json:"documents,omitzero"`
- // (Optional) The tool configuration to create the turn with, will be used to
- // override the agent's tool_config.
- ToolConfig AgentTurnNewParamsToolConfig `json:"tool_config,omitzero"`
- // (Optional) List of toolgroups to create the turn with, will be used in addition
- // to the agent's config toolgroups for the request.
- Toolgroups []AgentTurnNewParamsToolgroupUnion `json:"toolgroups,omitzero"`
- paramObj
-}
-
-func (r AgentTurnNewParams) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type AgentTurnNewParamsMessageUnion struct {
- OfUserMessage *UserMessageParam `json:",omitzero,inline"`
- OfToolResponseMessage *ToolResponseMessageParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u AgentTurnNewParamsMessageUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfUserMessage, u.OfToolResponseMessage)
-}
-func (u *AgentTurnNewParamsMessageUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *AgentTurnNewParamsMessageUnion) asAny() any {
- if !param.IsOmitted(u.OfUserMessage) {
- return u.OfUserMessage
- } else if !param.IsOmitted(u.OfToolResponseMessage) {
- return u.OfToolResponseMessage
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsMessageUnion) GetContext() *InterleavedContentUnionParam {
- if vt := u.OfUserMessage; vt != nil {
- return &vt.Context
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsMessageUnion) GetCallID() *string {
- if vt := u.OfToolResponseMessage; vt != nil {
- return &vt.CallID
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsMessageUnion) GetRole() *string {
- if vt := u.OfUserMessage; vt != nil {
- return (*string)(&vt.Role)
- } else if vt := u.OfToolResponseMessage; vt != nil {
- return (*string)(&vt.Role)
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's Content property, if present.
-func (u AgentTurnNewParamsMessageUnion) GetContent() *InterleavedContentUnionParam {
- if vt := u.OfUserMessage; vt != nil {
- return &vt.Content
- } else if vt := u.OfToolResponseMessage; vt != nil {
- return &vt.Content
- }
- return nil
-}
-
-// A document to be used by an agent.
-//
-// The properties Content, MimeType are required.
-type AgentTurnNewParamsDocument struct {
- // The content of the document.
- Content AgentTurnNewParamsDocumentContentUnion `json:"content,omitzero,required"`
- // The MIME type of the document.
- MimeType string `json:"mime_type,required"`
- paramObj
-}
-
-func (r AgentTurnNewParamsDocument) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsDocument
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsDocument) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type AgentTurnNewParamsDocumentContentUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfImageContentItem *AgentTurnNewParamsDocumentContentImageContentItem `json:",omitzero,inline"`
- OfTextContentItem *AgentTurnNewParamsDocumentContentTextContentItem `json:",omitzero,inline"`
- OfInterleavedContentItemArray []InterleavedContentItemUnionParam `json:",omitzero,inline"`
- OfURL *AgentTurnNewParamsDocumentContentURL `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u AgentTurnNewParamsDocumentContentUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString,
- u.OfImageContentItem,
- u.OfTextContentItem,
- u.OfInterleavedContentItemArray,
- u.OfURL)
-}
-func (u *AgentTurnNewParamsDocumentContentUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *AgentTurnNewParamsDocumentContentUnion) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfImageContentItem) {
- return u.OfImageContentItem
- } else if !param.IsOmitted(u.OfTextContentItem) {
- return u.OfTextContentItem
- } else if !param.IsOmitted(u.OfInterleavedContentItemArray) {
- return &u.OfInterleavedContentItemArray
- } else if !param.IsOmitted(u.OfURL) {
- return u.OfURL
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsDocumentContentUnion) GetImage() *AgentTurnNewParamsDocumentContentImageContentItemImage {
- if vt := u.OfImageContentItem; vt != nil {
- return &vt.Image
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsDocumentContentUnion) GetText() *string {
- if vt := u.OfTextContentItem; vt != nil {
- return &vt.Text
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsDocumentContentUnion) GetUri() *string {
- if vt := u.OfURL; vt != nil {
- return &vt.Uri
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u AgentTurnNewParamsDocumentContentUnion) GetType() *string {
- if vt := u.OfImageContentItem; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfTextContentItem; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
-}
-
-// A image content item
-//
-// The properties Image, Type are required.
-type AgentTurnNewParamsDocumentContentImageContentItem struct {
- // Image as a base64 encoded string or an URL
- Image AgentTurnNewParamsDocumentContentImageContentItemImage `json:"image,omitzero,required"`
- // Discriminator type of the content item. Always "image"
- //
- // This field can be elided, and will marshal its zero value as "image".
- Type constant.Image `json:"type,required"`
- paramObj
-}
-
-func (r AgentTurnNewParamsDocumentContentImageContentItem) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsDocumentContentImageContentItem
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsDocumentContentImageContentItem) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image as a base64 encoded string or an URL
-type AgentTurnNewParamsDocumentContentImageContentItemImage struct {
- // base64 encoded image data as string
- Data param.Opt[string] `json:"data,omitzero"`
- // A URL of the image or data URL in the format of data:image/{type};base64,{data}.
- // Note that URL could have length limits.
- URL AgentTurnNewParamsDocumentContentImageContentItemImageURL `json:"url,omitzero"`
- paramObj
-}
-
-func (r AgentTurnNewParamsDocumentContentImageContentItemImage) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsDocumentContentImageContentItemImage
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsDocumentContentImageContentItemImage) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
-// Note that URL could have length limits.
-//
-// The property Uri is required.
-type AgentTurnNewParamsDocumentContentImageContentItemImageURL struct {
- // The URL string pointing to the resource
- Uri string `json:"uri,required"`
- paramObj
-}
-
-func (r AgentTurnNewParamsDocumentContentImageContentItemImageURL) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsDocumentContentImageContentItemImageURL
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsDocumentContentImageContentItemImageURL) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A text content item
-//
-// The properties Text, Type are required.
-type AgentTurnNewParamsDocumentContentTextContentItem struct {
- // Text content
- Text string `json:"text,required"`
- // Discriminator type of the content item. Always "text"
- //
- // This field can be elided, and will marshal its zero value as "text".
- Type constant.Text `json:"type,required"`
- paramObj
-}
-
-func (r AgentTurnNewParamsDocumentContentTextContentItem) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsDocumentContentTextContentItem
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsDocumentContentTextContentItem) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A URL reference to external content.
-//
-// The property Uri is required.
-type AgentTurnNewParamsDocumentContentURL struct {
- // The URL string pointing to the resource
- Uri string `json:"uri,required"`
- paramObj
-}
-
-func (r AgentTurnNewParamsDocumentContentURL) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsDocumentContentURL
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsDocumentContentURL) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// (Optional) The tool configuration to create the turn with, will be used to
-// override the agent's tool_config.
-type AgentTurnNewParamsToolConfig struct {
- // (Optional) Config for how to override the default system prompt. -
- // `SystemMessageBehavior.append`: Appends the provided system message to the
- // default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
- // system prompt with the provided system message. The system message can include
- // the string '{{function_definitions}}' to indicate where the function definitions
- // should be inserted.
- //
- // Any of "append", "replace".
- SystemMessageBehavior string `json:"system_message_behavior,omitzero"`
- // (Optional) Whether tool use is automatic, required, or none. Can also specify a
- // tool name to use a specific tool. Defaults to ToolChoice.auto.
- ToolChoice string `json:"tool_choice,omitzero"`
- // (Optional) Instructs the model how to format tool calls. By default, Llama Stack
- // will attempt to use a format that is best adapted to the model. -
- // `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
- // `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
- // tag. - `ToolPromptFormat.python_list`: The tool calls
- // are output as Python syntax -- a list of function calls.
- //
- // Any of "json", "function_tag", "python_list".
- ToolPromptFormat string `json:"tool_prompt_format,omitzero"`
- paramObj
-}
-
-func (r AgentTurnNewParamsToolConfig) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsToolConfig
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsToolConfig) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func init() {
- apijson.RegisterFieldValidator[AgentTurnNewParamsToolConfig](
- "system_message_behavior", "append", "replace",
- )
- apijson.RegisterFieldValidator[AgentTurnNewParamsToolConfig](
- "tool_prompt_format", "json", "function_tag", "python_list",
- )
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type AgentTurnNewParamsToolgroupUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAgentToolGroupWithArgs *AgentTurnNewParamsToolgroupAgentToolGroupWithArgs `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u AgentTurnNewParamsToolgroupUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfAgentToolGroupWithArgs)
-}
-func (u *AgentTurnNewParamsToolgroupUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *AgentTurnNewParamsToolgroupUnion) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAgentToolGroupWithArgs) {
- return u.OfAgentToolGroupWithArgs
- }
- return nil
-}
-
-// The properties Args, Name are required.
-type AgentTurnNewParamsToolgroupAgentToolGroupWithArgs struct {
- Args map[string]AgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion `json:"args,omitzero,required"`
- Name string `json:"name,required"`
- paramObj
-}
-
-func (r AgentTurnNewParamsToolgroupAgentToolGroupWithArgs) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnNewParamsToolgroupAgentToolGroupWithArgs
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnNewParamsToolgroupAgentToolGroupWithArgs) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type AgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u AgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *AgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *AgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-type AgentTurnGetParams struct {
- AgentID string `path:"agent_id,required" json:"-"`
- SessionID string `path:"session_id,required" json:"-"`
- paramObj
-}
-
-type AgentTurnResumeParams struct {
- AgentID string `path:"agent_id,required" json:"-"`
- SessionID string `path:"session_id,required" json:"-"`
- // The tool call responses to resume the turn with.
- ToolResponses []ToolResponseParam `json:"tool_responses,omitzero,required"`
- paramObj
-}
-
-func (r AgentTurnResumeParams) MarshalJSON() (data []byte, err error) {
- type shadow AgentTurnResumeParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *AgentTurnResumeParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
diff --git a/alpha.go b/alpha.go
new file mode 100644
index 0000000..9e618d9
--- /dev/null
+++ b/alpha.go
@@ -0,0 +1,30 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient
+
+import (
+ "github.com/llamastack/llama-stack-client-go/option"
+)
+
+// AlphaService contains methods and other services that help with interacting with
+// the llama-stack-client 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 [NewAlphaService] method instead.
+type AlphaService struct {
+ Options []option.RequestOption
+ Inference AlphaInferenceService
+ Agents AlphaAgentService
+}
+
+// NewAlphaService 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 NewAlphaService(opts ...option.RequestOption) (r AlphaService) {
+ r = AlphaService{}
+ r.Options = opts
+ r.Inference = NewAlphaInferenceService(opts...)
+ r.Agents = NewAlphaAgentService(opts...)
+ return
+}
diff --git a/agent.go b/alphaagent.go
similarity index 84%
rename from agent.go
rename to alphaagent.go
index 73e4e27..bbbdf6b 100644
--- a/agent.go
+++ b/alphaagent.go
@@ -21,33 +21,33 @@ import (
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
-// AgentService contains methods and other services that help with interacting with
-// the llama-stack-client API.
+// AlphaAgentService contains methods and other services that help with interacting
+// with the llama-stack-client 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 [NewAgentService] method instead.
-type AgentService struct {
+// the [NewAlphaAgentService] method instead.
+type AlphaAgentService struct {
Options []option.RequestOption
- Session AgentSessionService
- Steps AgentStepService
- Turn AgentTurnService
+ Session AlphaAgentSessionService
+ Steps AlphaAgentStepService
+ Turn AlphaAgentTurnService
}
-// NewAgentService 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 NewAgentService(opts ...option.RequestOption) (r AgentService) {
- r = AgentService{}
+// NewAlphaAgentService 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 NewAlphaAgentService(opts ...option.RequestOption) (r AlphaAgentService) {
+ r = AlphaAgentService{}
r.Options = opts
- r.Session = NewAgentSessionService(opts...)
- r.Steps = NewAgentStepService(opts...)
- r.Turn = NewAgentTurnService(opts...)
+ r.Session = NewAlphaAgentSessionService(opts...)
+ r.Steps = NewAlphaAgentStepService(opts...)
+ r.Turn = NewAlphaAgentTurnService(opts...)
return
}
// Create an agent with the given configuration.
-func (r *AgentService) New(ctx context.Context, body AgentNewParams, opts ...option.RequestOption) (res *AgentNewResponse, err error) {
+func (r *AlphaAgentService) New(ctx context.Context, body AlphaAgentNewParams, opts ...option.RequestOption) (res *AlphaAgentNewResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/agents"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -55,7 +55,7 @@ func (r *AgentService) New(ctx context.Context, body AgentNewParams, opts ...opt
}
// Describe an agent by its ID.
-func (r *AgentService) Get(ctx context.Context, agentID string, opts ...option.RequestOption) (res *AgentGetResponse, err error) {
+func (r *AlphaAgentService) Get(ctx context.Context, agentID string, opts ...option.RequestOption) (res *AlphaAgentGetResponse, err error) {
opts = slices.Concat(r.Options, opts)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
@@ -67,7 +67,7 @@ func (r *AgentService) Get(ctx context.Context, agentID string, opts ...option.R
}
// List all agents.
-func (r *AgentService) List(ctx context.Context, query AgentListParams, opts ...option.RequestOption) (res *AgentListResponse, err error) {
+func (r *AlphaAgentService) List(ctx context.Context, query AlphaAgentListParams, opts ...option.RequestOption) (res *AlphaAgentListResponse, err error) {
opts = slices.Concat(r.Options, opts)
path := "v1/agents"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
@@ -75,7 +75,7 @@ func (r *AgentService) List(ctx context.Context, query AgentListParams, opts ...
}
// Delete an agent by its ID and its associated sessions and turns.
-func (r *AgentService) Delete(ctx context.Context, agentID string, opts ...option.RequestOption) (err error) {
+func (r *AlphaAgentService) Delete(ctx context.Context, agentID string, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if agentID == "" {
@@ -378,7 +378,7 @@ func (u *ToolResponseMetadataUnionParam) asAny() any {
}
// Response returned when creating a new agent.
-type AgentNewResponse struct {
+type AlphaAgentNewResponse struct {
// Unique identifier for the created agent
AgentID string `json:"agent_id,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -390,13 +390,13 @@ type AgentNewResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r AgentNewResponse) RawJSON() string { return r.JSON.raw }
-func (r *AgentNewResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaAgentNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaAgentNewResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// An agent instance with configuration and metadata.
-type AgentGetResponse struct {
+type AlphaAgentGetResponse struct {
// Configuration settings for the agent
AgentConfig AgentConfig `json:"agent_config,required"`
// Unique identifier for the agent
@@ -414,15 +414,15 @@ type AgentGetResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r AgentGetResponse) RawJSON() string { return r.JSON.raw }
-func (r *AgentGetResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaAgentGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaAgentGetResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A generic paginated response that follows a simple format.
-type AgentListResponse struct {
+type AlphaAgentListResponse struct {
// The list of items for the current page
- Data []map[string]AgentListResponseDataUnion `json:"data,required"`
+ Data []map[string]AlphaAgentListResponseDataUnion `json:"data,required"`
// Whether there are more items available after this set
HasMore bool `json:"has_more,required"`
// The URL for accessing this list
@@ -438,19 +438,19 @@ type AgentListResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r AgentListResponse) RawJSON() string { return r.JSON.raw }
-func (r *AgentListResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaAgentListResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaAgentListResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// AgentListResponseDataUnion contains all possible properties and values from
+// AlphaAgentListResponseDataUnion contains all possible properties and values from
// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type AgentListResponseDataUnion struct {
+type AlphaAgentListResponseDataUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -468,48 +468,48 @@ type AgentListResponseDataUnion struct {
} `json:"-"`
}
-func (u AgentListResponseDataUnion) AsBool() (v bool) {
+func (u AlphaAgentListResponseDataUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentListResponseDataUnion) AsFloat() (v float64) {
+func (u AlphaAgentListResponseDataUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentListResponseDataUnion) AsString() (v string) {
+func (u AlphaAgentListResponseDataUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentListResponseDataUnion) AsAnyArray() (v []any) {
+func (u AlphaAgentListResponseDataUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u AgentListResponseDataUnion) RawJSON() string { return u.JSON.raw }
+func (u AlphaAgentListResponseDataUnion) RawJSON() string { return u.JSON.raw }
-func (r *AgentListResponseDataUnion) UnmarshalJSON(data []byte) error {
+func (r *AlphaAgentListResponseDataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type AgentNewParams struct {
+type AlphaAgentNewParams struct {
// The configuration for the agent.
AgentConfig AgentConfigParam `json:"agent_config,omitzero,required"`
paramObj
}
-func (r AgentNewParams) MarshalJSON() (data []byte, err error) {
- type shadow AgentNewParams
+func (r AlphaAgentNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentNewParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *AgentNewParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaAgentNewParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type AgentListParams struct {
+type AlphaAgentListParams struct {
// The number of agents to return.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// The index to start the pagination from.
@@ -517,8 +517,8 @@ type AgentListParams struct {
paramObj
}
-// URLQuery serializes [AgentListParams]'s query parameters as `url.Values`.
-func (r AgentListParams) URLQuery() (v url.Values, err error) {
+// URLQuery serializes [AlphaAgentListParams]'s query parameters as `url.Values`.
+func (r AlphaAgentListParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
diff --git a/agent_test.go b/alphaagent_test.go
similarity index 89%
rename from agent_test.go
rename to alphaagent_test.go
index 7f85fec..4fefd68 100644
--- a/agent_test.go
+++ b/alphaagent_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestAgentNewWithOptionalParams(t *testing.T) {
+func TestAlphaAgentNewWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,7 +24,7 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.New(context.TODO(), llamastackclient.AgentNewParams{
+ _, err := client.Alpha.Agents.New(context.TODO(), llamastackclient.AlphaAgentNewParams{
AgentConfig: llamastackclient.AgentConfigParam{
Instructions: "instructions",
Model: "model",
@@ -91,7 +91,7 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
}
}
-func TestAgentGet(t *testing.T) {
+func TestAlphaAgentGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -102,7 +102,7 @@ func TestAgentGet(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Get(context.TODO(), "agent_id")
+ _, err := client.Alpha.Agents.Get(context.TODO(), "agent_id")
if err != nil {
var apierr *llamastackclient.Error
if errors.As(err, &apierr) {
@@ -112,7 +112,7 @@ func TestAgentGet(t *testing.T) {
}
}
-func TestAgentListWithOptionalParams(t *testing.T) {
+func TestAlphaAgentListWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -123,7 +123,7 @@ func TestAgentListWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.List(context.TODO(), llamastackclient.AgentListParams{
+ _, err := client.Alpha.Agents.List(context.TODO(), llamastackclient.AlphaAgentListParams{
Limit: llamastackclient.Int(0),
StartIndex: llamastackclient.Int(0),
})
@@ -136,7 +136,7 @@ func TestAgentListWithOptionalParams(t *testing.T) {
}
}
-func TestAgentDelete(t *testing.T) {
+func TestAlphaAgentDelete(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -147,7 +147,7 @@ func TestAgentDelete(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- err := client.Agents.Delete(context.TODO(), "agent_id")
+ err := client.Alpha.Agents.Delete(context.TODO(), "agent_id")
if err != nil {
var apierr *llamastackclient.Error
if errors.As(err, &apierr) {
diff --git a/agentsession.go b/alphaagentsession.go
similarity index 69%
rename from agentsession.go
rename to alphaagentsession.go
index cf0f23b..990b19c 100644
--- a/agentsession.go
+++ b/alphaagentsession.go
@@ -20,27 +20,27 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/respjson"
)
-// AgentSessionService contains methods and other services that help with
+// AlphaAgentSessionService contains methods and other services that help with
// interacting with the llama-stack-client 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 [NewAgentSessionService] method instead.
-type AgentSessionService struct {
+// the [NewAlphaAgentSessionService] method instead.
+type AlphaAgentSessionService struct {
Options []option.RequestOption
}
-// NewAgentSessionService 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 NewAgentSessionService(opts ...option.RequestOption) (r AgentSessionService) {
- r = AgentSessionService{}
+// NewAlphaAgentSessionService 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 NewAlphaAgentSessionService(opts ...option.RequestOption) (r AlphaAgentSessionService) {
+ r = AlphaAgentSessionService{}
r.Options = opts
return
}
// Create a new session for an agent.
-func (r *AgentSessionService) New(ctx context.Context, agentID string, body AgentSessionNewParams, opts ...option.RequestOption) (res *AgentSessionNewResponse, err error) {
+func (r *AlphaAgentSessionService) New(ctx context.Context, agentID string, body AlphaAgentSessionNewParams, opts ...option.RequestOption) (res *AlphaAgentSessionNewResponse, err error) {
opts = slices.Concat(r.Options, opts)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
@@ -52,7 +52,7 @@ func (r *AgentSessionService) New(ctx context.Context, agentID string, body Agen
}
// Retrieve an agent session by its ID.
-func (r *AgentSessionService) Get(ctx context.Context, sessionID string, params AgentSessionGetParams, opts ...option.RequestOption) (res *Session, err error) {
+func (r *AlphaAgentSessionService) Get(ctx context.Context, sessionID string, params AlphaAgentSessionGetParams, opts ...option.RequestOption) (res *Session, err error) {
opts = slices.Concat(r.Options, opts)
if params.AgentID == "" {
err = errors.New("missing required agent_id parameter")
@@ -68,7 +68,7 @@ func (r *AgentSessionService) Get(ctx context.Context, sessionID string, params
}
// List all session(s) of a given agent.
-func (r *AgentSessionService) List(ctx context.Context, agentID string, query AgentSessionListParams, opts ...option.RequestOption) (res *AgentSessionListResponse, err error) {
+func (r *AlphaAgentSessionService) List(ctx context.Context, agentID string, query AlphaAgentSessionListParams, opts ...option.RequestOption) (res *AlphaAgentSessionListResponse, err error) {
opts = slices.Concat(r.Options, opts)
if agentID == "" {
err = errors.New("missing required agent_id parameter")
@@ -80,7 +80,7 @@ func (r *AgentSessionService) List(ctx context.Context, agentID string, query Ag
}
// Delete an agent session by its ID and its associated turns.
-func (r *AgentSessionService) Delete(ctx context.Context, sessionID string, body AgentSessionDeleteParams, opts ...option.RequestOption) (err error) {
+func (r *AlphaAgentSessionService) Delete(ctx context.Context, sessionID string, body AlphaAgentSessionDeleteParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if body.AgentID == "" {
@@ -124,7 +124,7 @@ func (r *Session) UnmarshalJSON(data []byte) error {
}
// Response returned when creating a new agent session.
-type AgentSessionNewResponse struct {
+type AlphaAgentSessionNewResponse struct {
// Unique identifier for the created session
SessionID string `json:"session_id,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -136,15 +136,15 @@ type AgentSessionNewResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r AgentSessionNewResponse) RawJSON() string { return r.JSON.raw }
-func (r *AgentSessionNewResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaAgentSessionNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaAgentSessionNewResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A generic paginated response that follows a simple format.
-type AgentSessionListResponse struct {
+type AlphaAgentSessionListResponse struct {
// The list of items for the current page
- Data []map[string]AgentSessionListResponseDataUnion `json:"data,required"`
+ Data []map[string]AlphaAgentSessionListResponseDataUnion `json:"data,required"`
// Whether there are more items available after this set
HasMore bool `json:"has_more,required"`
// The URL for accessing this list
@@ -160,19 +160,19 @@ type AgentSessionListResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r AgentSessionListResponse) RawJSON() string { return r.JSON.raw }
-func (r *AgentSessionListResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaAgentSessionListResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaAgentSessionListResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// AgentSessionListResponseDataUnion contains all possible properties and values
-// from [bool], [float64], [string], [[]any].
+// AlphaAgentSessionListResponseDataUnion contains all possible properties and
+// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type AgentSessionListResponseDataUnion struct {
+type AlphaAgentSessionListResponseDataUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -190,63 +190,64 @@ type AgentSessionListResponseDataUnion struct {
} `json:"-"`
}
-func (u AgentSessionListResponseDataUnion) AsBool() (v bool) {
+func (u AlphaAgentSessionListResponseDataUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentSessionListResponseDataUnion) AsFloat() (v float64) {
+func (u AlphaAgentSessionListResponseDataUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentSessionListResponseDataUnion) AsString() (v string) {
+func (u AlphaAgentSessionListResponseDataUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentSessionListResponseDataUnion) AsAnyArray() (v []any) {
+func (u AlphaAgentSessionListResponseDataUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u AgentSessionListResponseDataUnion) RawJSON() string { return u.JSON.raw }
+func (u AlphaAgentSessionListResponseDataUnion) RawJSON() string { return u.JSON.raw }
-func (r *AgentSessionListResponseDataUnion) UnmarshalJSON(data []byte) error {
+func (r *AlphaAgentSessionListResponseDataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type AgentSessionNewParams struct {
+type AlphaAgentSessionNewParams struct {
// The name of the session to create.
SessionName string `json:"session_name,required"`
paramObj
}
-func (r AgentSessionNewParams) MarshalJSON() (data []byte, err error) {
- type shadow AgentSessionNewParams
+func (r AlphaAgentSessionNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentSessionNewParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *AgentSessionNewParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaAgentSessionNewParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type AgentSessionGetParams struct {
+type AlphaAgentSessionGetParams struct {
AgentID string `path:"agent_id,required" json:"-"`
// (Optional) List of turn IDs to filter the session by.
TurnIDs []string `query:"turn_ids,omitzero" json:"-"`
paramObj
}
-// URLQuery serializes [AgentSessionGetParams]'s query parameters as `url.Values`.
-func (r AgentSessionGetParams) URLQuery() (v url.Values, err error) {
+// URLQuery serializes [AlphaAgentSessionGetParams]'s query parameters as
+// `url.Values`.
+func (r AlphaAgentSessionGetParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
-type AgentSessionListParams struct {
+type AlphaAgentSessionListParams struct {
// The number of sessions to return.
Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
// The index to start the pagination from.
@@ -254,15 +255,16 @@ type AgentSessionListParams struct {
paramObj
}
-// URLQuery serializes [AgentSessionListParams]'s query parameters as `url.Values`.
-func (r AgentSessionListParams) URLQuery() (v url.Values, err error) {
+// URLQuery serializes [AlphaAgentSessionListParams]'s query parameters as
+// `url.Values`.
+func (r AlphaAgentSessionListParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
-type AgentSessionDeleteParams struct {
+type AlphaAgentSessionDeleteParams struct {
AgentID string `path:"agent_id,required" json:"-"`
paramObj
}
diff --git a/agentsession_test.go b/alphaagentsession_test.go
similarity index 80%
rename from agentsession_test.go
rename to alphaagentsession_test.go
index 1960a8f..e31dec5 100644
--- a/agentsession_test.go
+++ b/alphaagentsession_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestAgentSessionNew(t *testing.T) {
+func TestAlphaAgentSessionNew(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,10 +24,10 @@ func TestAgentSessionNew(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Session.New(
+ _, err := client.Alpha.Agents.Session.New(
context.TODO(),
"agent_id",
- llamastackclient.AgentSessionNewParams{
+ llamastackclient.AlphaAgentSessionNewParams{
SessionName: "session_name",
},
)
@@ -40,7 +40,7 @@ func TestAgentSessionNew(t *testing.T) {
}
}
-func TestAgentSessionGetWithOptionalParams(t *testing.T) {
+func TestAlphaAgentSessionGetWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -51,10 +51,10 @@ func TestAgentSessionGetWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Session.Get(
+ _, err := client.Alpha.Agents.Session.Get(
context.TODO(),
"session_id",
- llamastackclient.AgentSessionGetParams{
+ llamastackclient.AlphaAgentSessionGetParams{
AgentID: "agent_id",
TurnIDs: []string{"string"},
},
@@ -68,7 +68,7 @@ func TestAgentSessionGetWithOptionalParams(t *testing.T) {
}
}
-func TestAgentSessionListWithOptionalParams(t *testing.T) {
+func TestAlphaAgentSessionListWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -79,10 +79,10 @@ func TestAgentSessionListWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Session.List(
+ _, err := client.Alpha.Agents.Session.List(
context.TODO(),
"agent_id",
- llamastackclient.AgentSessionListParams{
+ llamastackclient.AlphaAgentSessionListParams{
Limit: llamastackclient.Int(0),
StartIndex: llamastackclient.Int(0),
},
@@ -96,7 +96,7 @@ func TestAgentSessionListWithOptionalParams(t *testing.T) {
}
}
-func TestAgentSessionDelete(t *testing.T) {
+func TestAlphaAgentSessionDelete(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -107,10 +107,10 @@ func TestAgentSessionDelete(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- err := client.Agents.Session.Delete(
+ err := client.Alpha.Agents.Session.Delete(
context.TODO(),
"session_id",
- llamastackclient.AgentSessionDeleteParams{
+ llamastackclient.AlphaAgentSessionDeleteParams{
AgentID: "agent_id",
},
)
diff --git a/agentstep.go b/alphaagentstep.go
similarity index 63%
rename from agentstep.go
rename to alphaagentstep.go
index 3d1d601..00aac7c 100644
--- a/agentstep.go
+++ b/alphaagentstep.go
@@ -17,27 +17,27 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/respjson"
)
-// AgentStepService contains methods and other services that help with interacting
-// with the llama-stack-client API.
+// AlphaAgentStepService contains methods and other services that help with
+// interacting with the llama-stack-client 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 [NewAgentStepService] method instead.
-type AgentStepService struct {
+// the [NewAlphaAgentStepService] method instead.
+type AlphaAgentStepService struct {
Options []option.RequestOption
}
-// NewAgentStepService generates a new service that applies the given options to
-// each request. These options are applied after the parent client's options (if
+// NewAlphaAgentStepService 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 NewAgentStepService(opts ...option.RequestOption) (r AgentStepService) {
- r = AgentStepService{}
+func NewAlphaAgentStepService(opts ...option.RequestOption) (r AlphaAgentStepService) {
+ r = AlphaAgentStepService{}
r.Options = opts
return
}
// Retrieve an agent step by its ID.
-func (r *AgentStepService) Get(ctx context.Context, stepID string, query AgentStepGetParams, opts ...option.RequestOption) (res *AgentStepGetResponse, err error) {
+func (r *AlphaAgentStepService) Get(ctx context.Context, stepID string, query AlphaAgentStepGetParams, opts ...option.RequestOption) (res *AlphaAgentStepGetResponse, err error) {
opts = slices.Concat(r.Options, opts)
if query.AgentID == "" {
err = errors.New("missing required agent_id parameter")
@@ -61,9 +61,9 @@ func (r *AgentStepService) Get(ctx context.Context, stepID string, query AgentSt
}
// Response containing details of a specific agent step.
-type AgentStepGetResponse struct {
+type AlphaAgentStepGetResponse struct {
// The complete step data and execution details
- Step AgentStepGetResponseStepUnion `json:"step,required"`
+ Step AlphaAgentStepGetResponseStepUnion `json:"step,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Step respjson.Field
@@ -73,18 +73,20 @@ type AgentStepGetResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r AgentStepGetResponse) RawJSON() string { return r.JSON.raw }
-func (r *AgentStepGetResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaAgentStepGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaAgentStepGetResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// AgentStepGetResponseStepUnion contains all possible properties and values from
-// [InferenceStep], [ToolExecutionStep], [ShieldCallStep], [MemoryRetrievalStep].
+// AlphaAgentStepGetResponseStepUnion contains all possible properties and values
+// from [InferenceStep], [ToolExecutionStep], [ShieldCallStep],
+// [MemoryRetrievalStep].
//
-// Use the [AgentStepGetResponseStepUnion.AsAny] method to switch on the variant.
+// Use the [AlphaAgentStepGetResponseStepUnion.AsAny] method to switch on the
+// variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type AgentStepGetResponseStepUnion struct {
+type AlphaAgentStepGetResponseStepUnion struct {
// This field is from variant [InferenceStep].
ModelResponse CompletionMessage `json:"model_response"`
StepID string `json:"step_id"`
@@ -119,21 +121,21 @@ type AgentStepGetResponseStepUnion struct {
} `json:"-"`
}
-// anyAgentStepGetResponseStep is implemented by each variant of
-// [AgentStepGetResponseStepUnion] to add type safety for the return type of
-// [AgentStepGetResponseStepUnion.AsAny]
-type anyAgentStepGetResponseStep interface {
- implAgentStepGetResponseStepUnion()
+// anyAlphaAgentStepGetResponseStep is implemented by each variant of
+// [AlphaAgentStepGetResponseStepUnion] to add type safety for the return type of
+// [AlphaAgentStepGetResponseStepUnion.AsAny]
+type anyAlphaAgentStepGetResponseStep interface {
+ implAlphaAgentStepGetResponseStepUnion()
}
-func (InferenceStep) implAgentStepGetResponseStepUnion() {}
-func (ToolExecutionStep) implAgentStepGetResponseStepUnion() {}
-func (ShieldCallStep) implAgentStepGetResponseStepUnion() {}
-func (MemoryRetrievalStep) implAgentStepGetResponseStepUnion() {}
+func (InferenceStep) implAlphaAgentStepGetResponseStepUnion() {}
+func (ToolExecutionStep) implAlphaAgentStepGetResponseStepUnion() {}
+func (ShieldCallStep) implAlphaAgentStepGetResponseStepUnion() {}
+func (MemoryRetrievalStep) implAlphaAgentStepGetResponseStepUnion() {}
// Use the following switch statement to find the correct variant
//
-// switch variant := AgentStepGetResponseStepUnion.AsAny().(type) {
+// switch variant := AlphaAgentStepGetResponseStepUnion.AsAny().(type) {
// case llamastackclient.InferenceStep:
// case llamastackclient.ToolExecutionStep:
// case llamastackclient.ShieldCallStep:
@@ -141,7 +143,7 @@ func (MemoryRetrievalStep) implAgentStepGetResponseStepUnion() {}
// default:
// fmt.Errorf("no variant present")
// }
-func (u AgentStepGetResponseStepUnion) AsAny() anyAgentStepGetResponseStep {
+func (u AlphaAgentStepGetResponseStepUnion) AsAny() anyAlphaAgentStepGetResponseStep {
switch u.StepType {
case "inference":
return u.AsInference()
@@ -155,34 +157,34 @@ func (u AgentStepGetResponseStepUnion) AsAny() anyAgentStepGetResponseStep {
return nil
}
-func (u AgentStepGetResponseStepUnion) AsInference() (v InferenceStep) {
+func (u AlphaAgentStepGetResponseStepUnion) AsInference() (v InferenceStep) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentStepGetResponseStepUnion) AsToolExecution() (v ToolExecutionStep) {
+func (u AlphaAgentStepGetResponseStepUnion) AsToolExecution() (v ToolExecutionStep) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentStepGetResponseStepUnion) AsShieldCall() (v ShieldCallStep) {
+func (u AlphaAgentStepGetResponseStepUnion) AsShieldCall() (v ShieldCallStep) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u AgentStepGetResponseStepUnion) AsMemoryRetrieval() (v MemoryRetrievalStep) {
+func (u AlphaAgentStepGetResponseStepUnion) AsMemoryRetrieval() (v MemoryRetrievalStep) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u AgentStepGetResponseStepUnion) RawJSON() string { return u.JSON.raw }
+func (u AlphaAgentStepGetResponseStepUnion) RawJSON() string { return u.JSON.raw }
-func (r *AgentStepGetResponseStepUnion) UnmarshalJSON(data []byte) error {
+func (r *AlphaAgentStepGetResponseStepUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type AgentStepGetParams struct {
+type AlphaAgentStepGetParams struct {
AgentID string `path:"agent_id,required" json:"-"`
SessionID string `path:"session_id,required" json:"-"`
TurnID string `path:"turn_id,required" json:"-"`
diff --git a/agentstep_test.go b/alphaagentstep_test.go
similarity index 87%
rename from agentstep_test.go
rename to alphaagentstep_test.go
index 7e8f080..cfc222b 100644
--- a/agentstep_test.go
+++ b/alphaagentstep_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestAgentStepGet(t *testing.T) {
+func TestAlphaAgentStepGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,10 +24,10 @@ func TestAgentStepGet(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Steps.Get(
+ _, err := client.Alpha.Agents.Steps.Get(
context.TODO(),
"step_id",
- llamastackclient.AgentStepGetParams{
+ llamastackclient.AlphaAgentStepGetParams{
AgentID: "agent_id",
SessionID: "session_id",
TurnID: "turn_id",
diff --git a/alphaagentturn.go b/alphaagentturn.go
new file mode 100644
index 0000000..8aab34d
--- /dev/null
+++ b/alphaagentturn.go
@@ -0,0 +1,922 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "net/http"
+ "slices"
+ "time"
+
+ "github.com/llamastack/llama-stack-client-go/internal/apijson"
+ "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
+ "github.com/llamastack/llama-stack-client-go/option"
+ "github.com/llamastack/llama-stack-client-go/packages/param"
+ "github.com/llamastack/llama-stack-client-go/packages/respjson"
+ "github.com/llamastack/llama-stack-client-go/packages/ssestream"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
+)
+
+// AlphaAgentTurnService contains methods and other services that help with
+// interacting with the llama-stack-client 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 [NewAlphaAgentTurnService] method instead.
+type AlphaAgentTurnService struct {
+ Options []option.RequestOption
+}
+
+// NewAlphaAgentTurnService 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 NewAlphaAgentTurnService(opts ...option.RequestOption) (r AlphaAgentTurnService) {
+ r = AlphaAgentTurnService{}
+ r.Options = opts
+ return
+}
+
+// Create a new turn for an agent.
+func (r *AlphaAgentTurnService) New(ctx context.Context, sessionID string, params AlphaAgentTurnNewParams, opts ...option.RequestOption) (res *Turn, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if params.AgentID == "" {
+ err = errors.New("missing required agent_id parameter")
+ return
+ }
+ if sessionID == "" {
+ err = errors.New("missing required session_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
+ return
+}
+
+// Create a new turn for an agent.
+func (r *AlphaAgentTurnService) NewStreaming(ctx context.Context, sessionID string, params AlphaAgentTurnNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[any]) {
+ var (
+ raw *http.Response
+ err error
+ )
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
+ if params.AgentID == "" {
+ err = errors.New("missing required agent_id parameter")
+ return
+ }
+ if sessionID == "" {
+ err = errors.New("missing required session_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
+ return ssestream.NewStream[any](ssestream.NewDecoder(raw), err)
+}
+
+// Retrieve an agent turn by its ID.
+func (r *AlphaAgentTurnService) Get(ctx context.Context, turnID string, query AlphaAgentTurnGetParams, opts ...option.RequestOption) (res *Turn, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if query.AgentID == "" {
+ err = errors.New("missing required agent_id parameter")
+ return
+ }
+ if query.SessionID == "" {
+ err = errors.New("missing required session_id parameter")
+ return
+ }
+ if turnID == "" {
+ err = errors.New("missing required turn_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s", query.AgentID, query.SessionID, turnID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
+// Resume an agent turn with executed tool call responses. When a Turn has the
+// status `awaiting_input` due to pending input from client side tool calls, this
+// endpoint can be used to submit the outputs from the tool calls once they are
+// ready.
+func (r *AlphaAgentTurnService) Resume(ctx context.Context, turnID string, params AlphaAgentTurnResumeParams, opts ...option.RequestOption) (res *Turn, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if params.AgentID == "" {
+ err = errors.New("missing required agent_id parameter")
+ return
+ }
+ if params.SessionID == "" {
+ err = errors.New("missing required session_id parameter")
+ return
+ }
+ if turnID == "" {
+ err = errors.New("missing required turn_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
+ return
+}
+
+// Resume an agent turn with executed tool call responses. When a Turn has the
+// status `awaiting_input` due to pending input from client side tool calls, this
+// endpoint can be used to submit the outputs from the tool calls once they are
+// ready.
+func (r *AlphaAgentTurnService) ResumeStreaming(ctx context.Context, turnID string, params AlphaAgentTurnResumeParams, opts ...option.RequestOption) (stream *ssestream.Stream[any]) {
+ var (
+ raw *http.Response
+ err error
+ )
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
+ if params.AgentID == "" {
+ err = errors.New("missing required agent_id parameter")
+ return
+ }
+ if params.SessionID == "" {
+ err = errors.New("missing required session_id parameter")
+ return
+ }
+ if turnID == "" {
+ err = errors.New("missing required turn_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
+ return ssestream.NewStream[any](ssestream.NewDecoder(raw), err)
+}
+
+// A single turn in an interaction with an Agentic System.
+type Turn struct {
+ // List of messages that initiated this turn
+ InputMessages []TurnInputMessageUnion `json:"input_messages,required"`
+ // The model's generated response containing content and metadata
+ OutputMessage CompletionMessage `json:"output_message,required"`
+ // Unique identifier for the conversation session
+ SessionID string `json:"session_id,required"`
+ // Timestamp when the turn began
+ StartedAt time.Time `json:"started_at,required" format:"date-time"`
+ // Ordered list of processing steps executed during this turn
+ Steps []TurnStepUnion `json:"steps,required"`
+ // Unique identifier for the turn within a session
+ TurnID string `json:"turn_id,required"`
+ // (Optional) Timestamp when the turn finished, if completed
+ CompletedAt time.Time `json:"completed_at" format:"date-time"`
+ // (Optional) Files or media attached to the agent's response
+ OutputAttachments []TurnOutputAttachment `json:"output_attachments"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputMessages respjson.Field
+ OutputMessage respjson.Field
+ SessionID respjson.Field
+ StartedAt respjson.Field
+ Steps respjson.Field
+ TurnID respjson.Field
+ CompletedAt respjson.Field
+ OutputAttachments respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r Turn) RawJSON() string { return r.JSON.raw }
+func (r *Turn) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnInputMessageUnion contains all possible properties and values from
+// [UserMessage], [ToolResponseMessage].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type TurnInputMessageUnion struct {
+ // This field is from variant [UserMessage].
+ Content InterleavedContentUnion `json:"content"`
+ Role string `json:"role"`
+ // This field is from variant [UserMessage].
+ Context InterleavedContentUnion `json:"context"`
+ // This field is from variant [ToolResponseMessage].
+ CallID string `json:"call_id"`
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Context respjson.Field
+ CallID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u TurnInputMessageUnion) AsUserMessage() (v UserMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnInputMessageUnion) AsToolResponseMessage() (v ToolResponseMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnInputMessageUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnInputMessageUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnStepUnion contains all possible properties and values from [InferenceStep],
+// [ToolExecutionStep], [ShieldCallStep], [MemoryRetrievalStep].
+//
+// Use the [TurnStepUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type TurnStepUnion struct {
+ // This field is from variant [InferenceStep].
+ ModelResponse CompletionMessage `json:"model_response"`
+ StepID string `json:"step_id"`
+ // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
+ StepType string `json:"step_type"`
+ TurnID string `json:"turn_id"`
+ CompletedAt time.Time `json:"completed_at"`
+ StartedAt time.Time `json:"started_at"`
+ // This field is from variant [ToolExecutionStep].
+ ToolCalls []ToolCall `json:"tool_calls"`
+ // This field is from variant [ToolExecutionStep].
+ ToolResponses []ToolResponse `json:"tool_responses"`
+ // This field is from variant [ShieldCallStep].
+ Violation SafetyViolation `json:"violation"`
+ // This field is from variant [MemoryRetrievalStep].
+ InsertedContext InterleavedContentUnion `json:"inserted_context"`
+ // This field is from variant [MemoryRetrievalStep].
+ VectorDBIDs string `json:"vector_db_ids"`
+ JSON struct {
+ ModelResponse respjson.Field
+ StepID respjson.Field
+ StepType respjson.Field
+ TurnID respjson.Field
+ CompletedAt respjson.Field
+ StartedAt respjson.Field
+ ToolCalls respjson.Field
+ ToolResponses respjson.Field
+ Violation respjson.Field
+ InsertedContext respjson.Field
+ VectorDBIDs respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyTurnStep is implemented by each variant of [TurnStepUnion] to add type safety
+// for the return type of [TurnStepUnion.AsAny]
+type anyTurnStep interface {
+ implTurnStepUnion()
+}
+
+func (InferenceStep) implTurnStepUnion() {}
+func (ToolExecutionStep) implTurnStepUnion() {}
+func (ShieldCallStep) implTurnStepUnion() {}
+func (MemoryRetrievalStep) implTurnStepUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := TurnStepUnion.AsAny().(type) {
+// case llamastackclient.InferenceStep:
+// case llamastackclient.ToolExecutionStep:
+// case llamastackclient.ShieldCallStep:
+// case llamastackclient.MemoryRetrievalStep:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u TurnStepUnion) AsAny() anyTurnStep {
+ switch u.StepType {
+ case "inference":
+ return u.AsInference()
+ case "tool_execution":
+ return u.AsToolExecution()
+ case "shield_call":
+ return u.AsShieldCall()
+ case "memory_retrieval":
+ return u.AsMemoryRetrieval()
+ }
+ return nil
+}
+
+func (u TurnStepUnion) AsInference() (v InferenceStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnStepUnion) AsToolExecution() (v ToolExecutionStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnStepUnion) AsShieldCall() (v ShieldCallStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnStepUnion) AsMemoryRetrieval() (v MemoryRetrievalStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnStepUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnStepUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An attachment to an agent turn.
+type TurnOutputAttachment struct {
+ // The content of the attachment.
+ Content TurnOutputAttachmentContentUnion `json:"content,required"`
+ // The MIME type of the attachment.
+ MimeType string `json:"mime_type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Content respjson.Field
+ MimeType respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnOutputAttachment) RawJSON() string { return r.JSON.raw }
+func (r *TurnOutputAttachment) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnOutputAttachmentContentUnion contains all possible properties and values
+// from [string], [TurnOutputAttachmentContentImageContentItem],
+// [TurnOutputAttachmentContentTextContentItem], [[]InterleavedContentItemUnion],
+// [TurnOutputAttachmentContentURL].
+//
+// 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: OfString OfInterleavedContentItemArray]
+type TurnOutputAttachmentContentUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]InterleavedContentItemUnion]
+ // instead of an object.
+ OfInterleavedContentItemArray []InterleavedContentItemUnion `json:",inline"`
+ // This field is from variant [TurnOutputAttachmentContentImageContentItem].
+ Image TurnOutputAttachmentContentImageContentItemImage `json:"image"`
+ Type string `json:"type"`
+ // This field is from variant [TurnOutputAttachmentContentTextContentItem].
+ Text string `json:"text"`
+ // This field is from variant [TurnOutputAttachmentContentURL].
+ Uri string `json:"uri"`
+ JSON struct {
+ OfString respjson.Field
+ OfInterleavedContentItemArray respjson.Field
+ Image respjson.Field
+ Type respjson.Field
+ Text respjson.Field
+ Uri respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u TurnOutputAttachmentContentUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnOutputAttachmentContentUnion) AsImageContentItem() (v TurnOutputAttachmentContentImageContentItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnOutputAttachmentContentUnion) AsTextContentItem() (v TurnOutputAttachmentContentTextContentItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnOutputAttachmentContentUnion) AsInterleavedContentItemArray() (v []InterleavedContentItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnOutputAttachmentContentUnion) AsURL() (v TurnOutputAttachmentContentURL) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnOutputAttachmentContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnOutputAttachmentContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A image content item
+type TurnOutputAttachmentContentImageContentItem struct {
+ // Image as a base64 encoded string or an URL
+ Image TurnOutputAttachmentContentImageContentItemImage `json:"image,required"`
+ // Discriminator type of the content item. Always "image"
+ Type constant.Image `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Image respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnOutputAttachmentContentImageContentItem) RawJSON() string { return r.JSON.raw }
+func (r *TurnOutputAttachmentContentImageContentItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image as a base64 encoded string or an URL
+type TurnOutputAttachmentContentImageContentItemImage struct {
+ // base64 encoded image data as string
+ Data string `json:"data"`
+ // A URL of the image or data URL in the format of data:image/{type};base64,{data}.
+ // Note that URL could have length limits.
+ URL TurnOutputAttachmentContentImageContentItemImageURL `json:"url"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnOutputAttachmentContentImageContentItemImage) RawJSON() string { return r.JSON.raw }
+func (r *TurnOutputAttachmentContentImageContentItemImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
+// Note that URL could have length limits.
+type TurnOutputAttachmentContentImageContentItemImageURL struct {
+ // The URL string pointing to the resource
+ Uri string `json:"uri,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Uri respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnOutputAttachmentContentImageContentItemImageURL) RawJSON() string { return r.JSON.raw }
+func (r *TurnOutputAttachmentContentImageContentItemImageURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text content item
+type TurnOutputAttachmentContentTextContentItem struct {
+ // Text content
+ Text string `json:"text,required"`
+ // Discriminator type of the content item. Always "text"
+ Type constant.Text `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnOutputAttachmentContentTextContentItem) RawJSON() string { return r.JSON.raw }
+func (r *TurnOutputAttachmentContentTextContentItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A URL reference to external content.
+type TurnOutputAttachmentContentURL struct {
+ // The URL string pointing to the resource
+ Uri string `json:"uri,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Uri respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnOutputAttachmentContentURL) RawJSON() string { return r.JSON.raw }
+func (r *TurnOutputAttachmentContentURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type AlphaAgentTurnNewParams struct {
+ AgentID string `path:"agent_id,required" json:"-"`
+ // List of messages to start the turn with.
+ Messages []AlphaAgentTurnNewParamsMessageUnion `json:"messages,omitzero,required"`
+ // (Optional) List of documents to create the turn with.
+ Documents []AlphaAgentTurnNewParamsDocument `json:"documents,omitzero"`
+ // (Optional) The tool configuration to create the turn with, will be used to
+ // override the agent's tool_config.
+ ToolConfig AlphaAgentTurnNewParamsToolConfig `json:"tool_config,omitzero"`
+ // (Optional) List of toolgroups to create the turn with, will be used in addition
+ // to the agent's config toolgroups for the request.
+ Toolgroups []AlphaAgentTurnNewParamsToolgroupUnion `json:"toolgroups,omitzero"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type AlphaAgentTurnNewParamsMessageUnion struct {
+ OfUserMessage *UserMessageParam `json:",omitzero,inline"`
+ OfToolResponseMessage *ToolResponseMessageParam `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u AlphaAgentTurnNewParamsMessageUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfUserMessage, u.OfToolResponseMessage)
+}
+func (u *AlphaAgentTurnNewParamsMessageUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *AlphaAgentTurnNewParamsMessageUnion) asAny() any {
+ if !param.IsOmitted(u.OfUserMessage) {
+ return u.OfUserMessage
+ } else if !param.IsOmitted(u.OfToolResponseMessage) {
+ return u.OfToolResponseMessage
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsMessageUnion) GetContext() *InterleavedContentUnionParam {
+ if vt := u.OfUserMessage; vt != nil {
+ return &vt.Context
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsMessageUnion) GetCallID() *string {
+ if vt := u.OfToolResponseMessage; vt != nil {
+ return &vt.CallID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsMessageUnion) GetRole() *string {
+ if vt := u.OfUserMessage; vt != nil {
+ return (*string)(&vt.Role)
+ } else if vt := u.OfToolResponseMessage; vt != nil {
+ return (*string)(&vt.Role)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's Content property, if present.
+func (u AlphaAgentTurnNewParamsMessageUnion) GetContent() *InterleavedContentUnionParam {
+ if vt := u.OfUserMessage; vt != nil {
+ return &vt.Content
+ } else if vt := u.OfToolResponseMessage; vt != nil {
+ return &vt.Content
+ }
+ return nil
+}
+
+// A document to be used by an agent.
+//
+// The properties Content, MimeType are required.
+type AlphaAgentTurnNewParamsDocument struct {
+ // The content of the document.
+ Content AlphaAgentTurnNewParamsDocumentContentUnion `json:"content,omitzero,required"`
+ // The MIME type of the document.
+ MimeType string `json:"mime_type,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsDocument) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsDocument
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsDocument) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type AlphaAgentTurnNewParamsDocumentContentUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfImageContentItem *AlphaAgentTurnNewParamsDocumentContentImageContentItem `json:",omitzero,inline"`
+ OfTextContentItem *AlphaAgentTurnNewParamsDocumentContentTextContentItem `json:",omitzero,inline"`
+ OfInterleavedContentItemArray []InterleavedContentItemUnionParam `json:",omitzero,inline"`
+ OfURL *AlphaAgentTurnNewParamsDocumentContentURL `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u AlphaAgentTurnNewParamsDocumentContentUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString,
+ u.OfImageContentItem,
+ u.OfTextContentItem,
+ u.OfInterleavedContentItemArray,
+ u.OfURL)
+}
+func (u *AlphaAgentTurnNewParamsDocumentContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *AlphaAgentTurnNewParamsDocumentContentUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfImageContentItem) {
+ return u.OfImageContentItem
+ } else if !param.IsOmitted(u.OfTextContentItem) {
+ return u.OfTextContentItem
+ } else if !param.IsOmitted(u.OfInterleavedContentItemArray) {
+ return &u.OfInterleavedContentItemArray
+ } else if !param.IsOmitted(u.OfURL) {
+ return u.OfURL
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsDocumentContentUnion) GetImage() *AlphaAgentTurnNewParamsDocumentContentImageContentItemImage {
+ if vt := u.OfImageContentItem; vt != nil {
+ return &vt.Image
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsDocumentContentUnion) GetText() *string {
+ if vt := u.OfTextContentItem; vt != nil {
+ return &vt.Text
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsDocumentContentUnion) GetUri() *string {
+ if vt := u.OfURL; vt != nil {
+ return &vt.Uri
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u AlphaAgentTurnNewParamsDocumentContentUnion) GetType() *string {
+ if vt := u.OfImageContentItem; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfTextContentItem; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// A image content item
+//
+// The properties Image, Type are required.
+type AlphaAgentTurnNewParamsDocumentContentImageContentItem struct {
+ // Image as a base64 encoded string or an URL
+ Image AlphaAgentTurnNewParamsDocumentContentImageContentItemImage `json:"image,omitzero,required"`
+ // Discriminator type of the content item. Always "image"
+ //
+ // This field can be elided, and will marshal its zero value as "image".
+ Type constant.Image `json:"type,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsDocumentContentImageContentItem) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsDocumentContentImageContentItem
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsDocumentContentImageContentItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image as a base64 encoded string or an URL
+type AlphaAgentTurnNewParamsDocumentContentImageContentItemImage struct {
+ // base64 encoded image data as string
+ Data param.Opt[string] `json:"data,omitzero"`
+ // A URL of the image or data URL in the format of data:image/{type};base64,{data}.
+ // Note that URL could have length limits.
+ URL AlphaAgentTurnNewParamsDocumentContentImageContentItemImageURL `json:"url,omitzero"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsDocumentContentImageContentItemImage) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsDocumentContentImageContentItemImage
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsDocumentContentImageContentItemImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A URL of the image or data URL in the format of data:image/{type};base64,{data}.
+// Note that URL could have length limits.
+//
+// The property Uri is required.
+type AlphaAgentTurnNewParamsDocumentContentImageContentItemImageURL struct {
+ // The URL string pointing to the resource
+ Uri string `json:"uri,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsDocumentContentImageContentItemImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsDocumentContentImageContentItemImageURL
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsDocumentContentImageContentItemImageURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text content item
+//
+// The properties Text, Type are required.
+type AlphaAgentTurnNewParamsDocumentContentTextContentItem struct {
+ // Text content
+ Text string `json:"text,required"`
+ // Discriminator type of the content item. Always "text"
+ //
+ // This field can be elided, and will marshal its zero value as "text".
+ Type constant.Text `json:"type,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsDocumentContentTextContentItem) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsDocumentContentTextContentItem
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsDocumentContentTextContentItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A URL reference to external content.
+//
+// The property Uri is required.
+type AlphaAgentTurnNewParamsDocumentContentURL struct {
+ // The URL string pointing to the resource
+ Uri string `json:"uri,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsDocumentContentURL) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsDocumentContentURL
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsDocumentContentURL) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// (Optional) The tool configuration to create the turn with, will be used to
+// override the agent's tool_config.
+type AlphaAgentTurnNewParamsToolConfig struct {
+ // (Optional) Config for how to override the default system prompt. -
+ // `SystemMessageBehavior.append`: Appends the provided system message to the
+ // default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
+ // system prompt with the provided system message. The system message can include
+ // the string '{{function_definitions}}' to indicate where the function definitions
+ // should be inserted.
+ //
+ // Any of "append", "replace".
+ SystemMessageBehavior string `json:"system_message_behavior,omitzero"`
+ // (Optional) Whether tool use is automatic, required, or none. Can also specify a
+ // tool name to use a specific tool. Defaults to ToolChoice.auto.
+ ToolChoice string `json:"tool_choice,omitzero"`
+ // (Optional) Instructs the model how to format tool calls. By default, Llama Stack
+ // will attempt to use a format that is best adapted to the model. -
+ // `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
+ // `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
+ // tag. - `ToolPromptFormat.python_list`: The tool calls
+ // are output as Python syntax -- a list of function calls.
+ //
+ // Any of "json", "function_tag", "python_list".
+ ToolPromptFormat string `json:"tool_prompt_format,omitzero"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsToolConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsToolConfig
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsToolConfig) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func init() {
+ apijson.RegisterFieldValidator[AlphaAgentTurnNewParamsToolConfig](
+ "system_message_behavior", "append", "replace",
+ )
+ apijson.RegisterFieldValidator[AlphaAgentTurnNewParamsToolConfig](
+ "tool_prompt_format", "json", "function_tag", "python_list",
+ )
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type AlphaAgentTurnNewParamsToolgroupUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAgentToolGroupWithArgs *AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgs `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u AlphaAgentTurnNewParamsToolgroupUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfAgentToolGroupWithArgs)
+}
+func (u *AlphaAgentTurnNewParamsToolgroupUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *AlphaAgentTurnNewParamsToolgroupUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAgentToolGroupWithArgs) {
+ return u.OfAgentToolGroupWithArgs
+ }
+ return nil
+}
+
+// The properties Args, Name are required.
+type AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgs struct {
+ Args map[string]AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion `json:"args,omitzero,required"`
+ Name string `json:"name,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgs) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgs
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgs) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *AlphaAgentTurnNewParamsToolgroupAgentToolGroupWithArgsArgUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
+type AlphaAgentTurnGetParams struct {
+ AgentID string `path:"agent_id,required" json:"-"`
+ SessionID string `path:"session_id,required" json:"-"`
+ paramObj
+}
+
+type AlphaAgentTurnResumeParams struct {
+ AgentID string `path:"agent_id,required" json:"-"`
+ SessionID string `path:"session_id,required" json:"-"`
+ // The tool call responses to resume the turn with.
+ ToolResponses []ToolResponseParam `json:"tool_responses,omitzero,required"`
+ paramObj
+}
+
+func (r AlphaAgentTurnResumeParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaAgentTurnResumeParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *AlphaAgentTurnResumeParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/agentturn_test.go b/alphaagentturn_test.go
similarity index 78%
rename from agentturn_test.go
rename to alphaagentturn_test.go
index 963e087..090b375 100644
--- a/agentturn_test.go
+++ b/alphaagentturn_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestAgentTurnNewWithOptionalParams(t *testing.T) {
+func TestAlphaAgentTurnNewWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,12 +24,12 @@ func TestAgentTurnNewWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Turn.New(
+ _, err := client.Alpha.Agents.Turn.New(
context.TODO(),
"session_id",
- llamastackclient.AgentTurnNewParams{
+ llamastackclient.AlphaAgentTurnNewParams{
AgentID: "agent_id",
- Messages: []llamastackclient.AgentTurnNewParamsMessageUnion{{
+ Messages: []llamastackclient.AlphaAgentTurnNewParamsMessageUnion{{
OfUserMessage: &llamastackclient.UserMessageParam{
Content: llamastackclient.InterleavedContentUnionParam{
OfString: llamastackclient.String("string"),
@@ -39,18 +39,18 @@ func TestAgentTurnNewWithOptionalParams(t *testing.T) {
},
},
}},
- Documents: []llamastackclient.AgentTurnNewParamsDocument{{
- Content: llamastackclient.AgentTurnNewParamsDocumentContentUnion{
+ Documents: []llamastackclient.AlphaAgentTurnNewParamsDocument{{
+ Content: llamastackclient.AlphaAgentTurnNewParamsDocumentContentUnion{
OfString: llamastackclient.String("string"),
},
MimeType: "mime_type",
}},
- ToolConfig: llamastackclient.AgentTurnNewParamsToolConfig{
+ ToolConfig: llamastackclient.AlphaAgentTurnNewParamsToolConfig{
SystemMessageBehavior: "append",
ToolChoice: "auto",
ToolPromptFormat: "json",
},
- Toolgroups: []llamastackclient.AgentTurnNewParamsToolgroupUnion{{
+ Toolgroups: []llamastackclient.AlphaAgentTurnNewParamsToolgroupUnion{{
OfString: llamastackclient.String("string"),
}},
},
@@ -64,7 +64,7 @@ func TestAgentTurnNewWithOptionalParams(t *testing.T) {
}
}
-func TestAgentTurnGet(t *testing.T) {
+func TestAlphaAgentTurnGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -75,10 +75,10 @@ func TestAgentTurnGet(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Turn.Get(
+ _, err := client.Alpha.Agents.Turn.Get(
context.TODO(),
"turn_id",
- llamastackclient.AgentTurnGetParams{
+ llamastackclient.AlphaAgentTurnGetParams{
AgentID: "agent_id",
SessionID: "session_id",
},
@@ -92,7 +92,7 @@ func TestAgentTurnGet(t *testing.T) {
}
}
-func TestAgentTurnResumeWithOptionalParams(t *testing.T) {
+func TestAlphaAgentTurnResumeWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -103,10 +103,10 @@ func TestAgentTurnResumeWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Agents.Turn.Resume(
+ _, err := client.Alpha.Agents.Turn.Resume(
context.TODO(),
"turn_id",
- llamastackclient.AgentTurnResumeParams{
+ llamastackclient.AlphaAgentTurnResumeParams{
AgentID: "agent_id",
SessionID: "session_id",
ToolResponses: []llamastackclient.ToolResponseParam{{
diff --git a/inference.go b/alphainference.go
similarity index 56%
rename from inference.go
rename to alphainference.go
index 6e93484..ec20df7 100644
--- a/inference.go
+++ b/alphainference.go
@@ -15,28 +15,28 @@ import (
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
-// InferenceService contains methods and other services that help with interacting
-// with the llama-stack-client API.
+// AlphaInferenceService contains methods and other services that help with
+// interacting with the llama-stack-client 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 [NewInferenceService] method instead.
-type InferenceService struct {
+// the [NewAlphaInferenceService] method instead.
+type AlphaInferenceService struct {
Options []option.RequestOption
}
-// NewInferenceService generates a new service that applies the given options to
-// each request. These options are applied after the parent client's options (if
+// NewAlphaInferenceService 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 NewInferenceService(opts ...option.RequestOption) (r InferenceService) {
- r = InferenceService{}
+func NewAlphaInferenceService(opts ...option.RequestOption) (r AlphaInferenceService) {
+ r = AlphaInferenceService{}
r.Options = opts
return
}
// Rerank a list of documents based on their relevance to a query.
-func (r *InferenceService) Rerank(ctx context.Context, body InferenceRerankParams, opts ...option.RequestOption) (res *[]InferenceRerankResponse, err error) {
- var env InferenceRerankResponseEnvelope
+func (r *AlphaInferenceService) Rerank(ctx context.Context, body AlphaInferenceRerankParams, opts ...option.RequestOption) (res *[]AlphaInferenceRerankResponse, err error) {
+ var env AlphaInferenceRerankResponseEnvelope
opts = slices.Concat(r.Options, opts)
path := "v1alpha/inference/rerank"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
@@ -48,7 +48,7 @@ func (r *InferenceService) Rerank(ctx context.Context, body InferenceRerankParam
}
// A single rerank result from a reranking response.
-type InferenceRerankResponse struct {
+type AlphaInferenceRerankResponse struct {
// The original index of the document in the input list
Index int64 `json:"index,required"`
// The relevance score from the model output. Values are inverted when applicable
@@ -64,52 +64,52 @@ type InferenceRerankResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r InferenceRerankResponse) RawJSON() string { return r.JSON.raw }
-func (r *InferenceRerankResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaInferenceRerankResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaInferenceRerankResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type InferenceRerankParams struct {
+type AlphaInferenceRerankParams struct {
// List of items to rerank. Each item can be a string, text content part, or image
// content part. Each input must not exceed the model's max input token length.
- Items []InferenceRerankParamsItemUnion `json:"items,omitzero,required"`
+ Items []AlphaInferenceRerankParamsItemUnion `json:"items,omitzero,required"`
// The identifier of the reranking model to use.
Model string `json:"model,required"`
// The search query to rank items against. Can be a string, text content part, or
// image content part. The input must not exceed the model's max input token
// length.
- Query InferenceRerankParamsQueryUnion `json:"query,omitzero,required"`
+ Query AlphaInferenceRerankParamsQueryUnion `json:"query,omitzero,required"`
// (Optional) Maximum number of results to return. Default: returns all.
MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
paramObj
}
-func (r InferenceRerankParams) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParams
+func (r AlphaInferenceRerankParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type InferenceRerankParamsItemUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartText *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
+type AlphaInferenceRerankParamsItemUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartText *AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartImage *AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
paramUnion
}
-func (u InferenceRerankParamsItemUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaInferenceRerankParamsItemUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
}
-func (u *InferenceRerankParamsItemUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaInferenceRerankParamsItemUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *InferenceRerankParamsItemUnion) asAny() any {
+func (u *AlphaInferenceRerankParamsItemUnion) asAny() any {
if !param.IsOmitted(u.OfString) {
return &u.OfString.Value
} else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
@@ -121,7 +121,7 @@ func (u *InferenceRerankParamsItemUnion) asAny() any {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsItemUnion) GetText() *string {
+func (u AlphaInferenceRerankParamsItemUnion) GetText() *string {
if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
return &vt.Text
}
@@ -129,7 +129,7 @@ func (u InferenceRerankParamsItemUnion) GetText() *string {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsItemUnion) GetImageURL() *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL {
+func (u AlphaInferenceRerankParamsItemUnion) GetImageURL() *AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL {
if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
return &vt.ImageURL
}
@@ -137,7 +137,7 @@ func (u InferenceRerankParamsItemUnion) GetImageURL() *InferenceRerankParamsItem
}
// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsItemUnion) GetType() *string {
+func (u AlphaInferenceRerankParamsItemUnion) GetType() *string {
if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
@@ -149,7 +149,7 @@ func (u InferenceRerankParamsItemUnion) GetType() *string {
// Text content part for OpenAI-compatible chat completion messages.
//
// The properties Text, Type are required.
-type InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam struct {
+type AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam struct {
// The text content of the message
Text string `json:"text,required"`
// Must be "text" to identify this as text content
@@ -159,20 +159,20 @@ type InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam struct {
paramObj
}
-func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam
+func (r AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content part for OpenAI-compatible chat completion messages.
//
// The properties ImageURL, Type are required.
-type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam struct {
+type AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam struct {
// Image URL specification and processing details
- ImageURL InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
+ ImageURL AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
// Must be "image_url" to identify this as image content
//
// This field can be elided, and will marshal its zero value as "image_url".
@@ -180,18 +180,18 @@ type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam struct {
paramObj
}
-func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam
+func (r AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image URL specification and processing details
//
// The property URL is required.
-type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL struct {
+type AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL struct {
// URL of the image to include in the message
URL string `json:"url,required"`
// (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
@@ -199,32 +199,32 @@ type InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL
paramObj
}
-func (r InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL
+func (r AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParamsItemOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type InferenceRerankParamsQueryUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartText *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
- OfOpenAIChatCompletionContentPartImage *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
+type AlphaInferenceRerankParamsQueryUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartText *AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam `json:",omitzero,inline"`
+ OfOpenAIChatCompletionContentPartImage *AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam `json:",omitzero,inline"`
paramUnion
}
-func (u InferenceRerankParamsQueryUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaInferenceRerankParamsQueryUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfString, u.OfOpenAIChatCompletionContentPartText, u.OfOpenAIChatCompletionContentPartImage)
}
-func (u *InferenceRerankParamsQueryUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaInferenceRerankParamsQueryUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *InferenceRerankParamsQueryUnion) asAny() any {
+func (u *AlphaInferenceRerankParamsQueryUnion) asAny() any {
if !param.IsOmitted(u.OfString) {
return &u.OfString.Value
} else if !param.IsOmitted(u.OfOpenAIChatCompletionContentPartText) {
@@ -236,7 +236,7 @@ func (u *InferenceRerankParamsQueryUnion) asAny() any {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsQueryUnion) GetText() *string {
+func (u AlphaInferenceRerankParamsQueryUnion) GetText() *string {
if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
return &vt.Text
}
@@ -244,7 +244,7 @@ func (u InferenceRerankParamsQueryUnion) GetText() *string {
}
// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsQueryUnion) GetImageURL() *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL {
+func (u AlphaInferenceRerankParamsQueryUnion) GetImageURL() *AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL {
if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
return &vt.ImageURL
}
@@ -252,7 +252,7 @@ func (u InferenceRerankParamsQueryUnion) GetImageURL() *InferenceRerankParamsQue
}
// Returns a pointer to the underlying variant's property, if present.
-func (u InferenceRerankParamsQueryUnion) GetType() *string {
+func (u AlphaInferenceRerankParamsQueryUnion) GetType() *string {
if vt := u.OfOpenAIChatCompletionContentPartText; vt != nil {
return (*string)(&vt.Type)
} else if vt := u.OfOpenAIChatCompletionContentPartImage; vt != nil {
@@ -264,7 +264,7 @@ func (u InferenceRerankParamsQueryUnion) GetType() *string {
// Text content part for OpenAI-compatible chat completion messages.
//
// The properties Text, Type are required.
-type InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam struct {
+type AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam struct {
// The text content of the message
Text string `json:"text,required"`
// Must be "text" to identify this as text content
@@ -274,20 +274,20 @@ type InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam struct {
paramObj
}
-func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam
+func (r AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartTextParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content part for OpenAI-compatible chat completion messages.
//
// The properties ImageURL, Type are required.
-type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam struct {
+type AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam struct {
// Image URL specification and processing details
- ImageURL InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
+ ImageURL AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL `json:"image_url,omitzero,required"`
// Must be "image_url" to identify this as image content
//
// This field can be elided, and will marshal its zero value as "image_url".
@@ -295,18 +295,18 @@ type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam struct
paramObj
}
-func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam
+func (r AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image URL specification and processing details
//
// The property URL is required.
-type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL struct {
+type AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL struct {
// URL of the image to include in the message
URL string `json:"url,required"`
// (Optional) Level of detail for image processing. Can be "low", "high", or "auto"
@@ -314,18 +314,18 @@ type InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL
paramObj
}
-func (r InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
- type shadow InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL
+func (r AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *InferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
+func (r *AlphaInferenceRerankParamsQueryOpenAIChatCompletionContentPartImageParamImageURL) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Response from a reranking request.
-type InferenceRerankResponseEnvelope struct {
+type AlphaInferenceRerankResponseEnvelope struct {
// List of rerank result objects, sorted by relevance score (descending)
- Data []InferenceRerankResponse `json:"data,required"`
+ Data []AlphaInferenceRerankResponse `json:"data,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
@@ -335,7 +335,7 @@ type InferenceRerankResponseEnvelope struct {
}
// Returns the unmodified JSON received from the API
-func (r InferenceRerankResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *InferenceRerankResponseEnvelope) UnmarshalJSON(data []byte) error {
+func (r AlphaInferenceRerankResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *AlphaInferenceRerankResponseEnvelope) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/inference_test.go b/alphainference_test.go
similarity index 76%
rename from inference_test.go
rename to alphainference_test.go
index e8cd44a..fa57fab 100644
--- a/inference_test.go
+++ b/alphainference_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestInferenceRerankWithOptionalParams(t *testing.T) {
+func TestAlphaInferenceRerankWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,12 +24,12 @@ func TestInferenceRerankWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Inference.Rerank(context.TODO(), llamastackclient.InferenceRerankParams{
- Items: []llamastackclient.InferenceRerankParamsItemUnion{{
+ _, err := client.Alpha.Inference.Rerank(context.TODO(), llamastackclient.AlphaInferenceRerankParams{
+ Items: []llamastackclient.AlphaInferenceRerankParamsItemUnion{{
OfString: llamastackclient.String("string"),
}},
Model: "model",
- Query: llamastackclient.InferenceRerankParamsQueryUnion{
+ Query: llamastackclient.AlphaInferenceRerankParamsQueryUnion{
OfString: llamastackclient.String("string"),
},
MaxNumResults: llamastackclient.Int(0),
diff --git a/api.md b/api.md
index 5d0b18d..ec182fa 100644
--- a/api.md
+++ b/api.md
@@ -104,69 +104,6 @@ Methods:
- client.Responses.InputItems.List(ctx context.Context, responseID string, query llamastackclient.ResponseInputItemListParams) (llamastackclient.ResponseInputItemListResponse, error)
-# Agents
-
-Params Types:
-
-- llamastackclient.ToolResponseParam
-
-Response Types:
-
-- llamastackclient.InferenceStep
-- llamastackclient.MemoryRetrievalStep
-- llamastackclient.ShieldCallStep
-- llamastackclient.ToolExecutionStep
-- llamastackclient.ToolResponse
-- llamastackclient.AgentNewResponse
-- llamastackclient.AgentGetResponse
-- llamastackclient.AgentListResponse
-
-Methods:
-
-- client.Agents.New(ctx context.Context, body llamastackclient.AgentNewParams) (llamastackclient.AgentNewResponse, error)
-- client.Agents.Get(ctx context.Context, agentID string) (llamastackclient.AgentGetResponse, error)
-- client.Agents.List(ctx context.Context, query llamastackclient.AgentListParams) (llamastackclient.AgentListResponse, error)
-- client.Agents.Delete(ctx context.Context, agentID string) error
-
-## Session
-
-Response Types:
-
-- llamastackclient.Session
-- llamastackclient.AgentSessionNewResponse
-- llamastackclient.AgentSessionListResponse
-
-Methods:
-
-- client.Agents.Session.New(ctx context.Context, agentID string, body llamastackclient.AgentSessionNewParams) (llamastackclient.AgentSessionNewResponse, error)
-- client.Agents.Session.Get(ctx context.Context, sessionID string, params llamastackclient.AgentSessionGetParams) (llamastackclient.Session, error)
-- client.Agents.Session.List(ctx context.Context, agentID string, query llamastackclient.AgentSessionListParams) (llamastackclient.AgentSessionListResponse, error)
-- client.Agents.Session.Delete(ctx context.Context, sessionID string, body llamastackclient.AgentSessionDeleteParams) error
-
-## Steps
-
-Response Types:
-
-- llamastackclient.AgentStepGetResponse
-
-Methods:
-
-- client.Agents.Steps.Get(ctx context.Context, stepID string, query llamastackclient.AgentStepGetParams) (llamastackclient.AgentStepGetResponse, error)
-
-## Turn
-
-Response Types:
-
-- llamastackclient.AgentTurnResponseStreamChunk
-- llamastackclient.Turn
-- llamastackclient.TurnResponseEvent
-
-Methods:
-
-- client.Agents.Turn.New(ctx context.Context, sessionID string, params llamastackclient.AgentTurnNewParams) (llamastackclient.Turn, error)
-- client.Agents.Turn.Get(ctx context.Context, turnID string, query llamastackclient.AgentTurnGetParams) (llamastackclient.Turn, error)
-- client.Agents.Turn.Resume(ctx context.Context, turnID string, params llamastackclient.AgentTurnResumeParams) (llamastackclient.Turn, error)
-
# Datasets
Response Types:
@@ -225,16 +162,6 @@ Methods:
- client.Inspect.Health(ctx context.Context) (llamastackclient.HealthInfo, error)
- client.Inspect.Version(ctx context.Context) (llamastackclient.VersionInfo, error)
-# Inference
-
-Response Types:
-
-- llamastackclient.InferenceRerankResponse
-
-Methods:
-
-- client.Inference.Rerank(ctx context.Context, body llamastackclient.InferenceRerankParams) ([]llamastackclient.InferenceRerankResponse, error)
-
# Embeddings
Response Types:
@@ -551,3 +478,76 @@ Methods:
- client.Files.List(ctx context.Context, query llamastackclient.FileListParams) (pagination.OpenAICursorPage[llamastackclient.File], error)
- client.Files.Delete(ctx context.Context, fileID string) (llamastackclient.DeleteFileResponse, error)
- client.Files.Content(ctx context.Context, fileID string) (llamastackclient.FileContentResponse, error)
+
+# Alpha
+
+## Inference
+
+Response Types:
+
+- llamastackclient.AlphaInferenceRerankResponse
+
+Methods:
+
+- client.Alpha.Inference.Rerank(ctx context.Context, body llamastackclient.AlphaInferenceRerankParams) ([]llamastackclient.AlphaInferenceRerankResponse, error)
+
+## Agents
+
+Params Types:
+
+- llamastackclient.ToolResponseParam
+
+Response Types:
+
+- llamastackclient.InferenceStep
+- llamastackclient.MemoryRetrievalStep
+- llamastackclient.ShieldCallStep
+- llamastackclient.ToolExecutionStep
+- llamastackclient.ToolResponse
+- llamastackclient.AlphaAgentNewResponse
+- llamastackclient.AlphaAgentGetResponse
+- llamastackclient.AlphaAgentListResponse
+
+Methods:
+
+- client.Alpha.Agents.New(ctx context.Context, body llamastackclient.AlphaAgentNewParams) (llamastackclient.AlphaAgentNewResponse, error)
+- client.Alpha.Agents.Get(ctx context.Context, agentID string) (llamastackclient.AlphaAgentGetResponse, error)
+- client.Alpha.Agents.List(ctx context.Context, query llamastackclient.AlphaAgentListParams) (llamastackclient.AlphaAgentListResponse, error)
+- client.Alpha.Agents.Delete(ctx context.Context, agentID string) error
+
+### Session
+
+Response Types:
+
+- llamastackclient.Session
+- llamastackclient.AlphaAgentSessionNewResponse
+- llamastackclient.AlphaAgentSessionListResponse
+
+Methods:
+
+- client.Alpha.Agents.Session.New(ctx context.Context, agentID string, body llamastackclient.AlphaAgentSessionNewParams) (llamastackclient.AlphaAgentSessionNewResponse, error)
+- client.Alpha.Agents.Session.Get(ctx context.Context, sessionID string, params llamastackclient.AlphaAgentSessionGetParams) (llamastackclient.Session, error)
+- client.Alpha.Agents.Session.List(ctx context.Context, agentID string, query llamastackclient.AlphaAgentSessionListParams) (llamastackclient.AlphaAgentSessionListResponse, error)
+- client.Alpha.Agents.Session.Delete(ctx context.Context, sessionID string, body llamastackclient.AlphaAgentSessionDeleteParams) error
+
+### Steps
+
+Response Types:
+
+- llamastackclient.AlphaAgentStepGetResponse
+
+Methods:
+
+- client.Alpha.Agents.Steps.Get(ctx context.Context, stepID string, query llamastackclient.AlphaAgentStepGetParams) (llamastackclient.AlphaAgentStepGetResponse, error)
+
+### Turn
+
+Response Types:
+
+- llamastackclient.Turn
+
+Methods:
+
+- client.Alpha.Agents.Turn.New(ctx context.Context, sessionID string, params llamastackclient.AlphaAgentTurnNewParams) (llamastackclient.Turn, error)
+- client.Alpha.Agents.Turn.Get(ctx context.Context, turnID string, query llamastackclient.AlphaAgentTurnGetParams) (llamastackclient.Turn, error)
+- client.Alpha.Agents.Turn.Resume(ctx context.Context, turnID string, params llamastackclient.AlphaAgentTurnResumeParams) (llamastackclient.Turn, error)
diff --git a/client.go b/client.go
index ed10d4c..e9b99de 100644
--- a/client.go
+++ b/client.go
@@ -21,11 +21,9 @@ type Client struct {
Tools ToolService
ToolRuntime ToolRuntimeService
Responses ResponseService
- Agents AgentService
Datasets DatasetService
Eval EvalService
Inspect InspectService
- Inference InferenceService
Embeddings EmbeddingService
Chat ChatService
Completions CompletionService
@@ -45,6 +43,7 @@ type Client struct {
ScoringFunctions ScoringFunctionService
Benchmarks BenchmarkService
Files FileService
+ Alpha AlphaService
}
// DefaultClientOptions read from the environment (LLAMA_STACK_CLIENT_API_KEY,
@@ -73,11 +72,9 @@ func NewClient(opts ...option.RequestOption) (r Client) {
r.Tools = NewToolService(opts...)
r.ToolRuntime = NewToolRuntimeService(opts...)
r.Responses = NewResponseService(opts...)
- r.Agents = NewAgentService(opts...)
r.Datasets = NewDatasetService(opts...)
r.Eval = NewEvalService(opts...)
r.Inspect = NewInspectService(opts...)
- r.Inference = NewInferenceService(opts...)
r.Embeddings = NewEmbeddingService(opts...)
r.Chat = NewChatService(opts...)
r.Completions = NewCompletionService(opts...)
@@ -97,6 +94,7 @@ func NewClient(opts ...option.RequestOption) (r Client) {
r.ScoringFunctions = NewScoringFunctionService(opts...)
r.Benchmarks = NewBenchmarkService(opts...)
r.Files = NewFileService(opts...)
+ r.Alpha = NewAlphaService(opts...)
return
}
From d8b42f67eefb216968989a10d68b2ff0e3e65a62 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 19:37:20 +0000
Subject: [PATCH 25/33] fix: fix stream event model reference
---
.stats.yml | 2 +-
alphaagentturn.go | 674 +++++++++++++++++++++++++++++++++++++++++++++-
api.md | 2 +
3 files changed, 673 insertions(+), 5 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 35d7077..f7df1a9 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 109
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
-config_hash: 03aab396899c7d9aa3fba867ce54824b
+config_hash: 47ef2eb62d188340f22eb6dea3693f15
diff --git a/alphaagentturn.go b/alphaagentturn.go
index 8aab34d..af78d97 100644
--- a/alphaagentturn.go
+++ b/alphaagentturn.go
@@ -56,7 +56,7 @@ func (r *AlphaAgentTurnService) New(ctx context.Context, sessionID string, param
}
// Create a new turn for an agent.
-func (r *AlphaAgentTurnService) NewStreaming(ctx context.Context, sessionID string, params AlphaAgentTurnNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[any]) {
+func (r *AlphaAgentTurnService) NewStreaming(ctx context.Context, sessionID string, params AlphaAgentTurnNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[AgentTurnResponseStreamChunk]) {
var (
raw *http.Response
err error
@@ -73,7 +73,7 @@ func (r *AlphaAgentTurnService) NewStreaming(ctx context.Context, sessionID stri
}
path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
- return ssestream.NewStream[any](ssestream.NewDecoder(raw), err)
+ return ssestream.NewStream[AgentTurnResponseStreamChunk](ssestream.NewDecoder(raw), err)
}
// Retrieve an agent turn by its ID.
@@ -123,7 +123,7 @@ func (r *AlphaAgentTurnService) Resume(ctx context.Context, turnID string, param
// status `awaiting_input` due to pending input from client side tool calls, this
// endpoint can be used to submit the outputs from the tool calls once they are
// ready.
-func (r *AlphaAgentTurnService) ResumeStreaming(ctx context.Context, turnID string, params AlphaAgentTurnResumeParams, opts ...option.RequestOption) (stream *ssestream.Stream[any]) {
+func (r *AlphaAgentTurnService) ResumeStreaming(ctx context.Context, turnID string, params AlphaAgentTurnResumeParams, opts ...option.RequestOption) (stream *ssestream.Stream[AgentTurnResponseStreamChunk]) {
var (
raw *http.Response
err error
@@ -144,7 +144,25 @@ func (r *AlphaAgentTurnService) ResumeStreaming(ctx context.Context, turnID stri
}
path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
- return ssestream.NewStream[any](ssestream.NewDecoder(raw), err)
+ return ssestream.NewStream[AgentTurnResponseStreamChunk](ssestream.NewDecoder(raw), err)
+}
+
+// Streamed agent turn completion response.
+type AgentTurnResponseStreamChunk struct {
+ // Individual event in the agent turn response stream
+ Event TurnResponseEvent `json:"event,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Event respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r AgentTurnResponseStreamChunk) RawJSON() string { return r.JSON.raw }
+func (r *AgentTurnResponseStreamChunk) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
// A single turn in an interaction with an Agentic System.
@@ -514,6 +532,654 @@ func (r *TurnOutputAttachmentContentURL) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// An event in an agent turn response stream.
+type TurnResponseEvent struct {
+ // Event-specific payload containing event data
+ Payload TurnResponseEventPayloadUnion `json:"payload,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Payload respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEvent) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEvent) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnResponseEventPayloadUnion contains all possible properties and values from
+// [TurnResponseEventPayloadStepStart], [TurnResponseEventPayloadStepProgress],
+// [TurnResponseEventPayloadStepComplete], [TurnResponseEventPayloadTurnStart],
+// [TurnResponseEventPayloadTurnComplete],
+// [TurnResponseEventPayloadTurnAwaitingInput].
+//
+// Use the [TurnResponseEventPayloadUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type TurnResponseEventPayloadUnion struct {
+ // Any of "step_start", "step_progress", "step_complete", "turn_start",
+ // "turn_complete", "turn_awaiting_input".
+ EventType string `json:"event_type"`
+ StepID string `json:"step_id"`
+ StepType string `json:"step_type"`
+ // This field is from variant [TurnResponseEventPayloadStepStart].
+ Metadata map[string]TurnResponseEventPayloadStepStartMetadataUnion `json:"metadata"`
+ // This field is from variant [TurnResponseEventPayloadStepProgress].
+ Delta TurnResponseEventPayloadStepProgressDeltaUnion `json:"delta"`
+ // This field is from variant [TurnResponseEventPayloadStepComplete].
+ StepDetails TurnResponseEventPayloadStepCompleteStepDetailsUnion `json:"step_details"`
+ // This field is from variant [TurnResponseEventPayloadTurnStart].
+ TurnID string `json:"turn_id"`
+ // This field is from variant [TurnResponseEventPayloadTurnComplete].
+ Turn Turn `json:"turn"`
+ JSON struct {
+ EventType respjson.Field
+ StepID respjson.Field
+ StepType respjson.Field
+ Metadata respjson.Field
+ Delta respjson.Field
+ StepDetails respjson.Field
+ TurnID respjson.Field
+ Turn respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyTurnResponseEventPayload is implemented by each variant of
+// [TurnResponseEventPayloadUnion] to add type safety for the return type of
+// [TurnResponseEventPayloadUnion.AsAny]
+type anyTurnResponseEventPayload interface {
+ implTurnResponseEventPayloadUnion()
+}
+
+func (TurnResponseEventPayloadStepStart) implTurnResponseEventPayloadUnion() {}
+func (TurnResponseEventPayloadStepProgress) implTurnResponseEventPayloadUnion() {}
+func (TurnResponseEventPayloadStepComplete) implTurnResponseEventPayloadUnion() {}
+func (TurnResponseEventPayloadTurnStart) implTurnResponseEventPayloadUnion() {}
+func (TurnResponseEventPayloadTurnComplete) implTurnResponseEventPayloadUnion() {}
+func (TurnResponseEventPayloadTurnAwaitingInput) implTurnResponseEventPayloadUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := TurnResponseEventPayloadUnion.AsAny().(type) {
+// case llamastackclient.TurnResponseEventPayloadStepStart:
+// case llamastackclient.TurnResponseEventPayloadStepProgress:
+// case llamastackclient.TurnResponseEventPayloadStepComplete:
+// case llamastackclient.TurnResponseEventPayloadTurnStart:
+// case llamastackclient.TurnResponseEventPayloadTurnComplete:
+// case llamastackclient.TurnResponseEventPayloadTurnAwaitingInput:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u TurnResponseEventPayloadUnion) AsAny() anyTurnResponseEventPayload {
+ switch u.EventType {
+ case "step_start":
+ return u.AsStepStart()
+ case "step_progress":
+ return u.AsStepProgress()
+ case "step_complete":
+ return u.AsStepComplete()
+ case "turn_start":
+ return u.AsTurnStart()
+ case "turn_complete":
+ return u.AsTurnComplete()
+ case "turn_awaiting_input":
+ return u.AsTurnAwaitingInput()
+ }
+ return nil
+}
+
+func (u TurnResponseEventPayloadUnion) AsStepStart() (v TurnResponseEventPayloadStepStart) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadUnion) AsStepProgress() (v TurnResponseEventPayloadStepProgress) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadUnion) AsStepComplete() (v TurnResponseEventPayloadStepComplete) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadUnion) AsTurnStart() (v TurnResponseEventPayloadTurnStart) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadUnion) AsTurnComplete() (v TurnResponseEventPayloadTurnComplete) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadUnion) AsTurnAwaitingInput() (v TurnResponseEventPayloadTurnAwaitingInput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnResponseEventPayloadUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Payload for step start events in agent turn responses.
+type TurnResponseEventPayloadStepStart struct {
+ // Type of event being reported
+ EventType constant.StepStart `json:"event_type,required"`
+ // Unique identifier for the step within a turn
+ StepID string `json:"step_id,required"`
+ // Type of step being executed
+ //
+ // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
+ StepType string `json:"step_type,required"`
+ // (Optional) Additional metadata for the step
+ Metadata map[string]TurnResponseEventPayloadStepStartMetadataUnion `json:"metadata"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EventType respjson.Field
+ StepID respjson.Field
+ StepType respjson.Field
+ Metadata respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepStart) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepStart) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnResponseEventPayloadStepStartMetadataUnion contains all possible properties
+// and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type TurnResponseEventPayloadStepStartMetadataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u TurnResponseEventPayloadStepStartMetadataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepStartMetadataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepStartMetadataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepStartMetadataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadStepStartMetadataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnResponseEventPayloadStepStartMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Payload for step progress events in agent turn responses.
+type TurnResponseEventPayloadStepProgress struct {
+ // Incremental content changes during step execution
+ Delta TurnResponseEventPayloadStepProgressDeltaUnion `json:"delta,required"`
+ // Type of event being reported
+ EventType constant.StepProgress `json:"event_type,required"`
+ // Unique identifier for the step within a turn
+ StepID string `json:"step_id,required"`
+ // Type of step being executed
+ //
+ // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
+ StepType string `json:"step_type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Delta respjson.Field
+ EventType respjson.Field
+ StepID respjson.Field
+ StepType respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgress) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgress) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnResponseEventPayloadStepProgressDeltaUnion contains all possible properties
+// and values from [TurnResponseEventPayloadStepProgressDeltaText],
+// [TurnResponseEventPayloadStepProgressDeltaImage],
+// [TurnResponseEventPayloadStepProgressDeltaToolCall].
+//
+// Use the [TurnResponseEventPayloadStepProgressDeltaUnion.AsAny] method to switch
+// on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type TurnResponseEventPayloadStepProgressDeltaUnion struct {
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaText].
+ Text string `json:"text"`
+ // Any of "text", "image", "tool_call".
+ Type string `json:"type"`
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaImage].
+ Image string `json:"image"`
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaToolCall].
+ ParseStatus string `json:"parse_status"`
+ // This field is from variant [TurnResponseEventPayloadStepProgressDeltaToolCall].
+ ToolCall TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion `json:"tool_call"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ Image respjson.Field
+ ParseStatus respjson.Field
+ ToolCall respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyTurnResponseEventPayloadStepProgressDelta is implemented by each variant of
+// [TurnResponseEventPayloadStepProgressDeltaUnion] to add type safety for the
+// return type of [TurnResponseEventPayloadStepProgressDeltaUnion.AsAny]
+type anyTurnResponseEventPayloadStepProgressDelta interface {
+ implTurnResponseEventPayloadStepProgressDeltaUnion()
+}
+
+func (TurnResponseEventPayloadStepProgressDeltaText) implTurnResponseEventPayloadStepProgressDeltaUnion() {
+}
+func (TurnResponseEventPayloadStepProgressDeltaImage) implTurnResponseEventPayloadStepProgressDeltaUnion() {
+}
+func (TurnResponseEventPayloadStepProgressDeltaToolCall) implTurnResponseEventPayloadStepProgressDeltaUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := TurnResponseEventPayloadStepProgressDeltaUnion.AsAny().(type) {
+// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaText:
+// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaImage:
+// case llamastackclient.TurnResponseEventPayloadStepProgressDeltaToolCall:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsAny() anyTurnResponseEventPayloadStepProgressDelta {
+ switch u.Type {
+ case "text":
+ return u.AsText()
+ case "image":
+ return u.AsImage()
+ case "tool_call":
+ return u.AsToolCall()
+ }
+ return nil
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsText() (v TurnResponseEventPayloadStepProgressDeltaText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsImage() (v TurnResponseEventPayloadStepProgressDeltaImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) AsToolCall() (v TurnResponseEventPayloadStepProgressDeltaToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadStepProgressDeltaUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnResponseEventPayloadStepProgressDeltaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A text content delta for streaming responses.
+type TurnResponseEventPayloadStepProgressDeltaText struct {
+ // The incremental text content
+ Text string `json:"text,required"`
+ // Discriminator type of the delta. Always "text"
+ Type constant.Text `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgressDeltaText) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgressDeltaText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// An image content delta for streaming responses.
+type TurnResponseEventPayloadStepProgressDeltaImage struct {
+ // The incremental image data as bytes
+ Image string `json:"image,required"`
+ // Discriminator type of the delta. Always "image"
+ Type constant.Image `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Image respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgressDeltaImage) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgressDeltaImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A tool call content delta for streaming responses.
+type TurnResponseEventPayloadStepProgressDeltaToolCall struct {
+ // Current parsing status of the tool call
+ //
+ // Any of "started", "in_progress", "failed", "succeeded".
+ ParseStatus string `json:"parse_status,required"`
+ // Either an in-progress tool call string or the final parsed tool call
+ ToolCall TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion `json:"tool_call,required"`
+ // Discriminator type of the delta. Always "tool_call"
+ Type constant.ToolCall `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ParseStatus respjson.Field
+ ToolCall respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepProgressDeltaToolCall) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepProgressDeltaToolCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion contains all
+// possible properties and values from [string], [ToolCall].
+//
+// 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: OfString]
+type TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field is from variant [ToolCall].
+ Arguments ToolCallArgumentsUnion `json:"arguments"`
+ // This field is from variant [ToolCall].
+ CallID string `json:"call_id"`
+ // This field is from variant [ToolCall].
+ ToolName ToolCallToolName `json:"tool_name"`
+ // This field is from variant [ToolCall].
+ ArgumentsJson string `json:"arguments_json"`
+ JSON struct {
+ OfString respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ ToolName respjson.Field
+ ArgumentsJson respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) AsToolCall() (v ToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Payload for step completion events in agent turn responses.
+type TurnResponseEventPayloadStepComplete struct {
+ // Type of event being reported
+ EventType constant.StepComplete `json:"event_type,required"`
+ // Complete details of the executed step
+ StepDetails TurnResponseEventPayloadStepCompleteStepDetailsUnion `json:"step_details,required"`
+ // Unique identifier for the step within a turn
+ StepID string `json:"step_id,required"`
+ // Type of step being executed
+ //
+ // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
+ StepType string `json:"step_type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EventType respjson.Field
+ StepDetails respjson.Field
+ StepID respjson.Field
+ StepType respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadStepComplete) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadStepComplete) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TurnResponseEventPayloadStepCompleteStepDetailsUnion contains all possible
+// properties and values from [InferenceStep], [ToolExecutionStep],
+// [ShieldCallStep], [MemoryRetrievalStep].
+//
+// Use the [TurnResponseEventPayloadStepCompleteStepDetailsUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type TurnResponseEventPayloadStepCompleteStepDetailsUnion struct {
+ // This field is from variant [InferenceStep].
+ ModelResponse CompletionMessage `json:"model_response"`
+ StepID string `json:"step_id"`
+ // Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
+ StepType string `json:"step_type"`
+ TurnID string `json:"turn_id"`
+ CompletedAt time.Time `json:"completed_at"`
+ StartedAt time.Time `json:"started_at"`
+ // This field is from variant [ToolExecutionStep].
+ ToolCalls []ToolCall `json:"tool_calls"`
+ // This field is from variant [ToolExecutionStep].
+ ToolResponses []ToolResponse `json:"tool_responses"`
+ // This field is from variant [ShieldCallStep].
+ Violation SafetyViolation `json:"violation"`
+ // This field is from variant [MemoryRetrievalStep].
+ InsertedContext InterleavedContentUnion `json:"inserted_context"`
+ // This field is from variant [MemoryRetrievalStep].
+ VectorDBIDs string `json:"vector_db_ids"`
+ JSON struct {
+ ModelResponse respjson.Field
+ StepID respjson.Field
+ StepType respjson.Field
+ TurnID respjson.Field
+ CompletedAt respjson.Field
+ StartedAt respjson.Field
+ ToolCalls respjson.Field
+ ToolResponses respjson.Field
+ Violation respjson.Field
+ InsertedContext respjson.Field
+ VectorDBIDs respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyTurnResponseEventPayloadStepCompleteStepDetails is implemented by each
+// variant of [TurnResponseEventPayloadStepCompleteStepDetailsUnion] to add type
+// safety for the return type of
+// [TurnResponseEventPayloadStepCompleteStepDetailsUnion.AsAny]
+type anyTurnResponseEventPayloadStepCompleteStepDetails interface {
+ implTurnResponseEventPayloadStepCompleteStepDetailsUnion()
+}
+
+func (InferenceStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
+func (ToolExecutionStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
+func (ShieldCallStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
+func (MemoryRetrievalStep) implTurnResponseEventPayloadStepCompleteStepDetailsUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := TurnResponseEventPayloadStepCompleteStepDetailsUnion.AsAny().(type) {
+// case llamastackclient.InferenceStep:
+// case llamastackclient.ToolExecutionStep:
+// case llamastackclient.ShieldCallStep:
+// case llamastackclient.MemoryRetrievalStep:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsAny() anyTurnResponseEventPayloadStepCompleteStepDetails {
+ switch u.StepType {
+ case "inference":
+ return u.AsInference()
+ case "tool_execution":
+ return u.AsToolExecution()
+ case "shield_call":
+ return u.AsShieldCall()
+ case "memory_retrieval":
+ return u.AsMemoryRetrieval()
+ }
+ return nil
+}
+
+func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsInference() (v InferenceStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsToolExecution() (v ToolExecutionStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsShieldCall() (v ShieldCallStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) AsMemoryRetrieval() (v MemoryRetrievalStep) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u TurnResponseEventPayloadStepCompleteStepDetailsUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TurnResponseEventPayloadStepCompleteStepDetailsUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Payload for turn start events in agent turn responses.
+type TurnResponseEventPayloadTurnStart struct {
+ // Type of event being reported
+ EventType constant.TurnStart `json:"event_type,required"`
+ // Unique identifier for the turn within a session
+ TurnID string `json:"turn_id,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EventType respjson.Field
+ TurnID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadTurnStart) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadTurnStart) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Payload for turn completion events in agent turn responses.
+type TurnResponseEventPayloadTurnComplete struct {
+ // Type of event being reported
+ EventType constant.TurnComplete `json:"event_type,required"`
+ // Complete turn data including all steps and results
+ Turn Turn `json:"turn,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EventType respjson.Field
+ Turn respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadTurnComplete) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadTurnComplete) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Payload for turn awaiting input events in agent turn responses.
+type TurnResponseEventPayloadTurnAwaitingInput struct {
+ // Type of event being reported
+ EventType constant.TurnAwaitingInput `json:"event_type,required"`
+ // Turn data when waiting for external tool responses
+ Turn Turn `json:"turn,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EventType respjson.Field
+ Turn respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TurnResponseEventPayloadTurnAwaitingInput) RawJSON() string { return r.JSON.raw }
+func (r *TurnResponseEventPayloadTurnAwaitingInput) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type AlphaAgentTurnNewParams struct {
AgentID string `path:"agent_id,required" json:"-"`
// List of messages to start the turn with.
diff --git a/api.md b/api.md
index ec182fa..82d0472 100644
--- a/api.md
+++ b/api.md
@@ -544,7 +544,9 @@ Methods:
Response Types:
+- llamastackclient.AgentTurnResponseStreamChunk
- llamastackclient.Turn
+- llamastackclient.TurnResponseEvent
Methods:
From 42bdca705b93c1c8c3330a4075bd8f5bde977f65 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 19:56:42 +0000
Subject: [PATCH 26/33] feat(api): move post_training and eval under alpha
namespace
---
.stats.yml | 2 +-
alpha.go | 10 +-
alphaagent.go | 8 +-
alphaagentsession.go | 8 +-
alphaagentstep.go | 2 +-
alphaagentturn.go | 10 +-
eval.go => alphaeval.go | 90 ++++-----
eval_test.go => alphaeval_test.go | 28 +--
evaljob.go => alphaevaljob.go | 36 ++--
evaljob_test.go => alphaevaljob_test.go | 18 +-
posttraining.go => alphaposttraining.go | 184 +++++++++---------
...ining_test.go => alphaposttraining_test.go | 34 ++--
posttrainingjob.go => alphaposttrainingjob.go | 132 +++++++------
...ob_test.go => alphaposttrainingjob_test.go | 16 +-
api.md | 136 ++++++-------
client.go | 4 -
16 files changed, 361 insertions(+), 357 deletions(-)
rename eval.go => alphaeval.go (80%)
rename eval_test.go => alphaeval_test.go (90%)
rename evaljob.go => alphaevaljob.go (57%)
rename evaljob_test.go => alphaevaljob_test.go (82%)
rename posttraining.go => alphaposttraining.go (68%)
rename posttraining_test.go => alphaposttraining_test.go (68%)
rename posttrainingjob.go => alphaposttrainingjob.go (65%)
rename posttrainingjob_test.go => alphaposttrainingjob_test.go (77%)
diff --git a/.stats.yml b/.stats.yml
index f7df1a9..448f905 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 109
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
-config_hash: 47ef2eb62d188340f22eb6dea3693f15
+config_hash: d8706905bf16d9e4141e88d5a778263b
diff --git a/alpha.go b/alpha.go
index 9e618d9..c7791d6 100644
--- a/alpha.go
+++ b/alpha.go
@@ -13,9 +13,11 @@ import (
// automatically. You should not instantiate this service directly, and instead use
// the [NewAlphaService] method instead.
type AlphaService struct {
- Options []option.RequestOption
- Inference AlphaInferenceService
- Agents AlphaAgentService
+ Options []option.RequestOption
+ Inference AlphaInferenceService
+ PostTraining AlphaPostTrainingService
+ Eval AlphaEvalService
+ Agents AlphaAgentService
}
// NewAlphaService generates a new service that applies the given options to each
@@ -25,6 +27,8 @@ func NewAlphaService(opts ...option.RequestOption) (r AlphaService) {
r = AlphaService{}
r.Options = opts
r.Inference = NewAlphaInferenceService(opts...)
+ r.PostTraining = NewAlphaPostTrainingService(opts...)
+ r.Eval = NewAlphaEvalService(opts...)
r.Agents = NewAlphaAgentService(opts...)
return
}
diff --git a/alphaagent.go b/alphaagent.go
index bbbdf6b..7a75440 100644
--- a/alphaagent.go
+++ b/alphaagent.go
@@ -49,7 +49,7 @@ func NewAlphaAgentService(opts ...option.RequestOption) (r AlphaAgentService) {
// Create an agent with the given configuration.
func (r *AlphaAgentService) New(ctx context.Context, body AlphaAgentNewParams, opts ...option.RequestOption) (res *AlphaAgentNewResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/agents"
+ path := "v1alpha/agents"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -61,7 +61,7 @@ func (r *AlphaAgentService) Get(ctx context.Context, agentID string, opts ...opt
err = errors.New("missing required agent_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s", agentID)
+ path := fmt.Sprintf("v1alpha/agents/%s", agentID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -69,7 +69,7 @@ func (r *AlphaAgentService) Get(ctx context.Context, agentID string, opts ...opt
// List all agents.
func (r *AlphaAgentService) List(ctx context.Context, query AlphaAgentListParams, opts ...option.RequestOption) (res *AlphaAgentListResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/agents"
+ path := "v1alpha/agents"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
@@ -82,7 +82,7 @@ func (r *AlphaAgentService) Delete(ctx context.Context, agentID string, opts ...
err = errors.New("missing required agent_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s", agentID)
+ path := fmt.Sprintf("v1alpha/agents/%s", agentID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
diff --git a/alphaagentsession.go b/alphaagentsession.go
index 990b19c..a928f51 100644
--- a/alphaagentsession.go
+++ b/alphaagentsession.go
@@ -46,7 +46,7 @@ func (r *AlphaAgentSessionService) New(ctx context.Context, agentID string, body
err = errors.New("missing required agent_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session", agentID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session", agentID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -62,7 +62,7 @@ func (r *AlphaAgentSessionService) Get(ctx context.Context, sessionID string, pa
err = errors.New("missing required session_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s", params.AgentID, sessionID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s", params.AgentID, sessionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, params, &res, opts...)
return
}
@@ -74,7 +74,7 @@ func (r *AlphaAgentSessionService) List(ctx context.Context, agentID string, que
err = errors.New("missing required agent_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/sessions", agentID)
+ path := fmt.Sprintf("v1alpha/agents/%s/sessions", agentID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
@@ -91,7 +91,7 @@ func (r *AlphaAgentSessionService) Delete(ctx context.Context, sessionID string,
err = errors.New("missing required session_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s", body.AgentID, sessionID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s", body.AgentID, sessionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
diff --git a/alphaagentstep.go b/alphaagentstep.go
index 00aac7c..6d6f428 100644
--- a/alphaagentstep.go
+++ b/alphaagentstep.go
@@ -55,7 +55,7 @@ func (r *AlphaAgentStepService) Get(ctx context.Context, stepID string, query Al
err = errors.New("missing required step_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/step/%s", query.AgentID, query.SessionID, query.TurnID, stepID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s/turn/%s/step/%s", query.AgentID, query.SessionID, query.TurnID, stepID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
diff --git a/alphaagentturn.go b/alphaagentturn.go
index af78d97..8293df4 100644
--- a/alphaagentturn.go
+++ b/alphaagentturn.go
@@ -50,7 +50,7 @@ func (r *AlphaAgentTurnService) New(ctx context.Context, sessionID string, param
err = errors.New("missing required session_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s/turn", params.AgentID, sessionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return
}
@@ -71,7 +71,7 @@ func (r *AlphaAgentTurnService) NewStreaming(ctx context.Context, sessionID stri
err = errors.New("missing required session_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn", params.AgentID, sessionID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s/turn", params.AgentID, sessionID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
return ssestream.NewStream[AgentTurnResponseStreamChunk](ssestream.NewDecoder(raw), err)
}
@@ -91,7 +91,7 @@ func (r *AlphaAgentTurnService) Get(ctx context.Context, turnID string, query Al
err = errors.New("missing required turn_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s", query.AgentID, query.SessionID, turnID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s/turn/%s", query.AgentID, query.SessionID, turnID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
@@ -114,7 +114,7 @@ func (r *AlphaAgentTurnService) Resume(ctx context.Context, turnID string, param
err = errors.New("missing required turn_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &res, opts...)
return
}
@@ -142,7 +142,7 @@ func (r *AlphaAgentTurnService) ResumeStreaming(ctx context.Context, turnID stri
err = errors.New("missing required turn_id parameter")
return
}
- path := fmt.Sprintf("v1/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
+ path := fmt.Sprintf("v1alpha/agents/%s/session/%s/turn/%s/resume", params.AgentID, params.SessionID, turnID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, params, &raw, opts...)
return ssestream.NewStream[AgentTurnResponseStreamChunk](ssestream.NewDecoder(raw), err)
}
diff --git a/eval.go b/alphaeval.go
similarity index 80%
rename from eval.go
rename to alphaeval.go
index e9208b3..25fdf6f 100644
--- a/eval.go
+++ b/alphaeval.go
@@ -18,71 +18,71 @@ import (
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
-// EvalService contains methods and other services that help with interacting with
-// the llama-stack-client API.
+// AlphaEvalService contains methods and other services that help with interacting
+// with the llama-stack-client 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 [NewEvalService] method instead.
-type EvalService struct {
+// the [NewAlphaEvalService] method instead.
+type AlphaEvalService struct {
Options []option.RequestOption
- Jobs EvalJobService
+ Jobs AlphaEvalJobService
}
-// NewEvalService 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 NewEvalService(opts ...option.RequestOption) (r EvalService) {
- r = EvalService{}
+// NewAlphaEvalService 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 NewAlphaEvalService(opts ...option.RequestOption) (r AlphaEvalService) {
+ r = AlphaEvalService{}
r.Options = opts
- r.Jobs = NewEvalJobService(opts...)
+ r.Jobs = NewAlphaEvalJobService(opts...)
return
}
// Evaluate a list of rows on a benchmark.
-func (r *EvalService) EvaluateRows(ctx context.Context, benchmarkID string, body EvalEvaluateRowsParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
+func (r *AlphaEvalService) EvaluateRows(ctx context.Context, benchmarkID string, body AlphaEvalEvaluateRowsParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/evaluations", benchmarkID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/evaluations", benchmarkID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Evaluate a list of rows on a benchmark.
-func (r *EvalService) EvaluateRowsAlpha(ctx context.Context, benchmarkID string, body EvalEvaluateRowsAlphaParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
+func (r *AlphaEvalService) EvaluateRowsAlpha(ctx context.Context, benchmarkID string, body AlphaEvalEvaluateRowsAlphaParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/evaluations", benchmarkID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/evaluations", benchmarkID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Run an evaluation on a benchmark.
-func (r *EvalService) RunEval(ctx context.Context, benchmarkID string, body EvalRunEvalParams, opts ...option.RequestOption) (res *Job, err error) {
+func (r *AlphaEvalService) RunEval(ctx context.Context, benchmarkID string, body AlphaEvalRunEvalParams, opts ...option.RequestOption) (res *Job, err error) {
opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/jobs", benchmarkID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/jobs", benchmarkID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Run an evaluation on a benchmark.
-func (r *EvalService) RunEvalAlpha(ctx context.Context, benchmarkID string, body EvalRunEvalAlphaParams, opts ...option.RequestOption) (res *Job, err error) {
+func (r *AlphaEvalService) RunEvalAlpha(ctx context.Context, benchmarkID string, body AlphaEvalRunEvalAlphaParams, opts ...option.RequestOption) (res *Job, err error) {
opts = slices.Concat(r.Options, opts)
if benchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/jobs", benchmarkID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/jobs", benchmarkID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -334,28 +334,28 @@ const (
JobStatusCancelled JobStatus = "cancelled"
)
-type EvalEvaluateRowsParams struct {
+type AlphaEvalEvaluateRowsParams struct {
// The configuration for the benchmark.
BenchmarkConfig BenchmarkConfigParam `json:"benchmark_config,omitzero,required"`
// The rows to evaluate.
- InputRows []map[string]EvalEvaluateRowsParamsInputRowUnion `json:"input_rows,omitzero,required"`
+ InputRows []map[string]AlphaEvalEvaluateRowsParamsInputRowUnion `json:"input_rows,omitzero,required"`
// The scoring functions to use for the evaluation.
ScoringFunctions []string `json:"scoring_functions,omitzero,required"`
paramObj
}
-func (r EvalEvaluateRowsParams) MarshalJSON() (data []byte, err error) {
- type shadow EvalEvaluateRowsParams
+func (r AlphaEvalEvaluateRowsParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaEvalEvaluateRowsParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EvalEvaluateRowsParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaEvalEvaluateRowsParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type EvalEvaluateRowsParamsInputRowUnion struct {
+type AlphaEvalEvaluateRowsParamsInputRowUnion struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -363,14 +363,14 @@ type EvalEvaluateRowsParamsInputRowUnion struct {
paramUnion
}
-func (u EvalEvaluateRowsParamsInputRowUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaEvalEvaluateRowsParamsInputRowUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *EvalEvaluateRowsParamsInputRowUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaEvalEvaluateRowsParamsInputRowUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *EvalEvaluateRowsParamsInputRowUnion) asAny() any {
+func (u *AlphaEvalEvaluateRowsParamsInputRowUnion) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -383,28 +383,28 @@ func (u *EvalEvaluateRowsParamsInputRowUnion) asAny() any {
return nil
}
-type EvalEvaluateRowsAlphaParams struct {
+type AlphaEvalEvaluateRowsAlphaParams struct {
// The configuration for the benchmark.
BenchmarkConfig BenchmarkConfigParam `json:"benchmark_config,omitzero,required"`
// The rows to evaluate.
- InputRows []map[string]EvalEvaluateRowsAlphaParamsInputRowUnion `json:"input_rows,omitzero,required"`
+ InputRows []map[string]AlphaEvalEvaluateRowsAlphaParamsInputRowUnion `json:"input_rows,omitzero,required"`
// The scoring functions to use for the evaluation.
ScoringFunctions []string `json:"scoring_functions,omitzero,required"`
paramObj
}
-func (r EvalEvaluateRowsAlphaParams) MarshalJSON() (data []byte, err error) {
- type shadow EvalEvaluateRowsAlphaParams
+func (r AlphaEvalEvaluateRowsAlphaParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaEvalEvaluateRowsAlphaParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EvalEvaluateRowsAlphaParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaEvalEvaluateRowsAlphaParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type EvalEvaluateRowsAlphaParamsInputRowUnion struct {
+type AlphaEvalEvaluateRowsAlphaParamsInputRowUnion struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -412,14 +412,14 @@ type EvalEvaluateRowsAlphaParamsInputRowUnion struct {
paramUnion
}
-func (u EvalEvaluateRowsAlphaParamsInputRowUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaEvalEvaluateRowsAlphaParamsInputRowUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *EvalEvaluateRowsAlphaParamsInputRowUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaEvalEvaluateRowsAlphaParamsInputRowUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *EvalEvaluateRowsAlphaParamsInputRowUnion) asAny() any {
+func (u *AlphaEvalEvaluateRowsAlphaParamsInputRowUnion) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -432,30 +432,30 @@ func (u *EvalEvaluateRowsAlphaParamsInputRowUnion) asAny() any {
return nil
}
-type EvalRunEvalParams struct {
+type AlphaEvalRunEvalParams struct {
// The configuration for the benchmark.
BenchmarkConfig BenchmarkConfigParam `json:"benchmark_config,omitzero,required"`
paramObj
}
-func (r EvalRunEvalParams) MarshalJSON() (data []byte, err error) {
- type shadow EvalRunEvalParams
+func (r AlphaEvalRunEvalParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaEvalRunEvalParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EvalRunEvalParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaEvalRunEvalParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type EvalRunEvalAlphaParams struct {
+type AlphaEvalRunEvalAlphaParams struct {
// The configuration for the benchmark.
BenchmarkConfig BenchmarkConfigParam `json:"benchmark_config,omitzero,required"`
paramObj
}
-func (r EvalRunEvalAlphaParams) MarshalJSON() (data []byte, err error) {
- type shadow EvalRunEvalAlphaParams
+func (r AlphaEvalRunEvalAlphaParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaEvalRunEvalAlphaParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EvalRunEvalAlphaParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaEvalRunEvalAlphaParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/eval_test.go b/alphaeval_test.go
similarity index 90%
rename from eval_test.go
rename to alphaeval_test.go
index f3d1608..0949d52 100644
--- a/eval_test.go
+++ b/alphaeval_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
+func TestAlphaEvalEvaluateRowsWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,10 +24,10 @@ func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Eval.EvaluateRows(
+ _, err := client.Alpha.Eval.EvaluateRows(
context.TODO(),
"benchmark_id",
- llamastackclient.EvalEvaluateRowsParams{
+ llamastackclient.AlphaEvalEvaluateRowsParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
@@ -59,7 +59,7 @@ func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
},
NumExamples: llamastackclient.Int(0),
},
- InputRows: []map[string]llamastackclient.EvalEvaluateRowsParamsInputRowUnion{{
+ InputRows: []map[string]llamastackclient.AlphaEvalEvaluateRowsParamsInputRowUnion{{
"foo": {
OfBool: llamastackclient.Bool(true),
},
@@ -76,7 +76,7 @@ func TestEvalEvaluateRowsWithOptionalParams(t *testing.T) {
}
}
-func TestEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
+func TestAlphaEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -87,10 +87,10 @@ func TestEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Eval.EvaluateRowsAlpha(
+ _, err := client.Alpha.Eval.EvaluateRowsAlpha(
context.TODO(),
"benchmark_id",
- llamastackclient.EvalEvaluateRowsAlphaParams{
+ llamastackclient.AlphaEvalEvaluateRowsAlphaParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
@@ -122,7 +122,7 @@ func TestEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
},
NumExamples: llamastackclient.Int(0),
},
- InputRows: []map[string]llamastackclient.EvalEvaluateRowsAlphaParamsInputRowUnion{{
+ InputRows: []map[string]llamastackclient.AlphaEvalEvaluateRowsAlphaParamsInputRowUnion{{
"foo": {
OfBool: llamastackclient.Bool(true),
},
@@ -139,7 +139,7 @@ func TestEvalEvaluateRowsAlphaWithOptionalParams(t *testing.T) {
}
}
-func TestEvalRunEvalWithOptionalParams(t *testing.T) {
+func TestAlphaEvalRunEvalWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -150,10 +150,10 @@ func TestEvalRunEvalWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Eval.RunEval(
+ _, err := client.Alpha.Eval.RunEval(
context.TODO(),
"benchmark_id",
- llamastackclient.EvalRunEvalParams{
+ llamastackclient.AlphaEvalRunEvalParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
@@ -196,7 +196,7 @@ func TestEvalRunEvalWithOptionalParams(t *testing.T) {
}
}
-func TestEvalRunEvalAlphaWithOptionalParams(t *testing.T) {
+func TestAlphaEvalRunEvalAlphaWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -207,10 +207,10 @@ func TestEvalRunEvalAlphaWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Eval.RunEvalAlpha(
+ _, err := client.Alpha.Eval.RunEvalAlpha(
context.TODO(),
"benchmark_id",
- llamastackclient.EvalRunEvalAlphaParams{
+ llamastackclient.AlphaEvalRunEvalAlphaParams{
BenchmarkConfig: llamastackclient.BenchmarkConfigParam{
EvalCandidate: llamastackclient.BenchmarkConfigEvalCandidateUnionParam{
OfModel: &llamastackclient.BenchmarkConfigEvalCandidateModelParam{
diff --git a/evaljob.go b/alphaevaljob.go
similarity index 57%
rename from evaljob.go
rename to alphaevaljob.go
index e71d355..207b027 100644
--- a/evaljob.go
+++ b/alphaevaljob.go
@@ -13,27 +13,27 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-// EvalJobService contains methods and other services that help with interacting
-// with the llama-stack-client API.
+// AlphaEvalJobService contains methods and other services that help with
+// interacting with the llama-stack-client 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 [NewEvalJobService] method instead.
-type EvalJobService struct {
+// the [NewAlphaEvalJobService] method instead.
+type AlphaEvalJobService struct {
Options []option.RequestOption
}
-// NewEvalJobService 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 NewEvalJobService(opts ...option.RequestOption) (r EvalJobService) {
- r = EvalJobService{}
+// NewAlphaEvalJobService 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 NewAlphaEvalJobService(opts ...option.RequestOption) (r AlphaEvalJobService) {
+ r = AlphaEvalJobService{}
r.Options = opts
return
}
// Get the result of a job.
-func (r *EvalJobService) Get(ctx context.Context, jobID string, query EvalJobGetParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
+func (r *AlphaEvalJobService) Get(ctx context.Context, jobID string, query AlphaEvalJobGetParams, opts ...option.RequestOption) (res *EvaluateResponse, err error) {
opts = slices.Concat(r.Options, opts)
if query.BenchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
@@ -43,13 +43,13 @@ func (r *EvalJobService) Get(ctx context.Context, jobID string, query EvalJobGet
err = errors.New("missing required job_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/jobs/%s/result", query.BenchmarkID, jobID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/jobs/%s/result", query.BenchmarkID, jobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
// Cancel a job.
-func (r *EvalJobService) Cancel(ctx context.Context, jobID string, body EvalJobCancelParams, opts ...option.RequestOption) (err error) {
+func (r *AlphaEvalJobService) Cancel(ctx context.Context, jobID string, body AlphaEvalJobCancelParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
if body.BenchmarkID == "" {
@@ -60,13 +60,13 @@ func (r *EvalJobService) Cancel(ctx context.Context, jobID string, body EvalJobC
err = errors.New("missing required job_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/jobs/%s", body.BenchmarkID, jobID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/jobs/%s", body.BenchmarkID, jobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
return
}
// Get the status of a job.
-func (r *EvalJobService) Status(ctx context.Context, jobID string, query EvalJobStatusParams, opts ...option.RequestOption) (res *Job, err error) {
+func (r *AlphaEvalJobService) Status(ctx context.Context, jobID string, query AlphaEvalJobStatusParams, opts ...option.RequestOption) (res *Job, err error) {
opts = slices.Concat(r.Options, opts)
if query.BenchmarkID == "" {
err = errors.New("missing required benchmark_id parameter")
@@ -76,22 +76,22 @@ func (r *EvalJobService) Status(ctx context.Context, jobID string, query EvalJob
err = errors.New("missing required job_id parameter")
return
}
- path := fmt.Sprintf("v1/eval/benchmarks/%s/jobs/%s", query.BenchmarkID, jobID)
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s/jobs/%s", query.BenchmarkID, jobID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
-type EvalJobGetParams struct {
+type AlphaEvalJobGetParams struct {
BenchmarkID string `path:"benchmark_id,required" json:"-"`
paramObj
}
-type EvalJobCancelParams struct {
+type AlphaEvalJobCancelParams struct {
BenchmarkID string `path:"benchmark_id,required" json:"-"`
paramObj
}
-type EvalJobStatusParams struct {
+type AlphaEvalJobStatusParams struct {
BenchmarkID string `path:"benchmark_id,required" json:"-"`
paramObj
}
diff --git a/evaljob_test.go b/alphaevaljob_test.go
similarity index 82%
rename from evaljob_test.go
rename to alphaevaljob_test.go
index 4af20d9..0d68bc5 100644
--- a/evaljob_test.go
+++ b/alphaevaljob_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestEvalJobGet(t *testing.T) {
+func TestAlphaEvalJobGet(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,10 +24,10 @@ func TestEvalJobGet(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Eval.Jobs.Get(
+ _, err := client.Alpha.Eval.Jobs.Get(
context.TODO(),
"job_id",
- llamastackclient.EvalJobGetParams{
+ llamastackclient.AlphaEvalJobGetParams{
BenchmarkID: "benchmark_id",
},
)
@@ -40,7 +40,7 @@ func TestEvalJobGet(t *testing.T) {
}
}
-func TestEvalJobCancel(t *testing.T) {
+func TestAlphaEvalJobCancel(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -51,10 +51,10 @@ func TestEvalJobCancel(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- err := client.Eval.Jobs.Cancel(
+ err := client.Alpha.Eval.Jobs.Cancel(
context.TODO(),
"job_id",
- llamastackclient.EvalJobCancelParams{
+ llamastackclient.AlphaEvalJobCancelParams{
BenchmarkID: "benchmark_id",
},
)
@@ -67,7 +67,7 @@ func TestEvalJobCancel(t *testing.T) {
}
}
-func TestEvalJobStatus(t *testing.T) {
+func TestAlphaEvalJobStatus(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -78,10 +78,10 @@ func TestEvalJobStatus(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.Eval.Jobs.Status(
+ _, err := client.Alpha.Eval.Jobs.Status(
context.TODO(),
"job_id",
- llamastackclient.EvalJobStatusParams{
+ llamastackclient.AlphaEvalJobStatusParams{
BenchmarkID: "benchmark_id",
},
)
diff --git a/posttraining.go b/alphaposttraining.go
similarity index 68%
rename from posttraining.go
rename to alphaposttraining.go
index 9b94fa8..cbaa57e 100644
--- a/posttraining.go
+++ b/alphaposttraining.go
@@ -15,39 +15,39 @@ import (
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
-// PostTrainingService contains methods and other services that help with
+// AlphaPostTrainingService contains methods and other services that help with
// interacting with the llama-stack-client 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 [NewPostTrainingService] method instead.
-type PostTrainingService struct {
+// the [NewAlphaPostTrainingService] method instead.
+type AlphaPostTrainingService struct {
Options []option.RequestOption
- Job PostTrainingJobService
+ Job AlphaPostTrainingJobService
}
-// NewPostTrainingService 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 NewPostTrainingService(opts ...option.RequestOption) (r PostTrainingService) {
- r = PostTrainingService{}
+// NewAlphaPostTrainingService 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 NewAlphaPostTrainingService(opts ...option.RequestOption) (r AlphaPostTrainingService) {
+ r = AlphaPostTrainingService{}
r.Options = opts
- r.Job = NewPostTrainingJobService(opts...)
+ r.Job = NewAlphaPostTrainingJobService(opts...)
return
}
// Run preference optimization of a model.
-func (r *PostTrainingService) PreferenceOptimize(ctx context.Context, body PostTrainingPreferenceOptimizeParams, opts ...option.RequestOption) (res *PostTrainingJob, err error) {
+func (r *AlphaPostTrainingService) PreferenceOptimize(ctx context.Context, body AlphaPostTrainingPreferenceOptimizeParams, opts ...option.RequestOption) (res *PostTrainingJob, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/post-training/preference-optimize"
+ path := "v1alpha/post-training/preference-optimize"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
// Run supervised fine-tuning of a model.
-func (r *PostTrainingService) SupervisedFineTune(ctx context.Context, body PostTrainingSupervisedFineTuneParams, opts ...option.RequestOption) (res *PostTrainingJob, err error) {
+func (r *AlphaPostTrainingService) SupervisedFineTune(ctx context.Context, body AlphaPostTrainingSupervisedFineTuneParams, opts ...option.RequestOption) (res *PostTrainingJob, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/post-training/supervised-fine-tune"
+ path := "v1alpha/post-training/supervised-fine-tune"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}
@@ -247,34 +247,34 @@ func (r *PostTrainingJob) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PostTrainingPreferenceOptimizeParams struct {
+type AlphaPostTrainingPreferenceOptimizeParams struct {
// The algorithm configuration.
- AlgorithmConfig PostTrainingPreferenceOptimizeParamsAlgorithmConfig `json:"algorithm_config,omitzero,required"`
+ AlgorithmConfig AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig `json:"algorithm_config,omitzero,required"`
// The model to fine-tune.
FinetunedModel string `json:"finetuned_model,required"`
// The hyperparam search configuration.
- HyperparamSearchConfig map[string]PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion `json:"hyperparam_search_config,omitzero,required"`
+ HyperparamSearchConfig map[string]AlphaPostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion `json:"hyperparam_search_config,omitzero,required"`
// The UUID of the job to create.
JobUuid string `json:"job_uuid,required"`
// The logger configuration.
- LoggerConfig map[string]PostTrainingPreferenceOptimizeParamsLoggerConfigUnion `json:"logger_config,omitzero,required"`
+ LoggerConfig map[string]AlphaPostTrainingPreferenceOptimizeParamsLoggerConfigUnion `json:"logger_config,omitzero,required"`
// The training configuration.
- TrainingConfig PostTrainingPreferenceOptimizeParamsTrainingConfig `json:"training_config,omitzero,required"`
+ TrainingConfig AlphaPostTrainingPreferenceOptimizeParamsTrainingConfig `json:"training_config,omitzero,required"`
paramObj
}
-func (r PostTrainingPreferenceOptimizeParams) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingPreferenceOptimizeParams
+func (r AlphaPostTrainingPreferenceOptimizeParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingPreferenceOptimizeParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingPreferenceOptimizeParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingPreferenceOptimizeParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// The algorithm configuration.
//
// The properties Beta, LossType are required.
-type PostTrainingPreferenceOptimizeParamsAlgorithmConfig struct {
+type AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig struct {
// Temperature parameter for the DPO loss
Beta float64 `json:"beta,required"`
// The type of loss function to use for DPO
@@ -284,16 +284,16 @@ type PostTrainingPreferenceOptimizeParamsAlgorithmConfig struct {
paramObj
}
-func (r PostTrainingPreferenceOptimizeParamsAlgorithmConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingPreferenceOptimizeParamsAlgorithmConfig
+func (r AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingPreferenceOptimizeParamsAlgorithmConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[PostTrainingPreferenceOptimizeParamsAlgorithmConfig](
+ apijson.RegisterFieldValidator[AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig](
"loss_type", "sigmoid", "hinge", "ipo", "kto_pair",
)
}
@@ -301,7 +301,7 @@ func init() {
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion struct {
+type AlphaPostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -309,14 +309,14 @@ type PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion struct {
paramUnion
}
-func (u PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaPostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaPostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) asAny() any {
+func (u *AlphaPostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -332,7 +332,7 @@ func (u *PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion) asAny(
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type PostTrainingPreferenceOptimizeParamsLoggerConfigUnion struct {
+type AlphaPostTrainingPreferenceOptimizeParamsLoggerConfigUnion struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -340,14 +340,14 @@ type PostTrainingPreferenceOptimizeParamsLoggerConfigUnion struct {
paramUnion
}
-func (u PostTrainingPreferenceOptimizeParamsLoggerConfigUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaPostTrainingPreferenceOptimizeParamsLoggerConfigUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *PostTrainingPreferenceOptimizeParamsLoggerConfigUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaPostTrainingPreferenceOptimizeParamsLoggerConfigUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *PostTrainingPreferenceOptimizeParamsLoggerConfigUnion) asAny() any {
+func (u *AlphaPostTrainingPreferenceOptimizeParamsLoggerConfigUnion) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -364,7 +364,7 @@ func (u *PostTrainingPreferenceOptimizeParamsLoggerConfigUnion) asAny() any {
//
// The properties GradientAccumulationSteps, MaxStepsPerEpoch, NEpochs are
// required.
-type PostTrainingPreferenceOptimizeParamsTrainingConfig struct {
+type AlphaPostTrainingPreferenceOptimizeParamsTrainingConfig struct {
// Number of steps to accumulate gradients before updating
GradientAccumulationSteps int64 `json:"gradient_accumulation_steps,required"`
// Maximum number of steps to run per epoch
@@ -376,26 +376,26 @@ type PostTrainingPreferenceOptimizeParamsTrainingConfig struct {
// (Optional) Maximum number of validation steps per epoch
MaxValidationSteps param.Opt[int64] `json:"max_validation_steps,omitzero"`
// (Optional) Configuration for data loading and formatting
- DataConfig PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig `json:"data_config,omitzero"`
+ DataConfig AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig `json:"data_config,omitzero"`
// (Optional) Configuration for memory and compute optimizations
- EfficiencyConfig PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig `json:"efficiency_config,omitzero"`
+ EfficiencyConfig AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig `json:"efficiency_config,omitzero"`
// (Optional) Configuration for the optimization algorithm
- OptimizerConfig PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig `json:"optimizer_config,omitzero"`
+ OptimizerConfig AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig `json:"optimizer_config,omitzero"`
paramObj
}
-func (r PostTrainingPreferenceOptimizeParamsTrainingConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingPreferenceOptimizeParamsTrainingConfig
+func (r AlphaPostTrainingPreferenceOptimizeParamsTrainingConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingPreferenceOptimizeParamsTrainingConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingPreferenceOptimizeParamsTrainingConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingPreferenceOptimizeParamsTrainingConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Configuration for data loading and formatting
//
// The properties BatchSize, DataFormat, DatasetID, Shuffle are required.
-type PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig struct {
+type AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig struct {
// Number of samples per training batch
BatchSize int64 `json:"batch_size,required"`
// Format of the dataset (instruct or dialog)
@@ -416,22 +416,22 @@ type PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig struct {
paramObj
}
-func (r PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig
+func (r AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig](
+ apijson.RegisterFieldValidator[AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig](
"data_format", "instruct", "dialog",
)
}
// (Optional) Configuration for memory and compute optimizations
-type PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig struct {
+type AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig struct {
// (Optional) Whether to use activation checkpointing to reduce memory usage
EnableActivationCheckpointing param.Opt[bool] `json:"enable_activation_checkpointing,omitzero"`
// (Optional) Whether to offload activations to CPU to save GPU memory
@@ -443,18 +443,18 @@ type PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig struct {
paramObj
}
-func (r PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig
+func (r AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Configuration for the optimization algorithm
//
// The properties Lr, NumWarmupSteps, OptimizerType, WeightDecay are required.
-type PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig struct {
+type AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig struct {
// Learning rate for the optimizer
Lr float64 `json:"lr,required"`
// Number of steps for learning rate warmup
@@ -468,29 +468,29 @@ type PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig struct {
paramObj
}
-func (r PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig
+func (r AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig](
+ apijson.RegisterFieldValidator[AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig](
"optimizer_type", "adam", "adamw", "sgd",
)
}
-type PostTrainingSupervisedFineTuneParams struct {
+type AlphaPostTrainingSupervisedFineTuneParams struct {
// The hyperparam search configuration.
- HyperparamSearchConfig map[string]PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion `json:"hyperparam_search_config,omitzero,required"`
+ HyperparamSearchConfig map[string]AlphaPostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion `json:"hyperparam_search_config,omitzero,required"`
// The UUID of the job to create.
JobUuid string `json:"job_uuid,required"`
// The logger configuration.
- LoggerConfig map[string]PostTrainingSupervisedFineTuneParamsLoggerConfigUnion `json:"logger_config,omitzero,required"`
+ LoggerConfig map[string]AlphaPostTrainingSupervisedFineTuneParamsLoggerConfigUnion `json:"logger_config,omitzero,required"`
// The training configuration.
- TrainingConfig PostTrainingSupervisedFineTuneParamsTrainingConfig `json:"training_config,omitzero,required"`
+ TrainingConfig AlphaPostTrainingSupervisedFineTuneParamsTrainingConfig `json:"training_config,omitzero,required"`
// The directory to save checkpoint(s) to.
CheckpointDir param.Opt[string] `json:"checkpoint_dir,omitzero"`
// The model to fine-tune.
@@ -500,18 +500,18 @@ type PostTrainingSupervisedFineTuneParams struct {
paramObj
}
-func (r PostTrainingSupervisedFineTuneParams) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingSupervisedFineTuneParams
+func (r AlphaPostTrainingSupervisedFineTuneParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingSupervisedFineTuneParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingSupervisedFineTuneParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingSupervisedFineTuneParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion struct {
+type AlphaPostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -519,14 +519,14 @@ type PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion struct {
paramUnion
}
-func (u PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaPostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaPostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) asAny() any {
+func (u *AlphaPostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -542,7 +542,7 @@ func (u *PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion) asAny(
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type PostTrainingSupervisedFineTuneParamsLoggerConfigUnion struct {
+type AlphaPostTrainingSupervisedFineTuneParamsLoggerConfigUnion struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -550,14 +550,14 @@ type PostTrainingSupervisedFineTuneParamsLoggerConfigUnion struct {
paramUnion
}
-func (u PostTrainingSupervisedFineTuneParamsLoggerConfigUnion) MarshalJSON() ([]byte, error) {
+func (u AlphaPostTrainingSupervisedFineTuneParamsLoggerConfigUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *PostTrainingSupervisedFineTuneParamsLoggerConfigUnion) UnmarshalJSON(data []byte) error {
+func (u *AlphaPostTrainingSupervisedFineTuneParamsLoggerConfigUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *PostTrainingSupervisedFineTuneParamsLoggerConfigUnion) asAny() any {
+func (u *AlphaPostTrainingSupervisedFineTuneParamsLoggerConfigUnion) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -574,7 +574,7 @@ func (u *PostTrainingSupervisedFineTuneParamsLoggerConfigUnion) asAny() any {
//
// The properties GradientAccumulationSteps, MaxStepsPerEpoch, NEpochs are
// required.
-type PostTrainingSupervisedFineTuneParamsTrainingConfig struct {
+type AlphaPostTrainingSupervisedFineTuneParamsTrainingConfig struct {
// Number of steps to accumulate gradients before updating
GradientAccumulationSteps int64 `json:"gradient_accumulation_steps,required"`
// Maximum number of steps to run per epoch
@@ -586,26 +586,26 @@ type PostTrainingSupervisedFineTuneParamsTrainingConfig struct {
// (Optional) Maximum number of validation steps per epoch
MaxValidationSteps param.Opt[int64] `json:"max_validation_steps,omitzero"`
// (Optional) Configuration for data loading and formatting
- DataConfig PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig `json:"data_config,omitzero"`
+ DataConfig AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig `json:"data_config,omitzero"`
// (Optional) Configuration for memory and compute optimizations
- EfficiencyConfig PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig `json:"efficiency_config,omitzero"`
+ EfficiencyConfig AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig `json:"efficiency_config,omitzero"`
// (Optional) Configuration for the optimization algorithm
- OptimizerConfig PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig `json:"optimizer_config,omitzero"`
+ OptimizerConfig AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig `json:"optimizer_config,omitzero"`
paramObj
}
-func (r PostTrainingSupervisedFineTuneParamsTrainingConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingSupervisedFineTuneParamsTrainingConfig
+func (r AlphaPostTrainingSupervisedFineTuneParamsTrainingConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingSupervisedFineTuneParamsTrainingConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingSupervisedFineTuneParamsTrainingConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingSupervisedFineTuneParamsTrainingConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Configuration for data loading and formatting
//
// The properties BatchSize, DataFormat, DatasetID, Shuffle are required.
-type PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig struct {
+type AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig struct {
// Number of samples per training batch
BatchSize int64 `json:"batch_size,required"`
// Format of the dataset (instruct or dialog)
@@ -626,22 +626,22 @@ type PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig struct {
paramObj
}
-func (r PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig
+func (r AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig](
+ apijson.RegisterFieldValidator[AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig](
"data_format", "instruct", "dialog",
)
}
// (Optional) Configuration for memory and compute optimizations
-type PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig struct {
+type AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig struct {
// (Optional) Whether to use activation checkpointing to reduce memory usage
EnableActivationCheckpointing param.Opt[bool] `json:"enable_activation_checkpointing,omitzero"`
// (Optional) Whether to offload activations to CPU to save GPU memory
@@ -653,18 +653,18 @@ type PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig struct {
paramObj
}
-func (r PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig
+func (r AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Configuration for the optimization algorithm
//
// The properties Lr, NumWarmupSteps, OptimizerType, WeightDecay are required.
-type PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig struct {
+type AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig struct {
// Learning rate for the optimizer
Lr float64 `json:"lr,required"`
// Number of steps for learning rate warmup
@@ -678,16 +678,16 @@ type PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig struct {
paramObj
}
-func (r PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig
+func (r AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig](
+ apijson.RegisterFieldValidator[AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig](
"optimizer_type", "adam", "adamw", "sgd",
)
}
diff --git a/posttraining_test.go b/alphaposttraining_test.go
similarity index 68%
rename from posttraining_test.go
rename to alphaposttraining_test.go
index f43920e..d663687 100644
--- a/posttraining_test.go
+++ b/alphaposttraining_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestPostTrainingPreferenceOptimizeWithOptionalParams(t *testing.T) {
+func TestAlphaPostTrainingPreferenceOptimizeWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,28 +24,28 @@ func TestPostTrainingPreferenceOptimizeWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.PostTraining.PreferenceOptimize(context.TODO(), llamastackclient.PostTrainingPreferenceOptimizeParams{
- AlgorithmConfig: llamastackclient.PostTrainingPreferenceOptimizeParamsAlgorithmConfig{
+ _, err := client.Alpha.PostTraining.PreferenceOptimize(context.TODO(), llamastackclient.AlphaPostTrainingPreferenceOptimizeParams{
+ AlgorithmConfig: llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsAlgorithmConfig{
Beta: 0,
LossType: "sigmoid",
},
FinetunedModel: "finetuned_model",
- HyperparamSearchConfig: map[string]llamastackclient.PostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion{
+ HyperparamSearchConfig: map[string]llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsHyperparamSearchConfigUnion{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
JobUuid: "job_uuid",
- LoggerConfig: map[string]llamastackclient.PostTrainingPreferenceOptimizeParamsLoggerConfigUnion{
+ LoggerConfig: map[string]llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsLoggerConfigUnion{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
- TrainingConfig: llamastackclient.PostTrainingPreferenceOptimizeParamsTrainingConfig{
+ TrainingConfig: llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsTrainingConfig{
GradientAccumulationSteps: 0,
MaxStepsPerEpoch: 0,
NEpochs: 0,
- DataConfig: llamastackclient.PostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig{
+ DataConfig: llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigDataConfig{
BatchSize: 0,
DataFormat: "instruct",
DatasetID: "dataset_id",
@@ -55,14 +55,14 @@ func TestPostTrainingPreferenceOptimizeWithOptionalParams(t *testing.T) {
ValidationDatasetID: llamastackclient.String("validation_dataset_id"),
},
Dtype: llamastackclient.String("dtype"),
- EfficiencyConfig: llamastackclient.PostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig{
+ EfficiencyConfig: llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigEfficiencyConfig{
EnableActivationCheckpointing: llamastackclient.Bool(true),
EnableActivationOffloading: llamastackclient.Bool(true),
FsdpCPUOffload: llamastackclient.Bool(true),
MemoryEfficientFsdpWrap: llamastackclient.Bool(true),
},
MaxValidationSteps: llamastackclient.Int(0),
- OptimizerConfig: llamastackclient.PostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig{
+ OptimizerConfig: llamastackclient.AlphaPostTrainingPreferenceOptimizeParamsTrainingConfigOptimizerConfig{
Lr: 0,
NumWarmupSteps: 0,
OptimizerType: "adam",
@@ -79,7 +79,7 @@ func TestPostTrainingPreferenceOptimizeWithOptionalParams(t *testing.T) {
}
}
-func TestPostTrainingSupervisedFineTuneWithOptionalParams(t *testing.T) {
+func TestAlphaPostTrainingSupervisedFineTuneWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -90,23 +90,23 @@ func TestPostTrainingSupervisedFineTuneWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.PostTraining.SupervisedFineTune(context.TODO(), llamastackclient.PostTrainingSupervisedFineTuneParams{
- HyperparamSearchConfig: map[string]llamastackclient.PostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion{
+ _, err := client.Alpha.PostTraining.SupervisedFineTune(context.TODO(), llamastackclient.AlphaPostTrainingSupervisedFineTuneParams{
+ HyperparamSearchConfig: map[string]llamastackclient.AlphaPostTrainingSupervisedFineTuneParamsHyperparamSearchConfigUnion{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
JobUuid: "job_uuid",
- LoggerConfig: map[string]llamastackclient.PostTrainingSupervisedFineTuneParamsLoggerConfigUnion{
+ LoggerConfig: map[string]llamastackclient.AlphaPostTrainingSupervisedFineTuneParamsLoggerConfigUnion{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
- TrainingConfig: llamastackclient.PostTrainingSupervisedFineTuneParamsTrainingConfig{
+ TrainingConfig: llamastackclient.AlphaPostTrainingSupervisedFineTuneParamsTrainingConfig{
GradientAccumulationSteps: 0,
MaxStepsPerEpoch: 0,
NEpochs: 0,
- DataConfig: llamastackclient.PostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig{
+ DataConfig: llamastackclient.AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigDataConfig{
BatchSize: 0,
DataFormat: "instruct",
DatasetID: "dataset_id",
@@ -116,14 +116,14 @@ func TestPostTrainingSupervisedFineTuneWithOptionalParams(t *testing.T) {
ValidationDatasetID: llamastackclient.String("validation_dataset_id"),
},
Dtype: llamastackclient.String("dtype"),
- EfficiencyConfig: llamastackclient.PostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig{
+ EfficiencyConfig: llamastackclient.AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigEfficiencyConfig{
EnableActivationCheckpointing: llamastackclient.Bool(true),
EnableActivationOffloading: llamastackclient.Bool(true),
FsdpCPUOffload: llamastackclient.Bool(true),
MemoryEfficientFsdpWrap: llamastackclient.Bool(true),
},
MaxValidationSteps: llamastackclient.Int(0),
- OptimizerConfig: llamastackclient.PostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig{
+ OptimizerConfig: llamastackclient.AlphaPostTrainingSupervisedFineTuneParamsTrainingConfigOptimizerConfig{
Lr: 0,
NumWarmupSteps: 0,
OptimizerType: "adam",
diff --git a/posttrainingjob.go b/alphaposttrainingjob.go
similarity index 65%
rename from posttrainingjob.go
rename to alphaposttrainingjob.go
index 9cc9583..2d2959c 100644
--- a/posttrainingjob.go
+++ b/alphaposttrainingjob.go
@@ -18,30 +18,30 @@ import (
"github.com/llamastack/llama-stack-client-go/packages/respjson"
)
-// PostTrainingJobService contains methods and other services that help with
+// AlphaPostTrainingJobService contains methods and other services that help with
// interacting with the llama-stack-client 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 [NewPostTrainingJobService] method instead.
-type PostTrainingJobService struct {
+// the [NewAlphaPostTrainingJobService] method instead.
+type AlphaPostTrainingJobService struct {
Options []option.RequestOption
}
-// NewPostTrainingJobService 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 NewPostTrainingJobService(opts ...option.RequestOption) (r PostTrainingJobService) {
- r = PostTrainingJobService{}
+// NewAlphaPostTrainingJobService 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 NewAlphaPostTrainingJobService(opts ...option.RequestOption) (r AlphaPostTrainingJobService) {
+ r = AlphaPostTrainingJobService{}
r.Options = opts
return
}
// Get all training jobs.
-func (r *PostTrainingJobService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListPostTrainingJobsResponseData, err error) {
+func (r *AlphaPostTrainingJobService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListPostTrainingJobsResponseData, err error) {
var env ListPostTrainingJobsResponse
opts = slices.Concat(r.Options, opts)
- path := "v1/post-training/jobs"
+ path := "v1alpha/post-training/jobs"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
if err != nil {
return
@@ -51,34 +51,34 @@ func (r *PostTrainingJobService) List(ctx context.Context, opts ...option.Reques
}
// Get the artifacts of a training job.
-func (r *PostTrainingJobService) Artifacts(ctx context.Context, query PostTrainingJobArtifactsParams, opts ...option.RequestOption) (res *PostTrainingJobArtifactsResponse, err error) {
+func (r *AlphaPostTrainingJobService) Artifacts(ctx context.Context, query AlphaPostTrainingJobArtifactsParams, opts ...option.RequestOption) (res *AlphaPostTrainingJobArtifactsResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/post-training/job/artifacts"
+ path := "v1alpha/post-training/job/artifacts"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
// Cancel a training job.
-func (r *PostTrainingJobService) Cancel(ctx context.Context, body PostTrainingJobCancelParams, opts ...option.RequestOption) (err error) {
+func (r *AlphaPostTrainingJobService) Cancel(ctx context.Context, body AlphaPostTrainingJobCancelParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
- path := "v1/post-training/job/cancel"
+ path := "v1alpha/post-training/job/cancel"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return
}
// Get the status of a training job.
-func (r *PostTrainingJobService) Status(ctx context.Context, query PostTrainingJobStatusParams, opts ...option.RequestOption) (res *PostTrainingJobStatusResponse, err error) {
+func (r *AlphaPostTrainingJobService) Status(ctx context.Context, query AlphaPostTrainingJobStatusParams, opts ...option.RequestOption) (res *AlphaPostTrainingJobStatusResponse, err error) {
opts = slices.Concat(r.Options, opts)
- path := "v1/post-training/job/status"
+ path := "v1alpha/post-training/job/status"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
// Artifacts of a finetuning job.
-type PostTrainingJobArtifactsResponse struct {
+type AlphaPostTrainingJobArtifactsResponse struct {
// List of model checkpoints created during training
- Checkpoints []PostTrainingJobArtifactsResponseCheckpoint `json:"checkpoints,required"`
+ Checkpoints []AlphaPostTrainingJobArtifactsResponseCheckpoint `json:"checkpoints,required"`
// Unique identifier for the training job
JobUuid string `json:"job_uuid,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -91,13 +91,13 @@ type PostTrainingJobArtifactsResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r PostTrainingJobArtifactsResponse) RawJSON() string { return r.JSON.raw }
-func (r *PostTrainingJobArtifactsResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaPostTrainingJobArtifactsResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaPostTrainingJobArtifactsResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Checkpoint created during training runs.
-type PostTrainingJobArtifactsResponseCheckpoint struct {
+type AlphaPostTrainingJobArtifactsResponseCheckpoint struct {
// Timestamp when the checkpoint was created
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Training epoch when the checkpoint was saved
@@ -109,7 +109,7 @@ type PostTrainingJobArtifactsResponseCheckpoint struct {
// Identifier of the training job that created this checkpoint
PostTrainingJobID string `json:"post_training_job_id,required"`
// (Optional) Training metrics associated with this checkpoint
- TrainingMetrics PostTrainingJobArtifactsResponseCheckpointTrainingMetrics `json:"training_metrics"`
+ TrainingMetrics AlphaPostTrainingJobArtifactsResponseCheckpointTrainingMetrics `json:"training_metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
@@ -124,13 +124,13 @@ type PostTrainingJobArtifactsResponseCheckpoint struct {
}
// Returns the unmodified JSON received from the API
-func (r PostTrainingJobArtifactsResponseCheckpoint) RawJSON() string { return r.JSON.raw }
-func (r *PostTrainingJobArtifactsResponseCheckpoint) UnmarshalJSON(data []byte) error {
+func (r AlphaPostTrainingJobArtifactsResponseCheckpoint) RawJSON() string { return r.JSON.raw }
+func (r *AlphaPostTrainingJobArtifactsResponseCheckpoint) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Training metrics associated with this checkpoint
-type PostTrainingJobArtifactsResponseCheckpointTrainingMetrics struct {
+type AlphaPostTrainingJobArtifactsResponseCheckpointTrainingMetrics struct {
// Training epoch number
Epoch int64 `json:"epoch,required"`
// Perplexity metric indicating model confidence
@@ -151,27 +151,27 @@ type PostTrainingJobArtifactsResponseCheckpointTrainingMetrics struct {
}
// Returns the unmodified JSON received from the API
-func (r PostTrainingJobArtifactsResponseCheckpointTrainingMetrics) RawJSON() string {
+func (r AlphaPostTrainingJobArtifactsResponseCheckpointTrainingMetrics) RawJSON() string {
return r.JSON.raw
}
-func (r *PostTrainingJobArtifactsResponseCheckpointTrainingMetrics) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingJobArtifactsResponseCheckpointTrainingMetrics) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Status of a finetuning job.
-type PostTrainingJobStatusResponse struct {
+type AlphaPostTrainingJobStatusResponse struct {
// List of model checkpoints created during training
- Checkpoints []PostTrainingJobStatusResponseCheckpoint `json:"checkpoints,required"`
+ Checkpoints []AlphaPostTrainingJobStatusResponseCheckpoint `json:"checkpoints,required"`
// Unique identifier for the training job
JobUuid string `json:"job_uuid,required"`
// Current status of the training job
//
// Any of "completed", "in_progress", "failed", "scheduled", "cancelled".
- Status PostTrainingJobStatusResponseStatus `json:"status,required"`
+ Status AlphaPostTrainingJobStatusResponseStatus `json:"status,required"`
// (Optional) Timestamp when the job finished, if completed
CompletedAt time.Time `json:"completed_at" format:"date-time"`
// (Optional) Information about computational resources allocated to the job
- ResourcesAllocated map[string]PostTrainingJobStatusResponseResourcesAllocatedUnion `json:"resources_allocated"`
+ ResourcesAllocated map[string]AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion `json:"resources_allocated"`
// (Optional) Timestamp when the job was scheduled
ScheduledAt time.Time `json:"scheduled_at" format:"date-time"`
// (Optional) Timestamp when the job execution began
@@ -191,13 +191,13 @@ type PostTrainingJobStatusResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r PostTrainingJobStatusResponse) RawJSON() string { return r.JSON.raw }
-func (r *PostTrainingJobStatusResponse) UnmarshalJSON(data []byte) error {
+func (r AlphaPostTrainingJobStatusResponse) RawJSON() string { return r.JSON.raw }
+func (r *AlphaPostTrainingJobStatusResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Checkpoint created during training runs.
-type PostTrainingJobStatusResponseCheckpoint struct {
+type AlphaPostTrainingJobStatusResponseCheckpoint struct {
// Timestamp when the checkpoint was created
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Training epoch when the checkpoint was saved
@@ -209,7 +209,7 @@ type PostTrainingJobStatusResponseCheckpoint struct {
// Identifier of the training job that created this checkpoint
PostTrainingJobID string `json:"post_training_job_id,required"`
// (Optional) Training metrics associated with this checkpoint
- TrainingMetrics PostTrainingJobStatusResponseCheckpointTrainingMetrics `json:"training_metrics"`
+ TrainingMetrics AlphaPostTrainingJobStatusResponseCheckpointTrainingMetrics `json:"training_metrics"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
@@ -224,13 +224,13 @@ type PostTrainingJobStatusResponseCheckpoint struct {
}
// Returns the unmodified JSON received from the API
-func (r PostTrainingJobStatusResponseCheckpoint) RawJSON() string { return r.JSON.raw }
-func (r *PostTrainingJobStatusResponseCheckpoint) UnmarshalJSON(data []byte) error {
+func (r AlphaPostTrainingJobStatusResponseCheckpoint) RawJSON() string { return r.JSON.raw }
+func (r *AlphaPostTrainingJobStatusResponseCheckpoint) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Training metrics associated with this checkpoint
-type PostTrainingJobStatusResponseCheckpointTrainingMetrics struct {
+type AlphaPostTrainingJobStatusResponseCheckpointTrainingMetrics struct {
// Training epoch number
Epoch int64 `json:"epoch,required"`
// Perplexity metric indicating model confidence
@@ -251,30 +251,32 @@ type PostTrainingJobStatusResponseCheckpointTrainingMetrics struct {
}
// Returns the unmodified JSON received from the API
-func (r PostTrainingJobStatusResponseCheckpointTrainingMetrics) RawJSON() string { return r.JSON.raw }
-func (r *PostTrainingJobStatusResponseCheckpointTrainingMetrics) UnmarshalJSON(data []byte) error {
+func (r AlphaPostTrainingJobStatusResponseCheckpointTrainingMetrics) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *AlphaPostTrainingJobStatusResponseCheckpointTrainingMetrics) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Current status of the training job
-type PostTrainingJobStatusResponseStatus string
+type AlphaPostTrainingJobStatusResponseStatus string
const (
- PostTrainingJobStatusResponseStatusCompleted PostTrainingJobStatusResponseStatus = "completed"
- PostTrainingJobStatusResponseStatusInProgress PostTrainingJobStatusResponseStatus = "in_progress"
- PostTrainingJobStatusResponseStatusFailed PostTrainingJobStatusResponseStatus = "failed"
- PostTrainingJobStatusResponseStatusScheduled PostTrainingJobStatusResponseStatus = "scheduled"
- PostTrainingJobStatusResponseStatusCancelled PostTrainingJobStatusResponseStatus = "cancelled"
+ AlphaPostTrainingJobStatusResponseStatusCompleted AlphaPostTrainingJobStatusResponseStatus = "completed"
+ AlphaPostTrainingJobStatusResponseStatusInProgress AlphaPostTrainingJobStatusResponseStatus = "in_progress"
+ AlphaPostTrainingJobStatusResponseStatusFailed AlphaPostTrainingJobStatusResponseStatus = "failed"
+ AlphaPostTrainingJobStatusResponseStatusScheduled AlphaPostTrainingJobStatusResponseStatus = "scheduled"
+ AlphaPostTrainingJobStatusResponseStatusCancelled AlphaPostTrainingJobStatusResponseStatus = "cancelled"
)
-// PostTrainingJobStatusResponseResourcesAllocatedUnion contains all possible
+// AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion contains all possible
// properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type PostTrainingJobStatusResponseResourcesAllocatedUnion struct {
+type AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -292,30 +294,32 @@ type PostTrainingJobStatusResponseResourcesAllocatedUnion struct {
} `json:"-"`
}
-func (u PostTrainingJobStatusResponseResourcesAllocatedUnion) AsBool() (v bool) {
+func (u AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u PostTrainingJobStatusResponseResourcesAllocatedUnion) AsFloat() (v float64) {
+func (u AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u PostTrainingJobStatusResponseResourcesAllocatedUnion) AsString() (v string) {
+func (u AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u PostTrainingJobStatusResponseResourcesAllocatedUnion) AsAnyArray() (v []any) {
+func (u AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u PostTrainingJobStatusResponseResourcesAllocatedUnion) RawJSON() string { return u.JSON.raw }
+func (u AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion) RawJSON() string {
+ return u.JSON.raw
+}
-func (r *PostTrainingJobStatusResponseResourcesAllocatedUnion) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingJobStatusResponseResourcesAllocatedUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -351,44 +355,44 @@ func (r *ListPostTrainingJobsResponseData) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PostTrainingJobArtifactsParams struct {
+type AlphaPostTrainingJobArtifactsParams struct {
// The UUID of the job to get the artifacts of.
JobUuid string `query:"job_uuid,required" json:"-"`
paramObj
}
-// URLQuery serializes [PostTrainingJobArtifactsParams]'s query parameters as
+// URLQuery serializes [AlphaPostTrainingJobArtifactsParams]'s query parameters as
// `url.Values`.
-func (r PostTrainingJobArtifactsParams) URLQuery() (v url.Values, err error) {
+func (r AlphaPostTrainingJobArtifactsParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
-type PostTrainingJobCancelParams struct {
+type AlphaPostTrainingJobCancelParams struct {
// The UUID of the job to cancel.
JobUuid string `json:"job_uuid,required"`
paramObj
}
-func (r PostTrainingJobCancelParams) MarshalJSON() (data []byte, err error) {
- type shadow PostTrainingJobCancelParams
+func (r AlphaPostTrainingJobCancelParams) MarshalJSON() (data []byte, err error) {
+ type shadow AlphaPostTrainingJobCancelParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *PostTrainingJobCancelParams) UnmarshalJSON(data []byte) error {
+func (r *AlphaPostTrainingJobCancelParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type PostTrainingJobStatusParams struct {
+type AlphaPostTrainingJobStatusParams struct {
// The UUID of the job to get the status of.
JobUuid string `query:"job_uuid,required" json:"-"`
paramObj
}
-// URLQuery serializes [PostTrainingJobStatusParams]'s query parameters as
+// URLQuery serializes [AlphaPostTrainingJobStatusParams]'s query parameters as
// `url.Values`.
-func (r PostTrainingJobStatusParams) URLQuery() (v url.Values, err error) {
+func (r AlphaPostTrainingJobStatusParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
diff --git a/posttrainingjob_test.go b/alphaposttrainingjob_test.go
similarity index 77%
rename from posttrainingjob_test.go
rename to alphaposttrainingjob_test.go
index 0771c91..d0e32d2 100644
--- a/posttrainingjob_test.go
+++ b/alphaposttrainingjob_test.go
@@ -13,7 +13,7 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestPostTrainingJobList(t *testing.T) {
+func TestAlphaPostTrainingJobList(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -24,7 +24,7 @@ func TestPostTrainingJobList(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.PostTraining.Job.List(context.TODO())
+ _, err := client.Alpha.PostTraining.Job.List(context.TODO())
if err != nil {
var apierr *llamastackclient.Error
if errors.As(err, &apierr) {
@@ -34,7 +34,7 @@ func TestPostTrainingJobList(t *testing.T) {
}
}
-func TestPostTrainingJobArtifacts(t *testing.T) {
+func TestAlphaPostTrainingJobArtifacts(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -45,7 +45,7 @@ func TestPostTrainingJobArtifacts(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.PostTraining.Job.Artifacts(context.TODO(), llamastackclient.PostTrainingJobArtifactsParams{
+ _, err := client.Alpha.PostTraining.Job.Artifacts(context.TODO(), llamastackclient.AlphaPostTrainingJobArtifactsParams{
JobUuid: "job_uuid",
})
if err != nil {
@@ -57,7 +57,7 @@ func TestPostTrainingJobArtifacts(t *testing.T) {
}
}
-func TestPostTrainingJobCancel(t *testing.T) {
+func TestAlphaPostTrainingJobCancel(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -68,7 +68,7 @@ func TestPostTrainingJobCancel(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- err := client.PostTraining.Job.Cancel(context.TODO(), llamastackclient.PostTrainingJobCancelParams{
+ err := client.Alpha.PostTraining.Job.Cancel(context.TODO(), llamastackclient.AlphaPostTrainingJobCancelParams{
JobUuid: "job_uuid",
})
if err != nil {
@@ -80,7 +80,7 @@ func TestPostTrainingJobCancel(t *testing.T) {
}
}
-func TestPostTrainingJobStatus(t *testing.T) {
+func TestAlphaPostTrainingJobStatus(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -91,7 +91,7 @@ func TestPostTrainingJobStatus(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.PostTraining.Job.Status(context.TODO(), llamastackclient.PostTrainingJobStatusParams{
+ _, err := client.Alpha.PostTraining.Job.Status(context.TODO(), llamastackclient.AlphaPostTrainingJobStatusParams{
JobUuid: "job_uuid",
})
if err != nil {
diff --git a/api.md b/api.md
index 82d0472..1e41a11 100644
--- a/api.md
+++ b/api.md
@@ -122,32 +122,6 @@ Methods:
- client.Datasets.Register(ctx context.Context, body llamastackclient.DatasetRegisterParams) (llamastackclient.DatasetRegisterResponse, error)
- client.Datasets.Unregister(ctx context.Context, datasetID string) error
-# Eval
-
-Params Types:
-
-- llamastackclient.BenchmarkConfigParam
-
-Response Types:
-
-- llamastackclient.EvaluateResponse
-- llamastackclient.Job
-
-Methods:
-
-- client.Eval.EvaluateRows(ctx context.Context, benchmarkID string, body llamastackclient.EvalEvaluateRowsParams) (llamastackclient.EvaluateResponse, error)
-- client.Eval.EvaluateRowsAlpha(ctx context.Context, benchmarkID string, body llamastackclient.EvalEvaluateRowsAlphaParams) (llamastackclient.EvaluateResponse, error)
-- client.Eval.RunEval(ctx context.Context, benchmarkID string, body llamastackclient.EvalRunEvalParams) (llamastackclient.Job, error)
-- client.Eval.RunEvalAlpha(ctx context.Context, benchmarkID string, body llamastackclient.EvalRunEvalAlphaParams) (llamastackclient.Job, error)
-
-## Jobs
-
-Methods:
-
-- client.Eval.Jobs.Get(ctx context.Context, jobID string, query llamastackclient.EvalJobGetParams) (llamastackclient.EvaluateResponse, error)
-- client.Eval.Jobs.Cancel(ctx context.Context, jobID string, body llamastackclient.EvalJobCancelParams) error
-- client.Eval.Jobs.Status(ctx context.Context, jobID string, query llamastackclient.EvalJobStatusParams) (llamastackclient.Job, error)
-
# Inspect
Response Types:
@@ -297,36 +271,6 @@ Methods:
- client.Models.OpenAI.List(ctx context.Context) ([]llamastackclient.Model, error)
-# PostTraining
-
-Params Types:
-
-- llamastackclient.AlgorithmConfigUnionParam
-
-Response Types:
-
-- llamastackclient.ListPostTrainingJobsResponse
-- llamastackclient.PostTrainingJob
-
-Methods:
-
-- client.PostTraining.PreferenceOptimize(ctx context.Context, body llamastackclient.PostTrainingPreferenceOptimizeParams) (llamastackclient.PostTrainingJob, error)
-- client.PostTraining.SupervisedFineTune(ctx context.Context, body llamastackclient.PostTrainingSupervisedFineTuneParams) (llamastackclient.PostTrainingJob, error)
-
-## Job
-
-Response Types:
-
-- llamastackclient.PostTrainingJobArtifactsResponse
-- llamastackclient.PostTrainingJobStatusResponse
-
-Methods:
-
-- client.PostTraining.Job.List(ctx context.Context) ([]llamastackclient.ListPostTrainingJobsResponseData, error)
-- client.PostTraining.Job.Artifacts(ctx context.Context, query llamastackclient.PostTrainingJobArtifactsParams) (llamastackclient.PostTrainingJobArtifactsResponse, error)
-- client.PostTraining.Job.Cancel(ctx context.Context, body llamastackclient.PostTrainingJobCancelParams) error
-- client.PostTraining.Job.Status(ctx context.Context, query llamastackclient.PostTrainingJobStatusParams) (llamastackclient.PostTrainingJobStatusResponse, error)
-
# Providers
Response Types:
@@ -491,6 +435,62 @@ Methods:
- client.Alpha.Inference.Rerank(ctx context.Context, body llamastackclient.AlphaInferenceRerankParams) ([]llamastackclient.AlphaInferenceRerankResponse, error)
+## PostTraining
+
+Params Types:
+
+- llamastackclient.AlgorithmConfigUnionParam
+
+Response Types:
+
+- llamastackclient.ListPostTrainingJobsResponse
+- llamastackclient.PostTrainingJob
+
+Methods:
+
+- client.Alpha.PostTraining.PreferenceOptimize(ctx context.Context, body llamastackclient.AlphaPostTrainingPreferenceOptimizeParams) (llamastackclient.PostTrainingJob, error)
+- client.Alpha.PostTraining.SupervisedFineTune(ctx context.Context, body llamastackclient.AlphaPostTrainingSupervisedFineTuneParams) (llamastackclient.PostTrainingJob, error)
+
+### Job
+
+Response Types:
+
+- llamastackclient.AlphaPostTrainingJobArtifactsResponse
+- llamastackclient.AlphaPostTrainingJobStatusResponse
+
+Methods:
+
+- client.Alpha.PostTraining.Job.List(ctx context.Context) ([]llamastackclient.ListPostTrainingJobsResponseData, error)
+- client.Alpha.PostTraining.Job.Artifacts(ctx context.Context, query llamastackclient.AlphaPostTrainingJobArtifactsParams) (llamastackclient.AlphaPostTrainingJobArtifactsResponse, error)
+- client.Alpha.PostTraining.Job.Cancel(ctx context.Context, body llamastackclient.AlphaPostTrainingJobCancelParams) error
+- client.Alpha.PostTraining.Job.Status(ctx context.Context, query llamastackclient.AlphaPostTrainingJobStatusParams) (llamastackclient.AlphaPostTrainingJobStatusResponse, error)
+
+## Eval
+
+Params Types:
+
+- llamastackclient.BenchmarkConfigParam
+
+Response Types:
+
+- llamastackclient.EvaluateResponse
+- llamastackclient.Job
+
+Methods:
+
+- client.Alpha.Eval.EvaluateRows(ctx context.Context, benchmarkID string, body llamastackclient.AlphaEvalEvaluateRowsParams) (llamastackclient.EvaluateResponse, error)
+- client.Alpha.Eval.EvaluateRowsAlpha(ctx context.Context, benchmarkID string, body llamastackclient.AlphaEvalEvaluateRowsAlphaParams) (llamastackclient.EvaluateResponse, error)
+- client.Alpha.Eval.RunEval(ctx context.Context, benchmarkID string, body llamastackclient.AlphaEvalRunEvalParams) (llamastackclient.Job, error)
+- client.Alpha.Eval.RunEvalAlpha(ctx context.Context, benchmarkID string, body llamastackclient.AlphaEvalRunEvalAlphaParams) (llamastackclient.Job, error)
+
+### Jobs
+
+Methods:
+
+- client.Alpha.Eval.Jobs.Get(ctx context.Context, jobID string, query llamastackclient.AlphaEvalJobGetParams) (llamastackclient.EvaluateResponse, error)
+- client.Alpha.Eval.Jobs.Cancel(ctx context.Context, jobID string, body llamastackclient.AlphaEvalJobCancelParams) error
+- client.Alpha.Eval.Jobs.Status(ctx context.Context, jobID string, query llamastackclient.AlphaEvalJobStatusParams) (llamastackclient.Job, error)
+
## Agents
Params Types:
@@ -510,10 +510,10 @@ Response Types:
Methods:
-- client.Alpha.Agents.New(ctx context.Context, body llamastackclient.AlphaAgentNewParams) (llamastackclient.AlphaAgentNewResponse, error)
-- client.Alpha.Agents.Get(ctx context.Context, agentID string) (llamastackclient.AlphaAgentGetResponse, error)
-- client.Alpha.Agents.List(ctx context.Context, query llamastackclient.AlphaAgentListParams) (llamastackclient.AlphaAgentListResponse, error)
-- client.Alpha.Agents.Delete(ctx context.Context, agentID string) error
+- client.Alpha.Agents.New(ctx context.Context, body llamastackclient.AlphaAgentNewParams) (llamastackclient.AlphaAgentNewResponse, error)
+- client.Alpha.Agents.Get(ctx context.Context, agentID string) (llamastackclient.AlphaAgentGetResponse, error)
+- client.Alpha.Agents.List(ctx context.Context, query llamastackclient.AlphaAgentListParams) (llamastackclient.AlphaAgentListResponse, error)
+- client.Alpha.Agents.Delete(ctx context.Context, agentID string) error
### Session
@@ -525,10 +525,10 @@ Response Types:
Methods:
-- client.Alpha.Agents.Session.New(ctx context.Context, agentID string, body llamastackclient.AlphaAgentSessionNewParams) (llamastackclient.AlphaAgentSessionNewResponse, error)
-- client.Alpha.Agents.Session.Get(ctx context.Context, sessionID string, params llamastackclient.AlphaAgentSessionGetParams) (llamastackclient.Session, error)
-- client.Alpha.Agents.Session.List(ctx context.Context, agentID string, query llamastackclient.AlphaAgentSessionListParams) (llamastackclient.AlphaAgentSessionListResponse, error)
-- client.Alpha.Agents.Session.Delete(ctx context.Context, sessionID string, body llamastackclient.AlphaAgentSessionDeleteParams) error
+- client.Alpha.Agents.Session.New(ctx context.Context, agentID string, body llamastackclient.AlphaAgentSessionNewParams) (llamastackclient.AlphaAgentSessionNewResponse, error)
+- client.Alpha.Agents.Session.Get(ctx context.Context, sessionID string, params llamastackclient.AlphaAgentSessionGetParams) (llamastackclient.Session, error)
+- client.Alpha.Agents.Session.List(ctx context.Context, agentID string, query llamastackclient.AlphaAgentSessionListParams) (llamastackclient.AlphaAgentSessionListResponse, error)
+- client.Alpha.Agents.Session.Delete(ctx context.Context, sessionID string, body llamastackclient.AlphaAgentSessionDeleteParams) error
### Steps
@@ -538,7 +538,7 @@ Response Types:
Methods:
-- client.Alpha.Agents.Steps.Get(ctx context.Context, stepID string, query llamastackclient.AlphaAgentStepGetParams) (llamastackclient.AlphaAgentStepGetResponse, error)
+- client.Alpha.Agents.Steps.Get(ctx context.Context, stepID string, query llamastackclient.AlphaAgentStepGetParams) (llamastackclient.AlphaAgentStepGetResponse, error)
### Turn
@@ -550,6 +550,6 @@ Response Types:
Methods:
-- client.Alpha.Agents.Turn.New(ctx context.Context, sessionID string, params llamastackclient.AlphaAgentTurnNewParams) (llamastackclient.Turn, error)
-- client.Alpha.Agents.Turn.Get(ctx context.Context, turnID string, query llamastackclient.AlphaAgentTurnGetParams) (llamastackclient.Turn, error)
-- client.Alpha.Agents.Turn.Resume(ctx context.Context, turnID string, params llamastackclient.AlphaAgentTurnResumeParams) (llamastackclient.Turn, error)
+- client.Alpha.Agents.Turn.New(ctx context.Context, sessionID string, params llamastackclient.AlphaAgentTurnNewParams) (llamastackclient.Turn, error)
+- client.Alpha.Agents.Turn.Get(ctx context.Context, turnID string, query llamastackclient.AlphaAgentTurnGetParams) (llamastackclient.Turn, error)
+- client.Alpha.Agents.Turn.Resume(ctx context.Context, turnID string, params llamastackclient.AlphaAgentTurnResumeParams) (llamastackclient.Turn, error)
diff --git a/client.go b/client.go
index e9b99de..212cf91 100644
--- a/client.go
+++ b/client.go
@@ -22,7 +22,6 @@ type Client struct {
ToolRuntime ToolRuntimeService
Responses ResponseService
Datasets DatasetService
- Eval EvalService
Inspect InspectService
Embeddings EmbeddingService
Chat ChatService
@@ -31,7 +30,6 @@ type Client struct {
VectorDBs VectorDBService
VectorStores VectorStoreService
Models ModelService
- PostTraining PostTrainingService
Providers ProviderService
Routes RouteService
Moderations ModerationService
@@ -73,7 +71,6 @@ func NewClient(opts ...option.RequestOption) (r Client) {
r.ToolRuntime = NewToolRuntimeService(opts...)
r.Responses = NewResponseService(opts...)
r.Datasets = NewDatasetService(opts...)
- r.Eval = NewEvalService(opts...)
r.Inspect = NewInspectService(opts...)
r.Embeddings = NewEmbeddingService(opts...)
r.Chat = NewChatService(opts...)
@@ -82,7 +79,6 @@ func NewClient(opts ...option.RequestOption) (r Client) {
r.VectorDBs = NewVectorDBService(opts...)
r.VectorStores = NewVectorStoreService(opts...)
r.Models = NewModelService(opts...)
- r.PostTraining = NewPostTrainingService(opts...)
r.Providers = NewProviderService(opts...)
r.Routes = NewRouteService(opts...)
r.Moderations = NewModerationService(opts...)
From c9da41734d782e758971ca2f5b9821669dbd7331 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 30 Sep 2025 22:45:34 +0000
Subject: [PATCH 27/33] feat(api): fix file batches SDK to list_files
---
.stats.yml | 2 +-
api.md | 2 +-
vectorstorefilebatch.go | 54 ++++++++++++++++++------------------
vectorstorefilebatch_test.go | 22 +++++++--------
4 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 448f905..436151e 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 109
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
-config_hash: d8706905bf16d9e4141e88d5a778263b
+config_hash: 0412cd40c0609550c1a47c69dd104e4f
diff --git a/api.md b/api.md
index 1e41a11..e4617a4 100644
--- a/api.md
+++ b/api.md
@@ -248,8 +248,8 @@ Methods:
- client.VectorStores.FileBatches.New(ctx context.Context, vectorStoreID string, body llamastackclient.VectorStoreFileBatchNewParams) (llamastackclient.VectorStoreFileBatches, error)
- client.VectorStores.FileBatches.Get(ctx context.Context, batchID string, query llamastackclient.VectorStoreFileBatchGetParams) (llamastackclient.VectorStoreFileBatches, error)
-- client.VectorStores.FileBatches.List(ctx context.Context, batchID string, params llamastackclient.VectorStoreFileBatchListParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
- client.VectorStores.FileBatches.Cancel(ctx context.Context, batchID string, body llamastackclient.VectorStoreFileBatchCancelParams) (llamastackclient.VectorStoreFileBatches, error)
+- client.VectorStores.FileBatches.ListFiles(ctx context.Context, batchID string, params llamastackclient.VectorStoreFileBatchListFilesParams) (pagination.OpenAICursorPage[llamastackclient.VectorStoreFile], error)
# Models
diff --git a/vectorstorefilebatch.go b/vectorstorefilebatch.go
index 48cc9e4..2982d33 100644
--- a/vectorstorefilebatch.go
+++ b/vectorstorefilebatch.go
@@ -67,8 +67,24 @@ func (r *VectorStoreFileBatchService) Get(ctx context.Context, batchID string, q
return
}
+// Cancels a vector store file batch.
+func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, batchID string, body VectorStoreFileBatchCancelParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if body.VectorStoreID == "" {
+ err = errors.New("missing required vector_store_id parameter")
+ return
+ }
+ if batchID == "" {
+ err = errors.New("missing required batch_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s/cancel", body.VectorStoreID, batchID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
+ return
+}
+
// Returns a list of vector store files in a batch.
-func (r *VectorStoreFileBatchService) List(ctx context.Context, batchID string, params VectorStoreFileBatchListParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStoreFile], err error) {
+func (r *VectorStoreFileBatchService) ListFiles(ctx context.Context, batchID string, params VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) (res *pagination.OpenAICursorPage[VectorStoreFile], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
@@ -94,24 +110,8 @@ func (r *VectorStoreFileBatchService) List(ctx context.Context, batchID string,
}
// Returns a list of vector store files in a batch.
-func (r *VectorStoreFileBatchService) ListAutoPaging(ctx context.Context, batchID string, params VectorStoreFileBatchListParams, opts ...option.RequestOption) *pagination.OpenAICursorPageAutoPager[VectorStoreFile] {
- return pagination.NewOpenAICursorPageAutoPager(r.List(ctx, batchID, params, opts...))
-}
-
-// Cancels a vector store file batch.
-func (r *VectorStoreFileBatchService) Cancel(ctx context.Context, batchID string, body VectorStoreFileBatchCancelParams, opts ...option.RequestOption) (res *VectorStoreFileBatches, err error) {
- opts = slices.Concat(r.Options, opts)
- if body.VectorStoreID == "" {
- err = errors.New("missing required vector_store_id parameter")
- return
- }
- if batchID == "" {
- err = errors.New("missing required batch_id parameter")
- return
- }
- path := fmt.Sprintf("v1/vector_stores/%s/file_batches/%s/cancel", body.VectorStoreID, batchID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
- return
+func (r *VectorStoreFileBatchService) ListFilesAutoPaging(ctx context.Context, batchID string, params VectorStoreFileBatchListFilesParams, opts ...option.RequestOption) *pagination.OpenAICursorPageAutoPager[VectorStoreFile] {
+ return pagination.NewOpenAICursorPageAutoPager(r.ListFiles(ctx, batchID, params, opts...))
}
// Response from listing files in a vector store file batch.
@@ -388,7 +388,12 @@ type VectorStoreFileBatchGetParams struct {
paramObj
}
-type VectorStoreFileBatchListParams struct {
+type VectorStoreFileBatchCancelParams struct {
+ VectorStoreID string `path:"vector_store_id,required" json:"-"`
+ paramObj
+}
+
+type VectorStoreFileBatchListFilesParams struct {
VectorStoreID string `path:"vector_store_id,required" json:"-"`
// A cursor for use in pagination. `after` is an object ID that defines your place
// in the list.
@@ -407,16 +412,11 @@ type VectorStoreFileBatchListParams struct {
paramObj
}
-// URLQuery serializes [VectorStoreFileBatchListParams]'s query parameters as
+// URLQuery serializes [VectorStoreFileBatchListFilesParams]'s query parameters as
// `url.Values`.
-func (r VectorStoreFileBatchListParams) URLQuery() (v url.Values, err error) {
+func (r VectorStoreFileBatchListFilesParams) URLQuery() (v url.Values, err error) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatComma,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
-
-type VectorStoreFileBatchCancelParams struct {
- VectorStoreID string `path:"vector_store_id,required" json:"-"`
- paramObj
-}
diff --git a/vectorstorefilebatch_test.go b/vectorstorefilebatch_test.go
index 7842ea9..9861098 100644
--- a/vectorstorefilebatch_test.go
+++ b/vectorstorefilebatch_test.go
@@ -75,7 +75,7 @@ func TestVectorStoreFileBatchGet(t *testing.T) {
}
}
-func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
+func TestVectorStoreFileBatchCancel(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -86,16 +86,11 @@ func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.VectorStores.FileBatches.List(
+ _, err := client.VectorStores.FileBatches.Cancel(
context.TODO(),
"batch_id",
- llamastackclient.VectorStoreFileBatchListParams{
+ llamastackclient.VectorStoreFileBatchCancelParams{
VectorStoreID: "vector_store_id",
- After: llamastackclient.String("after"),
- Before: llamastackclient.String("before"),
- Filter: llamastackclient.String("filter"),
- Limit: llamastackclient.Int(0),
- Order: llamastackclient.String("order"),
},
)
if err != nil {
@@ -107,7 +102,7 @@ func TestVectorStoreFileBatchListWithOptionalParams(t *testing.T) {
}
}
-func TestVectorStoreFileBatchCancel(t *testing.T) {
+func TestVectorStoreFileBatchListFilesWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -118,11 +113,16 @@ func TestVectorStoreFileBatchCancel(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- _, err := client.VectorStores.FileBatches.Cancel(
+ _, err := client.VectorStores.FileBatches.ListFiles(
context.TODO(),
"batch_id",
- llamastackclient.VectorStoreFileBatchCancelParams{
+ llamastackclient.VectorStoreFileBatchListFilesParams{
VectorStoreID: "vector_store_id",
+ After: llamastackclient.String("after"),
+ Before: llamastackclient.String("before"),
+ Filter: llamastackclient.String("filter"),
+ Limit: llamastackclient.Int(0),
+ Order: llamastackclient.String("order"),
},
)
if err != nil {
From a16eaef870f6ec94ae6adf36eed0d65bfa9fd3b8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 1 Oct 2025 21:27:57 +0000
Subject: [PATCH 28/33] feat(api)!: use input_schema instead of parameters for
tools
---
.stats.yml | 4 +-
alphaagent_test.go | 17 +-
response.go | 418 +++++++++++++++++++++++++++++++----
responseinputitem.go | 118 ++++++++--
shared/constant/constants.go | 6 +
tool.go | 121 +++++-----
toolruntime.go | 193 +++++++++-------
7 files changed, 661 insertions(+), 216 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 436151e..d9b62ff 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 109
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
-openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-5f0f0b99d1b0bf40e00e11f5d134ed13de97799cf2dfea0c8612e2f003584505.yml
+openapi_spec_hash: 5f51544cb340c37aba54b93a526c536e
config_hash: 0412cd40c0609550c1a47c69dd104e4f
diff --git a/alphaagent_test.go b/alphaagent_test.go
index 4fefd68..06751f9 100644
--- a/alphaagent_test.go
+++ b/alphaagent_test.go
@@ -31,22 +31,21 @@ func TestAlphaAgentNewWithOptionalParams(t *testing.T) {
ClientTools: []llamastackclient.ToolDefParam{{
Name: "name",
Description: llamastackclient.String("description"),
+ InputSchema: map[string]llamastackclient.ToolDefInputSchemaUnionParam{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ },
Metadata: map[string]llamastackclient.ToolDefMetadataUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
- Parameters: []llamastackclient.ToolDefParameterParam{{
- Description: "description",
- Name: "name",
- ParameterType: "parameter_type",
- Required: true,
- Default: llamastackclient.ToolDefParameterDefaultUnionParam{
+ OutputSchema: map[string]llamastackclient.ToolDefOutputSchemaUnionParam{
+ "foo": {
OfBool: llamastackclient.Bool(true),
},
- Items: map[string]interface{}{},
- Title: llamastackclient.String("title"),
- }},
+ },
}},
EnableSessionPersistence: llamastackclient.Bool(true),
InputShields: []string{"string"},
diff --git a/response.go b/response.go
index 2038c62..37ce156 100644
--- a/response.go
+++ b/response.go
@@ -168,7 +168,8 @@ func (r *ResponseObject) UnmarshalJSON(data []byte) error {
// ResponseObjectOutputUnion contains all possible properties and values from
// [ResponseObjectOutputMessage], [ResponseObjectOutputWebSearchCall],
// [ResponseObjectOutputFileSearchCall], [ResponseObjectOutputFunctionCall],
-// [ResponseObjectOutputMcpCall], [ResponseObjectOutputMcpListTools].
+// [ResponseObjectOutputMcpCall], [ResponseObjectOutputMcpListTools],
+// [ResponseObjectOutputMcpApprovalRequest].
//
// Use the [ResponseObjectOutputUnion.AsAny] method to switch on the variant.
//
@@ -179,7 +180,7 @@ type ResponseObjectOutputUnion struct {
// This field is from variant [ResponseObjectOutputMessage].
Role ResponseObjectOutputMessageRole `json:"role"`
// Any of "message", "web_search_call", "file_search_call", "function_call",
- // "mcp_call", "mcp_list_tools".
+ // "mcp_call", "mcp_list_tools", "mcp_approval_request".
Type string `json:"type"`
ID string `json:"id"`
Status string `json:"status"`
@@ -224,12 +225,13 @@ type anyResponseObjectOutput interface {
implResponseObjectOutputUnion()
}
-func (ResponseObjectOutputMessage) implResponseObjectOutputUnion() {}
-func (ResponseObjectOutputWebSearchCall) implResponseObjectOutputUnion() {}
-func (ResponseObjectOutputFileSearchCall) implResponseObjectOutputUnion() {}
-func (ResponseObjectOutputFunctionCall) implResponseObjectOutputUnion() {}
-func (ResponseObjectOutputMcpCall) implResponseObjectOutputUnion() {}
-func (ResponseObjectOutputMcpListTools) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputMessage) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputWebSearchCall) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputFileSearchCall) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputFunctionCall) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputMcpCall) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputMcpListTools) implResponseObjectOutputUnion() {}
+func (ResponseObjectOutputMcpApprovalRequest) implResponseObjectOutputUnion() {}
// Use the following switch statement to find the correct variant
//
@@ -240,6 +242,7 @@ func (ResponseObjectOutputMcpListTools) implResponseObjectOutputUnion() {}
// case llamastackclient.ResponseObjectOutputFunctionCall:
// case llamastackclient.ResponseObjectOutputMcpCall:
// case llamastackclient.ResponseObjectOutputMcpListTools:
+// case llamastackclient.ResponseObjectOutputMcpApprovalRequest:
// default:
// fmt.Errorf("no variant present")
// }
@@ -257,6 +260,8 @@ func (u ResponseObjectOutputUnion) AsAny() anyResponseObjectOutput {
return u.AsMcpCall()
case "mcp_list_tools":
return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
}
return nil
}
@@ -291,6 +296,11 @@ func (u ResponseObjectOutputUnion) AsMcpListTools() (v ResponseObjectOutputMcpLi
return
}
+func (u ResponseObjectOutputUnion) AsMcpApprovalRequest() (v ResponseObjectOutputMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ResponseObjectOutputUnion) RawJSON() string { return u.JSON.raw }
@@ -1075,6 +1085,31 @@ func (r *ResponseObjectOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(dat
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+type ResponseObjectOutputMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseObjectOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *ResponseObjectOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ResponseObjectOutputRole string
const (
@@ -1742,7 +1777,8 @@ func (r *ResponseObjectStreamResponseOutputItemAdded) UnmarshalJSON(data []byte)
// [ResponseObjectStreamResponseOutputItemAddedItemFileSearchCall],
// [ResponseObjectStreamResponseOutputItemAddedItemFunctionCall],
// [ResponseObjectStreamResponseOutputItemAddedItemMcpCall],
-// [ResponseObjectStreamResponseOutputItemAddedItemMcpListTools].
+// [ResponseObjectStreamResponseOutputItemAddedItemMcpListTools],
+// [ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest].
//
// Use the [ResponseObjectStreamResponseOutputItemAddedItemUnion.AsAny] method to
// switch on the variant.
@@ -1756,7 +1792,7 @@ type ResponseObjectStreamResponseOutputItemAddedItemUnion struct {
// [ResponseObjectStreamResponseOutputItemAddedItemMessage].
Role ResponseObjectStreamResponseOutputItemAddedItemMessageRole `json:"role"`
// Any of "message", "web_search_call", "file_search_call", "function_call",
- // "mcp_call", "mcp_list_tools".
+ // "mcp_call", "mcp_list_tools", "mcp_approval_request".
Type string `json:"type"`
ID string `json:"id"`
Status string `json:"status"`
@@ -1820,6 +1856,8 @@ func (ResponseObjectStreamResponseOutputItemAddedItemMcpCall) implResponseObject
}
func (ResponseObjectStreamResponseOutputItemAddedItemMcpListTools) implResponseObjectStreamResponseOutputItemAddedItemUnion() {
}
+func (ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest) implResponseObjectStreamResponseOutputItemAddedItemUnion() {
+}
// Use the following switch statement to find the correct variant
//
@@ -1830,6 +1868,7 @@ func (ResponseObjectStreamResponseOutputItemAddedItemMcpListTools) implResponseO
// case llamastackclient.ResponseObjectStreamResponseOutputItemAddedItemFunctionCall:
// case llamastackclient.ResponseObjectStreamResponseOutputItemAddedItemMcpCall:
// case llamastackclient.ResponseObjectStreamResponseOutputItemAddedItemMcpListTools:
+// case llamastackclient.ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest:
// default:
// fmt.Errorf("no variant present")
// }
@@ -1847,6 +1886,8 @@ func (u ResponseObjectStreamResponseOutputItemAddedItemUnion) AsAny() anyRespons
return u.AsMcpCall()
case "mcp_list_tools":
return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
}
return nil
}
@@ -1881,6 +1922,11 @@ func (u ResponseObjectStreamResponseOutputItemAddedItemUnion) AsMcpListTools() (
return
}
+func (u ResponseObjectStreamResponseOutputItemAddedItemUnion) AsMcpApprovalRequest() (v ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ResponseObjectStreamResponseOutputItemAddedItemUnion) RawJSON() string { return u.JSON.raw }
@@ -2702,6 +2748,33 @@ func (r *ResponseObjectStreamResponseOutputItemAddedItemMcpListToolsToolInputSch
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+type ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseObjectStreamResponseOutputItemAddedItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ResponseObjectStreamResponseOutputItemAddedItemRole string
const (
@@ -2748,7 +2821,8 @@ func (r *ResponseObjectStreamResponseOutputItemDone) UnmarshalJSON(data []byte)
// [ResponseObjectStreamResponseOutputItemDoneItemFileSearchCall],
// [ResponseObjectStreamResponseOutputItemDoneItemFunctionCall],
// [ResponseObjectStreamResponseOutputItemDoneItemMcpCall],
-// [ResponseObjectStreamResponseOutputItemDoneItemMcpListTools].
+// [ResponseObjectStreamResponseOutputItemDoneItemMcpListTools],
+// [ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest].
//
// Use the [ResponseObjectStreamResponseOutputItemDoneItemUnion.AsAny] method to
// switch on the variant.
@@ -2762,7 +2836,7 @@ type ResponseObjectStreamResponseOutputItemDoneItemUnion struct {
// [ResponseObjectStreamResponseOutputItemDoneItemMessage].
Role ResponseObjectStreamResponseOutputItemDoneItemMessageRole `json:"role"`
// Any of "message", "web_search_call", "file_search_call", "function_call",
- // "mcp_call", "mcp_list_tools".
+ // "mcp_call", "mcp_list_tools", "mcp_approval_request".
Type string `json:"type"`
ID string `json:"id"`
Status string `json:"status"`
@@ -2825,6 +2899,8 @@ func (ResponseObjectStreamResponseOutputItemDoneItemMcpCall) implResponseObjectS
}
func (ResponseObjectStreamResponseOutputItemDoneItemMcpListTools) implResponseObjectStreamResponseOutputItemDoneItemUnion() {
}
+func (ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest) implResponseObjectStreamResponseOutputItemDoneItemUnion() {
+}
// Use the following switch statement to find the correct variant
//
@@ -2835,6 +2911,7 @@ func (ResponseObjectStreamResponseOutputItemDoneItemMcpListTools) implResponseOb
// case llamastackclient.ResponseObjectStreamResponseOutputItemDoneItemFunctionCall:
// case llamastackclient.ResponseObjectStreamResponseOutputItemDoneItemMcpCall:
// case llamastackclient.ResponseObjectStreamResponseOutputItemDoneItemMcpListTools:
+// case llamastackclient.ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest:
// default:
// fmt.Errorf("no variant present")
// }
@@ -2852,6 +2929,8 @@ func (u ResponseObjectStreamResponseOutputItemDoneItemUnion) AsAny() anyResponse
return u.AsMcpCall()
case "mcp_list_tools":
return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
}
return nil
}
@@ -2886,6 +2965,11 @@ func (u ResponseObjectStreamResponseOutputItemDoneItemUnion) AsMcpListTools() (v
return
}
+func (u ResponseObjectStreamResponseOutputItemDoneItemUnion) AsMcpApprovalRequest() (v ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ResponseObjectStreamResponseOutputItemDoneItemUnion) RawJSON() string { return u.JSON.raw }
@@ -3707,6 +3791,33 @@ func (r *ResponseObjectStreamResponseOutputItemDoneItemMcpListToolsToolInputSche
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+type ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseObjectStreamResponseOutputItemDoneItemMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ResponseObjectStreamResponseOutputItemDoneItemRole string
const (
@@ -4456,6 +4567,8 @@ func (r *ResponseListResponse) UnmarshalJSON(data []byte) error {
// [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall],
// [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall],
// [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput],
+// [ResponseListResponseInputOpenAIResponseMcpApprovalRequest],
+// [ResponseListResponseInputOpenAIResponseMcpApprovalResponse],
// [ResponseListResponseInputOpenAIResponseMessage].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
@@ -4468,34 +4581,46 @@ type ResponseListResponseInputUnion struct {
Queries []string `json:"queries"`
// This field is from variant
// [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
- Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall].
- Arguments string `json:"arguments"`
- CallID string `json:"call_id"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall].
- Name string `json:"name"`
+ Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
// This field is from variant
// [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput].
Output string `json:"output"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalRequest].
+ ServerLabel string `json:"server_label"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ ApprovalRequestID string `json:"approval_request_id"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ Approve bool `json:"approve"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ Reason string `json:"reason"`
// This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content"`
// This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role"`
JSON struct {
- ID respjson.Field
- Status respjson.Field
- Type respjson.Field
- Queries respjson.Field
- Results respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- Output respjson.Field
- Content respjson.Field
- Role respjson.Field
- raw string
+ ID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Output respjson.Field
+ ServerLabel respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Reason respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ raw string
} `json:"-"`
}
@@ -4519,6 +4644,16 @@ func (u ResponseListResponseInputUnion) AsOpenAIResponseInputFunctionToolCallOut
return
}
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseListResponseInputOpenAIResponseMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseListResponseInputOpenAIResponseMcpApprovalResponse) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseListResponseInputUnion) AsOpenAIResponseMessage() (v ResponseListResponseInputOpenAIResponseMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -4739,6 +4874,60 @@ func (r *ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) Unm
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+type ResponseListResponseInputOpenAIResponseMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+type ResponseListResponseInputOpenAIResponseMcpApprovalResponse struct {
+ ApprovalRequestID string `json:"approval_request_id,required"`
+ Approve bool `json:"approve,required"`
+ Type constant.McpApprovalResponse `json:"type,required"`
+ ID string `json:"id"`
+ Reason string `json:"reason"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
@@ -5240,7 +5429,8 @@ const (
// [ResponseListResponseOutputMessage], [ResponseListResponseOutputWebSearchCall],
// [ResponseListResponseOutputFileSearchCall],
// [ResponseListResponseOutputFunctionCall], [ResponseListResponseOutputMcpCall],
-// [ResponseListResponseOutputMcpListTools].
+// [ResponseListResponseOutputMcpListTools],
+// [ResponseListResponseOutputMcpApprovalRequest].
//
// Use the [ResponseListResponseOutputUnion.AsAny] method to switch on the variant.
//
@@ -5251,7 +5441,7 @@ type ResponseListResponseOutputUnion struct {
// This field is from variant [ResponseListResponseOutputMessage].
Role ResponseListResponseOutputMessageRole `json:"role"`
// Any of "message", "web_search_call", "file_search_call", "function_call",
- // "mcp_call", "mcp_list_tools".
+ // "mcp_call", "mcp_list_tools", "mcp_approval_request".
Type string `json:"type"`
ID string `json:"id"`
Status string `json:"status"`
@@ -5296,12 +5486,13 @@ type anyResponseListResponseOutput interface {
implResponseListResponseOutputUnion()
}
-func (ResponseListResponseOutputMessage) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputWebSearchCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputFileSearchCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputFunctionCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMessage) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputWebSearchCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputFileSearchCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputFunctionCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpApprovalRequest) implResponseListResponseOutputUnion() {}
// Use the following switch statement to find the correct variant
//
@@ -5312,6 +5503,7 @@ func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnio
// case llamastackclient.ResponseListResponseOutputFunctionCall:
// case llamastackclient.ResponseListResponseOutputMcpCall:
// case llamastackclient.ResponseListResponseOutputMcpListTools:
+// case llamastackclient.ResponseListResponseOutputMcpApprovalRequest:
// default:
// fmt.Errorf("no variant present")
// }
@@ -5329,6 +5521,8 @@ func (u ResponseListResponseOutputUnion) AsAny() anyResponseListResponseOutput {
return u.AsMcpCall()
case "mcp_list_tools":
return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
}
return nil
}
@@ -5363,6 +5557,11 @@ func (u ResponseListResponseOutputUnion) AsMcpListTools() (v ResponseListRespons
return
}
+func (u ResponseListResponseOutputUnion) AsMcpApprovalRequest() (v ResponseListResponseOutputMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
// Returns the unmodified JSON received from the API
func (u ResponseListResponseOutputUnion) RawJSON() string { return u.JSON.raw }
@@ -6159,6 +6358,31 @@ func (r *ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) UnmarshalJS
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+type ResponseListResponseOutputMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ResponseListResponseOutputRole string
const (
@@ -6388,6 +6612,8 @@ type ResponseNewParamsInputArrayItemUnion struct {
OfOpenAIResponseOutputMessageFileSearchToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall `json:",omitzero,inline"`
OfOpenAIResponseOutputMessageFunctionToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall `json:",omitzero,inline"`
OfOpenAIResponseInputFunctionToolCallOutput *ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput `json:",omitzero,inline"`
+ OfOpenAIResponseMcpApprovalRequest *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest `json:",omitzero,inline"`
+ OfOpenAIResponseMcpApprovalResponse *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse `json:",omitzero,inline"`
OfOpenAIResponseMessage *ResponseNewParamsInputArrayItemOpenAIResponseMessage `json:",omitzero,inline"`
paramUnion
}
@@ -6397,6 +6623,8 @@ func (u ResponseNewParamsInputArrayItemUnion) MarshalJSON() ([]byte, error) {
u.OfOpenAIResponseOutputMessageFileSearchToolCall,
u.OfOpenAIResponseOutputMessageFunctionToolCall,
u.OfOpenAIResponseInputFunctionToolCallOutput,
+ u.OfOpenAIResponseMcpApprovalRequest,
+ u.OfOpenAIResponseMcpApprovalResponse,
u.OfOpenAIResponseMessage)
}
func (u *ResponseNewParamsInputArrayItemUnion) UnmarshalJSON(data []byte) error {
@@ -6412,6 +6640,10 @@ func (u *ResponseNewParamsInputArrayItemUnion) asAny() any {
return u.OfOpenAIResponseOutputMessageFunctionToolCall
} else if !param.IsOmitted(u.OfOpenAIResponseInputFunctionToolCallOutput) {
return u.OfOpenAIResponseInputFunctionToolCallOutput
+ } else if !param.IsOmitted(u.OfOpenAIResponseMcpApprovalRequest) {
+ return u.OfOpenAIResponseMcpApprovalRequest
+ } else if !param.IsOmitted(u.OfOpenAIResponseMcpApprovalResponse) {
+ return u.OfOpenAIResponseMcpApprovalResponse
} else if !param.IsOmitted(u.OfOpenAIResponseMessage) {
return u.OfOpenAIResponseMessage
}
@@ -6435,25 +6667,41 @@ func (u ResponseNewParamsInputArrayItemUnion) GetResults() []ResponseNewParamsIn
}
// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetArguments() *string {
- if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
- return &vt.Arguments
+func (u ResponseNewParamsInputArrayItemUnion) GetOutput() *string {
+ if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
+ return &vt.Output
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetName() *string {
- if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
- return &vt.Name
+func (u ResponseNewParamsInputArrayItemUnion) GetServerLabel() *string {
+ if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return &vt.ServerLabel
}
return nil
}
// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetOutput() *string {
- if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
- return &vt.Output
+func (u ResponseNewParamsInputArrayItemUnion) GetApprovalRequestID() *string {
+ if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
+ return &vt.ApprovalRequestID
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetApprove() *bool {
+ if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
+ return &vt.Approve
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetReason() *string {
+ if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil && vt.Reason.Valid() {
+ return &vt.Reason.Value
}
return nil
}
@@ -6484,6 +6732,10 @@ func (u ResponseNewParamsInputArrayItemUnion) GetID() *string {
return &vt.ID.Value
} else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil && vt.ID.Valid() {
return &vt.ID.Value
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
} else if vt := u.OfOpenAIResponseMessage; vt != nil && vt.ID.Valid() {
return &vt.ID.Value
}
@@ -6516,12 +6768,26 @@ func (u ResponseNewParamsInputArrayItemUnion) GetType() *string {
return (*string)(&vt.Type)
} else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
+ return (*string)(&vt.Type)
} else if vt := u.OfOpenAIResponseMessage; vt != nil {
return (*string)(&vt.Type)
}
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetArguments() *string {
+ if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
+ return (*string)(&vt.Arguments)
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Arguments)
+ }
+ return nil
+}
+
// Returns a pointer to the underlying variant's property, if present.
func (u ResponseNewParamsInputArrayItemUnion) GetCallID() *string {
if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
@@ -6532,6 +6798,16 @@ func (u ResponseNewParamsInputArrayItemUnion) GetCallID() *string {
return nil
}
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetName() *string {
+ if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
+}
+
// Web search tool call output message for OpenAI responses.
//
// The properties ID, Status, Type are required.
@@ -6690,6 +6966,50 @@ func (r *ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutpu
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+//
+// The properties ID, Arguments, Name, ServerLabel, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ // This field can be elided, and will marshal its zero value as
+ // "mcp_approval_request".
+ Type constant.McpApprovalRequest `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+//
+// The properties ApprovalRequestID, Approve, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse struct {
+ ApprovalRequestID string `json:"approval_request_id,required"`
+ Approve bool `json:"approve,required"`
+ ID param.Opt[string] `json:"id,omitzero"`
+ Reason param.Opt[string] `json:"reason,omitzero"`
+ // This field can be elided, and will marshal its zero value as
+ // "mcp_approval_response".
+ Type constant.McpApprovalResponse `json:"type,required"`
+ paramObj
+}
+
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
diff --git a/responseinputitem.go b/responseinputitem.go
index b708ae3..8ca9295 100644
--- a/responseinputitem.go
+++ b/responseinputitem.go
@@ -78,6 +78,8 @@ func (r *ResponseInputItemListResponse) UnmarshalJSON(data []byte) error {
// [ResponseInputItemListResponseDataOpenAIResponseOutputMessageFileSearchToolCall],
// [ResponseInputItemListResponseDataOpenAIResponseOutputMessageFunctionToolCall],
// [ResponseInputItemListResponseDataOpenAIResponseInputFunctionToolCallOutput],
+// [ResponseInputItemListResponseDataOpenAIResponseMcpApprovalRequest],
+// [ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse],
// [ResponseInputItemListResponseDataOpenAIResponseMessage].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
@@ -90,36 +92,48 @@ type ResponseInputItemListResponseDataUnion struct {
Queries []string `json:"queries"`
// This field is from variant
// [ResponseInputItemListResponseDataOpenAIResponseOutputMessageFileSearchToolCall].
- Results []ResponseInputItemListResponseDataOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
- // This field is from variant
- // [ResponseInputItemListResponseDataOpenAIResponseOutputMessageFunctionToolCall].
- Arguments string `json:"arguments"`
- CallID string `json:"call_id"`
- // This field is from variant
- // [ResponseInputItemListResponseDataOpenAIResponseOutputMessageFunctionToolCall].
- Name string `json:"name"`
+ Results []ResponseInputItemListResponseDataOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
// This field is from variant
// [ResponseInputItemListResponseDataOpenAIResponseInputFunctionToolCallOutput].
Output string `json:"output"`
// This field is from variant
+ // [ResponseInputItemListResponseDataOpenAIResponseMcpApprovalRequest].
+ ServerLabel string `json:"server_label"`
+ // This field is from variant
+ // [ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse].
+ ApprovalRequestID string `json:"approval_request_id"`
+ // This field is from variant
+ // [ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse].
+ Approve bool `json:"approve"`
+ // This field is from variant
+ // [ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse].
+ Reason string `json:"reason"`
+ // This field is from variant
// [ResponseInputItemListResponseDataOpenAIResponseMessage].
Content ResponseInputItemListResponseDataOpenAIResponseMessageContentUnion `json:"content"`
// This field is from variant
// [ResponseInputItemListResponseDataOpenAIResponseMessage].
Role ResponseInputItemListResponseDataOpenAIResponseMessageRole `json:"role"`
JSON struct {
- ID respjson.Field
- Status respjson.Field
- Type respjson.Field
- Queries respjson.Field
- Results respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- Output respjson.Field
- Content respjson.Field
- Role respjson.Field
- raw string
+ ID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Output respjson.Field
+ ServerLabel respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Reason respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ raw string
} `json:"-"`
}
@@ -143,6 +157,16 @@ func (u ResponseInputItemListResponseDataUnion) AsOpenAIResponseInputFunctionToo
return
}
+func (u ResponseInputItemListResponseDataUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseInputItemListResponseDataOpenAIResponseMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseInputItemListResponseDataUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
func (u ResponseInputItemListResponseDataUnion) AsOpenAIResponseMessage() (v ResponseInputItemListResponseDataOpenAIResponseMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
@@ -363,6 +387,60 @@ func (r *ResponseInputItemListResponseDataOpenAIResponseInputFunctionToolCallOut
return apijson.UnmarshalRoot(data, r)
}
+// A request for human approval of a tool invocation.
+type ResponseInputItemListResponseDataOpenAIResponseMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemListResponseDataOpenAIResponseMcpApprovalRequest) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseInputItemListResponseDataOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A response to an MCP approval request.
+type ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse struct {
+ ApprovalRequestID string `json:"approval_request_id,required"`
+ Approve bool `json:"approve,required"`
+ Type constant.McpApprovalResponse `json:"type,required"`
+ ID string `json:"id"`
+ Reason string `json:"reason"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseInputItemListResponseDataOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index 3d4d419..8666cd4 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -59,6 +59,8 @@ type Llm string // Always "llm"
type LlmAsJudge string // Always "llm_as_judge"
type LoRa string // Always "LoRA"
type Mcp string // Always "mcp"
+type McpApprovalRequest string // Always "mcp_approval_request"
+type McpApprovalResponse string // Always "mcp_approval_response"
type McpCall string // Always "mcp_call"
type McpListTools string // Always "mcp_list_tools"
type MemoryRetrieval string // Always "memory_retrieval"
@@ -168,6 +170,8 @@ func (c Llm) Default() Llm { return "llm" }
func (c LlmAsJudge) Default() LlmAsJudge { return "llm_as_judge" }
func (c LoRa) Default() LoRa { return "LoRA" }
func (c Mcp) Default() Mcp { return "mcp" }
+func (c McpApprovalRequest) Default() McpApprovalRequest { return "mcp_approval_request" }
+func (c McpApprovalResponse) Default() McpApprovalResponse { return "mcp_approval_response" }
func (c McpCall) Default() McpCall { return "mcp_call" }
func (c McpListTools) Default() McpListTools { return "mcp_list_tools" }
func (c MemoryRetrieval) Default() MemoryRetrieval { return "memory_retrieval" }
@@ -309,6 +313,8 @@ func (c Llm) MarshalJSON() ([]byte, error) { retu
func (c LlmAsJudge) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c LoRa) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Mcp) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpApprovalRequest) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c McpApprovalResponse) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpListTools) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c MemoryRetrieval) MarshalJSON() ([]byte, error) { return marshalString(c) }
diff --git a/tool.go b/tool.go
index adc6ac2..d2bbc35 100644
--- a/tool.go
+++ b/tool.go
@@ -87,25 +87,28 @@ type Tool struct {
// Human-readable description of what the tool does
Description string `json:"description,required"`
Identifier string `json:"identifier,required"`
- // List of parameters this tool accepts
- Parameters []ToolParameter `json:"parameters,required"`
- ProviderID string `json:"provider_id,required"`
+ ProviderID string `json:"provider_id,required"`
// ID of the tool group this tool belongs to
ToolgroupID string `json:"toolgroup_id,required"`
// Type of resource, always 'tool'
Type constant.Tool `json:"type,required"`
+ // JSON Schema for the tool's input parameters
+ InputSchema map[string]ToolInputSchemaUnion `json:"input_schema"`
// (Optional) Additional metadata about the tool
- Metadata map[string]ToolMetadataUnion `json:"metadata"`
- ProviderResourceID string `json:"provider_resource_id"`
+ Metadata map[string]ToolMetadataUnion `json:"metadata"`
+ // JSON Schema for the tool's output
+ OutputSchema map[string]ToolOutputSchemaUnion `json:"output_schema"`
+ ProviderResourceID string `json:"provider_resource_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
Identifier respjson.Field
- Parameters respjson.Field
ProviderID respjson.Field
ToolgroupID respjson.Field
Type respjson.Field
+ InputSchema respjson.Field
Metadata respjson.Field
+ OutputSchema respjson.Field
ProviderResourceID respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -118,50 +121,14 @@ func (r *Tool) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Parameter definition for a tool.
-type ToolParameter struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Default value for the parameter if not provided
- Default ToolParameterDefaultUnion `json:"default,nullable"`
- // Type of the elements when parameter_type is array
- Items any `json:"items"`
- // (Optional) Title of the parameter
- Title string `json:"title"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Description respjson.Field
- Name respjson.Field
- ParameterType respjson.Field
- Required respjson.Field
- Default respjson.Field
- Items respjson.Field
- Title respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ToolParameter) RawJSON() string { return r.JSON.raw }
-func (r *ToolParameter) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolParameterDefaultUnion contains all possible properties and values from
-// [bool], [float64], [string], [[]any].
+// ToolInputSchemaUnion contains all possible properties and values from [bool],
+// [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolParameterDefaultUnion struct {
+type ToolInputSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -179,30 +146,30 @@ type ToolParameterDefaultUnion struct {
} `json:"-"`
}
-func (u ToolParameterDefaultUnion) AsBool() (v bool) {
+func (u ToolInputSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolParameterDefaultUnion) AsFloat() (v float64) {
+func (u ToolInputSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolParameterDefaultUnion) AsString() (v string) {
+func (u ToolInputSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolParameterDefaultUnion) AsAnyArray() (v []any) {
+func (u ToolInputSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ToolParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
+func (u ToolInputSchemaUnion) RawJSON() string { return u.JSON.raw }
-func (r *ToolParameterDefaultUnion) UnmarshalJSON(data []byte) error {
+func (r *ToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -258,6 +225,58 @@ func (r *ToolMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
+// ToolOutputSchemaUnion contains all possible properties and values from [bool],
+// [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ToolOutputSchemaUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ToolOutputSchemaUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolOutputSchemaUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolOutputSchemaUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolOutputSchemaUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ToolOutputSchemaUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ToolOutputSchemaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
type ToolListParams struct {
// The ID of the tool group to list tools for.
ToolgroupID param.Opt[string] `query:"toolgroup_id,omitzero" json:"-"`
diff --git a/toolruntime.go b/toolruntime.go
index 4336c9d..ee34060 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -65,18 +65,21 @@ type ToolDef struct {
Name string `json:"name,required"`
// (Optional) Human-readable description of what the tool does
Description string `json:"description"`
+ // (Optional) JSON Schema for tool inputs (MCP inputSchema)
+ InputSchema map[string]ToolDefInputSchemaUnion `json:"input_schema"`
// (Optional) Additional metadata about the tool
Metadata map[string]ToolDefMetadataUnion `json:"metadata"`
- // (Optional) List of parameters this tool accepts
- Parameters []ToolDefParameter `json:"parameters"`
+ // (Optional) JSON Schema for tool outputs (MCP outputSchema)
+ OutputSchema map[string]ToolDefOutputSchemaUnion `json:"output_schema"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Name respjson.Field
- Description respjson.Field
- Metadata respjson.Field
- Parameters respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Name respjson.Field
+ Description respjson.Field
+ InputSchema respjson.Field
+ Metadata respjson.Field
+ OutputSchema respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -95,6 +98,58 @@ func (r ToolDef) ToParam() ToolDefParam {
return param.Override[ToolDefParam](json.RawMessage(r.RawJSON()))
}
+// ToolDefInputSchemaUnion contains all possible properties and values from [bool],
+// [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ToolDefInputSchemaUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ToolDefInputSchemaUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefInputSchemaUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefInputSchemaUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefInputSchemaUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ToolDefInputSchemaUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ToolDefInputSchemaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ToolDefMetadataUnion contains all possible properties and values from [bool],
// [float64], [string], [[]any].
//
@@ -147,50 +202,14 @@ func (r *ToolDefMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Parameter definition for a tool.
-type ToolDefParameter struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Default value for the parameter if not provided
- Default ToolDefParameterDefaultUnion `json:"default,nullable"`
- // Type of the elements when parameter_type is array
- Items any `json:"items"`
- // (Optional) Title of the parameter
- Title string `json:"title"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Description respjson.Field
- Name respjson.Field
- ParameterType respjson.Field
- Required respjson.Field
- Default respjson.Field
- Items respjson.Field
- Title respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ToolDefParameter) RawJSON() string { return r.JSON.raw }
-func (r *ToolDefParameter) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolDefParameterDefaultUnion contains all possible properties and values from
+// ToolDefOutputSchemaUnion contains all possible properties and values from
// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolDefParameterDefaultUnion struct {
+type ToolDefOutputSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -208,30 +227,30 @@ type ToolDefParameterDefaultUnion struct {
} `json:"-"`
}
-func (u ToolDefParameterDefaultUnion) AsBool() (v bool) {
+func (u ToolDefOutputSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefParameterDefaultUnion) AsFloat() (v float64) {
+func (u ToolDefOutputSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefParameterDefaultUnion) AsString() (v string) {
+func (u ToolDefOutputSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefParameterDefaultUnion) AsAnyArray() (v []any) {
+func (u ToolDefOutputSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ToolDefParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
+func (u ToolDefOutputSchemaUnion) RawJSON() string { return u.JSON.raw }
-func (r *ToolDefParameterDefaultUnion) UnmarshalJSON(data []byte) error {
+func (r *ToolDefOutputSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -243,10 +262,12 @@ type ToolDefParam struct {
Name string `json:"name,required"`
// (Optional) Human-readable description of what the tool does
Description param.Opt[string] `json:"description,omitzero"`
+ // (Optional) JSON Schema for tool inputs (MCP inputSchema)
+ InputSchema map[string]ToolDefInputSchemaUnionParam `json:"input_schema,omitzero"`
// (Optional) Additional metadata about the tool
Metadata map[string]ToolDefMetadataUnionParam `json:"metadata,omitzero"`
- // (Optional) List of parameters this tool accepts
- Parameters []ToolDefParameterParam `json:"parameters,omitzero"`
+ // (Optional) JSON Schema for tool outputs (MCP outputSchema)
+ OutputSchema map[string]ToolDefOutputSchemaUnionParam `json:"output_schema,omitzero"`
paramObj
}
@@ -261,7 +282,7 @@ func (r *ToolDefParam) UnmarshalJSON(data []byte) error {
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefMetadataUnionParam struct {
+type ToolDefInputSchemaUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -269,14 +290,14 @@ type ToolDefMetadataUnionParam struct {
paramUnion
}
-func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
+func (u ToolDefInputSchemaUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
+func (u *ToolDefInputSchemaUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *ToolDefMetadataUnionParam) asAny() any {
+func (u *ToolDefInputSchemaUnionParam) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -289,39 +310,41 @@ func (u *ToolDefMetadataUnionParam) asAny() any {
return nil
}
-// Parameter definition for a tool.
+// Only one field can be non-zero.
//
-// The properties Description, Name, ParameterType, Required are required.
-type ToolDefParameterParam struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Title of the parameter
- Title param.Opt[string] `json:"title,omitzero"`
- // (Optional) Default value for the parameter if not provided
- Default ToolDefParameterDefaultUnionParam `json:"default,omitzero"`
- // Type of the elements when parameter_type is array
- Items any `json:"items,omitzero"`
- paramObj
+// Use [param.IsOmitted] to confirm if a field is set.
+type ToolDefMetadataUnionParam struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
}
-func (r ToolDefParameterParam) MarshalJSON() (data []byte, err error) {
- type shadow ToolDefParameterParam
- return param.MarshalObject(r, (*shadow)(&r))
+func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (r *ToolDefParameterParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ToolDefMetadataUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefParameterDefaultUnionParam struct {
+type ToolDefOutputSchemaUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -329,14 +352,14 @@ type ToolDefParameterDefaultUnionParam struct {
paramUnion
}
-func (u ToolDefParameterDefaultUnionParam) MarshalJSON() ([]byte, error) {
+func (u ToolDefOutputSchemaUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *ToolDefParameterDefaultUnionParam) UnmarshalJSON(data []byte) error {
+func (u *ToolDefOutputSchemaUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *ToolDefParameterDefaultUnionParam) asAny() any {
+func (u *ToolDefOutputSchemaUnionParam) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
From 837277d4e6b4ffb57ce0136072b80400011da79a Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 2 Oct 2025 16:49:19 +0000
Subject: [PATCH 29/33] feat(api): tool api (input_schema, etc.) changes
---
.stats.yml | 6 +-
alphaagent_test.go | 17 +-
api.md | 47 +-
benchmark.go | 202 --
benchmark_test.go | 88 -
dataset.go | 1236 -----------
dataset_test.go | 170 --
response.go | 3806 ++++++++++++++++++++--------------
response_test.go | 33 +-
shared/constant/constants.go | 6 -
telemetry.go | 752 -------
telemetry_test.go | 209 --
tool.go | 121 +-
toolruntime.go | 193 +-
14 files changed, 2372 insertions(+), 4514 deletions(-)
delete mode 100644 benchmark_test.go
delete mode 100644 dataset_test.go
diff --git a/.stats.yml b/.stats.yml
index d9b62ff..cbd436b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 109
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-5f0f0b99d1b0bf40e00e11f5d134ed13de97799cf2dfea0c8612e2f003584505.yml
-openapi_spec_hash: 5f51544cb340c37aba54b93a526c536e
+configured_endpoints: 93
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-41cb5d8049e6ffd933a7ad6bbbb76b2fef2e864d0d857c91799ee16e9a796883.yml
+openapi_spec_hash: 5e0bdf64563e020ef14b968ab724d2db
config_hash: 0412cd40c0609550c1a47c69dd104e4f
diff --git a/alphaagent_test.go b/alphaagent_test.go
index 06751f9..4fefd68 100644
--- a/alphaagent_test.go
+++ b/alphaagent_test.go
@@ -31,21 +31,22 @@ func TestAlphaAgentNewWithOptionalParams(t *testing.T) {
ClientTools: []llamastackclient.ToolDefParam{{
Name: "name",
Description: llamastackclient.String("description"),
- InputSchema: map[string]llamastackclient.ToolDefInputSchemaUnionParam{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
Metadata: map[string]llamastackclient.ToolDefMetadataUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
- OutputSchema: map[string]llamastackclient.ToolDefOutputSchemaUnionParam{
- "foo": {
+ Parameters: []llamastackclient.ToolDefParameterParam{{
+ Description: "description",
+ Name: "name",
+ ParameterType: "parameter_type",
+ Required: true,
+ Default: llamastackclient.ToolDefParameterDefaultUnionParam{
OfBool: llamastackclient.Bool(true),
},
- },
+ Items: map[string]interface{}{},
+ Title: llamastackclient.String("title"),
+ }},
}},
EnableSessionPersistence: llamastackclient.Bool(true),
InputShields: []string{"string"},
diff --git a/api.md b/api.md
index e4617a4..6638d36 100644
--- a/api.md
+++ b/api.md
@@ -84,12 +84,13 @@ Response Types:
- llamastackclient.ResponseObject
- llamastackclient.ResponseObjectStreamUnion
+- llamastackclient.ResponseNewResponse
- llamastackclient.ResponseListResponse
- llamastackclient.ResponseDeleteResponse
Methods:
-- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseObject, error)
+- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseNewResponse, error)
- client.Responses.Get(ctx context.Context, responseID string) (llamastackclient.ResponseObject, error)
- client.Responses.List(ctx context.Context, query llamastackclient.ResponseListParams) (pagination.OpenAICursorPage[llamastackclient.ResponseListResponse], error)
- client.Responses.Delete(ctx context.Context, responseID string) (llamastackclient.ResponseDeleteResponse, error)
@@ -106,22 +107,6 @@ Methods:
# Datasets
-Response Types:
-
-- llamastackclient.ListDatasetsResponse
-- llamastackclient.DatasetGetResponse
-- llamastackclient.DatasetIterrowsResponse
-- llamastackclient.DatasetRegisterResponse
-
-Methods:
-
-- client.Datasets.Get(ctx context.Context, datasetID string) (llamastackclient.DatasetGetResponse, error)
-- client.Datasets.List(ctx context.Context) ([]llamastackclient.ListDatasetsResponseData, error)
-- client.Datasets.Appendrows(ctx context.Context, datasetID string, body llamastackclient.DatasetAppendrowsParams) error
-- client.Datasets.Iterrows(ctx context.Context, datasetID string, query llamastackclient.DatasetIterrowsParams) (llamastackclient.DatasetIterrowsResponse, error)
-- client.Datasets.Register(ctx context.Context, body llamastackclient.DatasetRegisterParams) (llamastackclient.DatasetRegisterResponse, error)
-- client.Datasets.Unregister(ctx context.Context, datasetID string) error
-
# Inspect
Response Types:
@@ -341,27 +326,10 @@ Methods:
Params Types:
- llamastackclient.EventUnionParam
-- llamastackclient.QueryConditionParam
-
-Response Types:
-
-- llamastackclient.QuerySpansResponse
-- llamastackclient.SpanWithStatus
-- llamastackclient.Trace
-- llamastackclient.TelemetryGetSpanResponse
-- llamastackclient.TelemetryGetSpanTreeResponse
-- llamastackclient.TelemetryQueryMetricsResponse
Methods:
-- client.Telemetry.GetSpan(ctx context.Context, spanID string, query llamastackclient.TelemetryGetSpanParams) (llamastackclient.TelemetryGetSpanResponse, error)
-- client.Telemetry.GetSpanTree(ctx context.Context, spanID string, body llamastackclient.TelemetryGetSpanTreeParams) (llamastackclient.TelemetryGetSpanTreeResponse, error)
-- client.Telemetry.GetTrace(ctx context.Context, traceID string) (llamastackclient.Trace, error)
- client.Telemetry.LogEvent(ctx context.Context, body llamastackclient.TelemetryLogEventParams) error
-- client.Telemetry.QueryMetrics(ctx context.Context, metricName string, body llamastackclient.TelemetryQueryMetricsParams) ([]llamastackclient.TelemetryQueryMetricsResponse, error)
-- client.Telemetry.QuerySpans(ctx context.Context, body llamastackclient.TelemetryQuerySpansParams) ([]llamastackclient.QuerySpansResponseData, error)
-- client.Telemetry.QueryTraces(ctx context.Context, body llamastackclient.TelemetryQueryTracesParams) ([]llamastackclient.Trace, error)
-- client.Telemetry.SaveSpansToDataset(ctx context.Context, body llamastackclient.TelemetrySaveSpansToDatasetParams) error
# Scoring
@@ -395,17 +363,6 @@ Methods:
# Benchmarks
-Response Types:
-
-- llamastackclient.Benchmark
-- llamastackclient.ListBenchmarksResponse
-
-Methods:
-
-- client.Benchmarks.Get(ctx context.Context, benchmarkID string) (llamastackclient.Benchmark, error)
-- client.Benchmarks.List(ctx context.Context) ([]llamastackclient.Benchmark, error)
-- client.Benchmarks.Register(ctx context.Context, body llamastackclient.BenchmarkRegisterParams) error
-
# Files
Response Types:
diff --git a/benchmark.go b/benchmark.go
index 0d0135b..93f2c30 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -3,19 +3,7 @@
package llamastackclient
import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "slices"
-
- "github.com/llamastack/llama-stack-client-go/internal/apijson"
- "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// BenchmarkService contains methods and other services that help with interacting
@@ -36,193 +24,3 @@ func NewBenchmarkService(opts ...option.RequestOption) (r BenchmarkService) {
r.Options = opts
return
}
-
-// Get a benchmark by its ID.
-func (r *BenchmarkService) Get(ctx context.Context, benchmarkID string, opts ...option.RequestOption) (res *Benchmark, err error) {
- opts = slices.Concat(r.Options, opts)
- if benchmarkID == "" {
- err = errors.New("missing required benchmark_id parameter")
- return
- }
- path := fmt.Sprintf("v1/eval/benchmarks/%s", benchmarkID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
-// List all benchmarks.
-func (r *BenchmarkService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Benchmark, err error) {
- var env ListBenchmarksResponse
- opts = slices.Concat(r.Options, opts)
- path := "v1/eval/benchmarks"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
-// Register a benchmark.
-func (r *BenchmarkService) Register(ctx context.Context, body BenchmarkRegisterParams, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
- path := "v1/eval/benchmarks"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
- return
-}
-
-// A benchmark resource for evaluating model performance.
-type Benchmark struct {
- // Identifier of the dataset to use for the benchmark evaluation
- DatasetID string `json:"dataset_id,required"`
- Identifier string `json:"identifier,required"`
- // Metadata for this evaluation task
- Metadata map[string]BenchmarkMetadataUnion `json:"metadata,required"`
- ProviderID string `json:"provider_id,required"`
- // List of scoring function identifiers to apply during evaluation
- ScoringFunctions []string `json:"scoring_functions,required"`
- // The resource type, always benchmark
- Type constant.Benchmark `json:"type,required"`
- ProviderResourceID string `json:"provider_resource_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- DatasetID respjson.Field
- Identifier respjson.Field
- Metadata respjson.Field
- ProviderID respjson.Field
- ScoringFunctions respjson.Field
- Type respjson.Field
- ProviderResourceID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r Benchmark) RawJSON() string { return r.JSON.raw }
-func (r *Benchmark) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// BenchmarkMetadataUnion contains all possible properties and values from [bool],
-// [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type BenchmarkMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u BenchmarkMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u BenchmarkMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u BenchmarkMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u BenchmarkMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u BenchmarkMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *BenchmarkMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ListBenchmarksResponse struct {
- Data []Benchmark `json:"data,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 ListBenchmarksResponse) RawJSON() string { return r.JSON.raw }
-func (r *ListBenchmarksResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type BenchmarkRegisterParams struct {
- // The ID of the benchmark to register.
- BenchmarkID string `json:"benchmark_id,required"`
- // The ID of the dataset to use for the benchmark.
- DatasetID string `json:"dataset_id,required"`
- // The scoring functions to use for the benchmark.
- ScoringFunctions []string `json:"scoring_functions,omitzero,required"`
- // The ID of the provider benchmark to use for the benchmark.
- ProviderBenchmarkID param.Opt[string] `json:"provider_benchmark_id,omitzero"`
- // The ID of the provider to use for the benchmark.
- ProviderID param.Opt[string] `json:"provider_id,omitzero"`
- // The metadata to use for the benchmark.
- Metadata map[string]BenchmarkRegisterParamsMetadataUnion `json:"metadata,omitzero"`
- paramObj
-}
-
-func (r BenchmarkRegisterParams) MarshalJSON() (data []byte, err error) {
- type shadow BenchmarkRegisterParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *BenchmarkRegisterParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type BenchmarkRegisterParamsMetadataUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u BenchmarkRegisterParamsMetadataUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *BenchmarkRegisterParamsMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *BenchmarkRegisterParamsMetadataUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
diff --git a/benchmark_test.go b/benchmark_test.go
deleted file mode 100644
index 368eeb7..0000000
--- a/benchmark_test.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package llamastackclient_test
-
-import (
- "context"
- "errors"
- "os"
- "testing"
-
- "github.com/llamastack/llama-stack-client-go"
- "github.com/llamastack/llama-stack-client-go/internal/testutil"
- "github.com/llamastack/llama-stack-client-go/option"
-)
-
-func TestBenchmarkGet(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Benchmarks.Get(context.TODO(), "benchmark_id")
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestBenchmarkList(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Benchmarks.List(context.TODO())
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestBenchmarkRegisterWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- err := client.Benchmarks.Register(context.TODO(), llamastackclient.BenchmarkRegisterParams{
- BenchmarkID: "benchmark_id",
- DatasetID: "dataset_id",
- ScoringFunctions: []string{"string"},
- Metadata: map[string]llamastackclient.BenchmarkRegisterParamsMetadataUnion{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
- ProviderBenchmarkID: llamastackclient.String("provider_benchmark_id"),
- ProviderID: llamastackclient.String("provider_id"),
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
diff --git a/dataset.go b/dataset.go
index 72a79d4..5821c4a 100644
--- a/dataset.go
+++ b/dataset.go
@@ -3,21 +3,7 @@
package llamastackclient
import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "slices"
-
- "github.com/llamastack/llama-stack-client-go/internal/apijson"
- "github.com/llamastack/llama-stack-client-go/internal/apiquery"
- "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
- "github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// DatasetService contains methods and other services that help with interacting
@@ -38,1225 +24,3 @@ func NewDatasetService(opts ...option.RequestOption) (r DatasetService) {
r.Options = opts
return
}
-
-// Get a dataset by its ID.
-func (r *DatasetService) Get(ctx context.Context, datasetID string, opts ...option.RequestOption) (res *DatasetGetResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- if datasetID == "" {
- err = errors.New("missing required dataset_id parameter")
- return
- }
- path := fmt.Sprintf("v1/datasets/%s", datasetID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
-// List all datasets.
-func (r *DatasetService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListDatasetsResponseData, err error) {
- var env ListDatasetsResponse
- opts = slices.Concat(r.Options, opts)
- path := "v1/datasets"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
-// Append rows to a dataset.
-func (r *DatasetService) Appendrows(ctx context.Context, datasetID string, body DatasetAppendrowsParams, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
- if datasetID == "" {
- err = errors.New("missing required dataset_id parameter")
- return
- }
- path := fmt.Sprintf("v1/datasetio/append-rows/%s", datasetID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
- return
-}
-
-// Get a paginated list of rows from a dataset. Uses offset-based pagination where:
-//
-// - start_index: The starting index (0-based). If None, starts from beginning.
-// - limit: Number of items to return. If None or -1, returns all items.
-//
-// The response includes:
-//
-// - data: List of items for the current page.
-// - has_more: Whether there are more items available after this set.
-func (r *DatasetService) Iterrows(ctx context.Context, datasetID string, query DatasetIterrowsParams, opts ...option.RequestOption) (res *DatasetIterrowsResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- if datasetID == "" {
- err = errors.New("missing required dataset_id parameter")
- return
- }
- path := fmt.Sprintf("v1/datasetio/iterrows/%s", datasetID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
- return
-}
-
-// Register a new dataset.
-func (r *DatasetService) Register(ctx context.Context, body DatasetRegisterParams, opts ...option.RequestOption) (res *DatasetRegisterResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- path := "v1/datasets"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
-// Unregister a dataset by its ID.
-func (r *DatasetService) Unregister(ctx context.Context, datasetID string, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
- if datasetID == "" {
- err = errors.New("missing required dataset_id parameter")
- return
- }
- path := fmt.Sprintf("v1/datasets/%s", datasetID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
- return
-}
-
-// Response from listing datasets.
-type ListDatasetsResponse struct {
- // List of datasets
- Data []ListDatasetsResponseData `json:"data,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 ListDatasetsResponse) RawJSON() string { return r.JSON.raw }
-func (r *ListDatasetsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Dataset resource for storing and accessing training or evaluation data.
-type ListDatasetsResponseData struct {
- Identifier string `json:"identifier,required"`
- // Additional metadata for the dataset
- Metadata map[string]ListDatasetsResponseDataMetadataUnion `json:"metadata,required"`
- ProviderID string `json:"provider_id,required"`
- // Purpose of the dataset indicating its intended use
- //
- // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
- Purpose string `json:"purpose,required"`
- // Data source configuration for the dataset
- Source ListDatasetsResponseDataSourceUnion `json:"source,required"`
- // Type of resource, always 'dataset' for datasets
- Type constant.Dataset `json:"type,required"`
- ProviderResourceID string `json:"provider_resource_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Identifier respjson.Field
- Metadata respjson.Field
- ProviderID respjson.Field
- Purpose respjson.Field
- Source respjson.Field
- Type respjson.Field
- ProviderResourceID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ListDatasetsResponseData) RawJSON() string { return r.JSON.raw }
-func (r *ListDatasetsResponseData) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ListDatasetsResponseDataMetadataUnion contains all possible properties and
-// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ListDatasetsResponseDataMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ListDatasetsResponseDataMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ListDatasetsResponseDataMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ListDatasetsResponseDataMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ListDatasetsResponseDataSourceUnion contains all possible properties and values
-// from [ListDatasetsResponseDataSourceUri], [ListDatasetsResponseDataSourceRows].
-//
-// Use the [ListDatasetsResponseDataSourceUnion.AsAny] method to switch on the
-// variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ListDatasetsResponseDataSourceUnion struct {
- // Any of "uri", "rows".
- Type string `json:"type"`
- // This field is from variant [ListDatasetsResponseDataSourceUri].
- Uri string `json:"uri"`
- // This field is from variant [ListDatasetsResponseDataSourceRows].
- Rows []map[string]ListDatasetsResponseDataSourceRowsRowUnion `json:"rows"`
- JSON struct {
- Type respjson.Field
- Uri respjson.Field
- Rows respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyListDatasetsResponseDataSource is implemented by each variant of
-// [ListDatasetsResponseDataSourceUnion] to add type safety for the return type of
-// [ListDatasetsResponseDataSourceUnion.AsAny]
-type anyListDatasetsResponseDataSource interface {
- implListDatasetsResponseDataSourceUnion()
-}
-
-func (ListDatasetsResponseDataSourceUri) implListDatasetsResponseDataSourceUnion() {}
-func (ListDatasetsResponseDataSourceRows) implListDatasetsResponseDataSourceUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ListDatasetsResponseDataSourceUnion.AsAny().(type) {
-// case llamastackclient.ListDatasetsResponseDataSourceUri:
-// case llamastackclient.ListDatasetsResponseDataSourceRows:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ListDatasetsResponseDataSourceUnion) AsAny() anyListDatasetsResponseDataSource {
- switch u.Type {
- case "uri":
- return u.AsUri()
- case "rows":
- return u.AsRows()
- }
- return nil
-}
-
-func (u ListDatasetsResponseDataSourceUnion) AsUri() (v ListDatasetsResponseDataSourceUri) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataSourceUnion) AsRows() (v ListDatasetsResponseDataSourceRows) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ListDatasetsResponseDataSourceUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ListDatasetsResponseDataSourceUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset that can be obtained from a URI.
-type ListDatasetsResponseDataSourceUri struct {
- Type constant.Uri `json:"type,required"`
- // The dataset can be obtained from a URI. E.g. -
- // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
- // "data:csv;base64,{base64_content}"
- Uri string `json:"uri,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Type respjson.Field
- Uri respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ListDatasetsResponseDataSourceUri) RawJSON() string { return r.JSON.raw }
-func (r *ListDatasetsResponseDataSourceUri) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset stored in rows.
-type ListDatasetsResponseDataSourceRows struct {
- // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
- // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
- // ]
- Rows []map[string]ListDatasetsResponseDataSourceRowsRowUnion `json:"rows,required"`
- Type constant.Rows `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Rows respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ListDatasetsResponseDataSourceRows) RawJSON() string { return r.JSON.raw }
-func (r *ListDatasetsResponseDataSourceRows) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ListDatasetsResponseDataSourceRowsRowUnion contains all possible properties and
-// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ListDatasetsResponseDataSourceRowsRowUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ListDatasetsResponseDataSourceRowsRowUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataSourceRowsRowUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataSourceRowsRowUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ListDatasetsResponseDataSourceRowsRowUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ListDatasetsResponseDataSourceRowsRowUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ListDatasetsResponseDataSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Dataset resource for storing and accessing training or evaluation data.
-type DatasetGetResponse struct {
- Identifier string `json:"identifier,required"`
- // Additional metadata for the dataset
- Metadata map[string]DatasetGetResponseMetadataUnion `json:"metadata,required"`
- ProviderID string `json:"provider_id,required"`
- // Purpose of the dataset indicating its intended use
- //
- // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
- Purpose DatasetGetResponsePurpose `json:"purpose,required"`
- // Data source configuration for the dataset
- Source DatasetGetResponseSourceUnion `json:"source,required"`
- // Type of resource, always 'dataset' for datasets
- Type constant.Dataset `json:"type,required"`
- ProviderResourceID string `json:"provider_resource_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Identifier respjson.Field
- Metadata respjson.Field
- ProviderID respjson.Field
- Purpose respjson.Field
- Source respjson.Field
- Type respjson.Field
- ProviderResourceID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetGetResponse) RawJSON() string { return r.JSON.raw }
-func (r *DatasetGetResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// DatasetGetResponseMetadataUnion contains all possible properties and values from
-// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type DatasetGetResponseMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u DatasetGetResponseMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetGetResponseMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetGetResponseMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Purpose of the dataset indicating its intended use
-type DatasetGetResponsePurpose string
-
-const (
- DatasetGetResponsePurposePostTrainingMessages DatasetGetResponsePurpose = "post-training/messages"
- DatasetGetResponsePurposeEvalQuestionAnswer DatasetGetResponsePurpose = "eval/question-answer"
- DatasetGetResponsePurposeEvalMessagesAnswer DatasetGetResponsePurpose = "eval/messages-answer"
-)
-
-// DatasetGetResponseSourceUnion contains all possible properties and values from
-// [DatasetGetResponseSourceUri], [DatasetGetResponseSourceRows].
-//
-// Use the [DatasetGetResponseSourceUnion.AsAny] method to switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type DatasetGetResponseSourceUnion struct {
- // Any of "uri", "rows".
- Type string `json:"type"`
- // This field is from variant [DatasetGetResponseSourceUri].
- Uri string `json:"uri"`
- // This field is from variant [DatasetGetResponseSourceRows].
- Rows []map[string]DatasetGetResponseSourceRowsRowUnion `json:"rows"`
- JSON struct {
- Type respjson.Field
- Uri respjson.Field
- Rows respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyDatasetGetResponseSource is implemented by each variant of
-// [DatasetGetResponseSourceUnion] to add type safety for the return type of
-// [DatasetGetResponseSourceUnion.AsAny]
-type anyDatasetGetResponseSource interface {
- implDatasetGetResponseSourceUnion()
-}
-
-func (DatasetGetResponseSourceUri) implDatasetGetResponseSourceUnion() {}
-func (DatasetGetResponseSourceRows) implDatasetGetResponseSourceUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := DatasetGetResponseSourceUnion.AsAny().(type) {
-// case llamastackclient.DatasetGetResponseSourceUri:
-// case llamastackclient.DatasetGetResponseSourceRows:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u DatasetGetResponseSourceUnion) AsAny() anyDatasetGetResponseSource {
- switch u.Type {
- case "uri":
- return u.AsUri()
- case "rows":
- return u.AsRows()
- }
- return nil
-}
-
-func (u DatasetGetResponseSourceUnion) AsUri() (v DatasetGetResponseSourceUri) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseSourceUnion) AsRows() (v DatasetGetResponseSourceRows) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetGetResponseSourceUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetGetResponseSourceUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset that can be obtained from a URI.
-type DatasetGetResponseSourceUri struct {
- Type constant.Uri `json:"type,required"`
- // The dataset can be obtained from a URI. E.g. -
- // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
- // "data:csv;base64,{base64_content}"
- Uri string `json:"uri,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Type respjson.Field
- Uri respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetGetResponseSourceUri) RawJSON() string { return r.JSON.raw }
-func (r *DatasetGetResponseSourceUri) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset stored in rows.
-type DatasetGetResponseSourceRows struct {
- // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
- // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
- // ]
- Rows []map[string]DatasetGetResponseSourceRowsRowUnion `json:"rows,required"`
- Type constant.Rows `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Rows respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetGetResponseSourceRows) RawJSON() string { return r.JSON.raw }
-func (r *DatasetGetResponseSourceRows) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// DatasetGetResponseSourceRowsRowUnion contains all possible properties and values
-// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type DatasetGetResponseSourceRowsRowUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u DatasetGetResponseSourceRowsRowUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseSourceRowsRowUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseSourceRowsRowUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetGetResponseSourceRowsRowUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetGetResponseSourceRowsRowUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetGetResponseSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A generic paginated response that follows a simple format.
-type DatasetIterrowsResponse struct {
- // The list of items for the current page
- Data []map[string]DatasetIterrowsResponseDataUnion `json:"data,required"`
- // Whether there are more items available after this set
- HasMore bool `json:"has_more,required"`
- // The URL for accessing this list
- URL string `json:"url"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Data respjson.Field
- HasMore respjson.Field
- URL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetIterrowsResponse) RawJSON() string { return r.JSON.raw }
-func (r *DatasetIterrowsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// DatasetIterrowsResponseDataUnion contains all possible properties and values
-// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type DatasetIterrowsResponseDataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u DatasetIterrowsResponseDataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetIterrowsResponseDataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetIterrowsResponseDataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetIterrowsResponseDataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetIterrowsResponseDataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetIterrowsResponseDataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Dataset resource for storing and accessing training or evaluation data.
-type DatasetRegisterResponse struct {
- Identifier string `json:"identifier,required"`
- // Additional metadata for the dataset
- Metadata map[string]DatasetRegisterResponseMetadataUnion `json:"metadata,required"`
- ProviderID string `json:"provider_id,required"`
- // Purpose of the dataset indicating its intended use
- //
- // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
- Purpose DatasetRegisterResponsePurpose `json:"purpose,required"`
- // Data source configuration for the dataset
- Source DatasetRegisterResponseSourceUnion `json:"source,required"`
- // Type of resource, always 'dataset' for datasets
- Type constant.Dataset `json:"type,required"`
- ProviderResourceID string `json:"provider_resource_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Identifier respjson.Field
- Metadata respjson.Field
- ProviderID respjson.Field
- Purpose respjson.Field
- Source respjson.Field
- Type respjson.Field
- ProviderResourceID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetRegisterResponse) RawJSON() string { return r.JSON.raw }
-func (r *DatasetRegisterResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// DatasetRegisterResponseMetadataUnion contains all possible properties and values
-// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type DatasetRegisterResponseMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u DatasetRegisterResponseMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetRegisterResponseMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetRegisterResponseMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Purpose of the dataset indicating its intended use
-type DatasetRegisterResponsePurpose string
-
-const (
- DatasetRegisterResponsePurposePostTrainingMessages DatasetRegisterResponsePurpose = "post-training/messages"
- DatasetRegisterResponsePurposeEvalQuestionAnswer DatasetRegisterResponsePurpose = "eval/question-answer"
- DatasetRegisterResponsePurposeEvalMessagesAnswer DatasetRegisterResponsePurpose = "eval/messages-answer"
-)
-
-// DatasetRegisterResponseSourceUnion contains all possible properties and values
-// from [DatasetRegisterResponseSourceUri], [DatasetRegisterResponseSourceRows].
-//
-// Use the [DatasetRegisterResponseSourceUnion.AsAny] method to switch on the
-// variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type DatasetRegisterResponseSourceUnion struct {
- // Any of "uri", "rows".
- Type string `json:"type"`
- // This field is from variant [DatasetRegisterResponseSourceUri].
- Uri string `json:"uri"`
- // This field is from variant [DatasetRegisterResponseSourceRows].
- Rows []map[string]DatasetRegisterResponseSourceRowsRowUnion `json:"rows"`
- JSON struct {
- Type respjson.Field
- Uri respjson.Field
- Rows respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyDatasetRegisterResponseSource is implemented by each variant of
-// [DatasetRegisterResponseSourceUnion] to add type safety for the return type of
-// [DatasetRegisterResponseSourceUnion.AsAny]
-type anyDatasetRegisterResponseSource interface {
- implDatasetRegisterResponseSourceUnion()
-}
-
-func (DatasetRegisterResponseSourceUri) implDatasetRegisterResponseSourceUnion() {}
-func (DatasetRegisterResponseSourceRows) implDatasetRegisterResponseSourceUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := DatasetRegisterResponseSourceUnion.AsAny().(type) {
-// case llamastackclient.DatasetRegisterResponseSourceUri:
-// case llamastackclient.DatasetRegisterResponseSourceRows:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u DatasetRegisterResponseSourceUnion) AsAny() anyDatasetRegisterResponseSource {
- switch u.Type {
- case "uri":
- return u.AsUri()
- case "rows":
- return u.AsRows()
- }
- return nil
-}
-
-func (u DatasetRegisterResponseSourceUnion) AsUri() (v DatasetRegisterResponseSourceUri) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseSourceUnion) AsRows() (v DatasetRegisterResponseSourceRows) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetRegisterResponseSourceUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetRegisterResponseSourceUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset that can be obtained from a URI.
-type DatasetRegisterResponseSourceUri struct {
- Type constant.Uri `json:"type,required"`
- // The dataset can be obtained from a URI. E.g. -
- // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
- // "data:csv;base64,{base64_content}"
- Uri string `json:"uri,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Type respjson.Field
- Uri respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetRegisterResponseSourceUri) RawJSON() string { return r.JSON.raw }
-func (r *DatasetRegisterResponseSourceUri) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset stored in rows.
-type DatasetRegisterResponseSourceRows struct {
- // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
- // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
- // ]
- Rows []map[string]DatasetRegisterResponseSourceRowsRowUnion `json:"rows,required"`
- Type constant.Rows `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Rows respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r DatasetRegisterResponseSourceRows) RawJSON() string { return r.JSON.raw }
-func (r *DatasetRegisterResponseSourceRows) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// DatasetRegisterResponseSourceRowsRowUnion contains all possible properties and
-// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type DatasetRegisterResponseSourceRowsRowUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u DatasetRegisterResponseSourceRowsRowUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseSourceRowsRowUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseSourceRowsRowUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u DatasetRegisterResponseSourceRowsRowUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u DatasetRegisterResponseSourceRowsRowUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *DatasetRegisterResponseSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type DatasetAppendrowsParams struct {
- // The rows to append to the dataset.
- Rows []map[string]DatasetAppendrowsParamsRowUnion `json:"rows,omitzero,required"`
- paramObj
-}
-
-func (r DatasetAppendrowsParams) MarshalJSON() (data []byte, err error) {
- type shadow DatasetAppendrowsParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *DatasetAppendrowsParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type DatasetAppendrowsParamsRowUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u DatasetAppendrowsParamsRowUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *DatasetAppendrowsParamsRowUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *DatasetAppendrowsParamsRowUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-type DatasetIterrowsParams struct {
- // The number of rows to get.
- Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
- // Index into dataset for the first row to get. Get all rows if None.
- StartIndex param.Opt[int64] `query:"start_index,omitzero" json:"-"`
- paramObj
-}
-
-// URLQuery serializes [DatasetIterrowsParams]'s query parameters as `url.Values`.
-func (r DatasetIterrowsParams) URLQuery() (v url.Values, err error) {
- return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
- ArrayFormat: apiquery.ArrayQueryFormatComma,
- NestedFormat: apiquery.NestedQueryFormatBrackets,
- })
-}
-
-type DatasetRegisterParams struct {
- // The purpose of the dataset. One of: - "post-training/messages": The dataset
- // contains a messages column with list of messages for post-training. {
- // "messages": [ {"role": "user", "content": "Hello, world!"}, {"role":
- // "assistant", "content": "Hello, world!"}, ] } - "eval/question-answer": The
- // dataset contains a question column and an answer column for evaluation. {
- // "question": "What is the capital of France?", "answer": "Paris" } -
- // "eval/messages-answer": The dataset contains a messages column with list of
- // messages and an answer column for evaluation. { "messages": [ {"role": "user",
- // "content": "Hello, my name is John Doe."}, {"role": "assistant", "content":
- // "Hello, John Doe. How can I help you today?"}, {"role": "user", "content":
- // "What's my name?"}, ], "answer": "John Doe" }
- //
- // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
- Purpose DatasetRegisterParamsPurpose `json:"purpose,omitzero,required"`
- // The data source of the dataset. Ensure that the data source schema is compatible
- // with the purpose of the dataset. Examples: - { "type": "uri", "uri":
- // "https://mywebsite.com/mydata.jsonl" } - { "type": "uri", "uri":
- // "lsfs://mydata.jsonl" } - { "type": "uri", "uri":
- // "data:csv;base64,{base64_content}" } - { "type": "uri", "uri":
- // "huggingface://llamastack/simpleqa?split=train" } - { "type": "rows", "rows": [
- // { "messages": [ {"role": "user", "content": "Hello, world!"}, {"role":
- // "assistant", "content": "Hello, world!"}, ] } ] }
- Source DatasetRegisterParamsSourceUnion `json:"source,omitzero,required"`
- // The ID of the dataset. If not provided, an ID will be generated.
- DatasetID param.Opt[string] `json:"dataset_id,omitzero"`
- // The metadata for the dataset. - E.g. {"description": "My dataset"}.
- Metadata map[string]DatasetRegisterParamsMetadataUnion `json:"metadata,omitzero"`
- paramObj
-}
-
-func (r DatasetRegisterParams) MarshalJSON() (data []byte, err error) {
- type shadow DatasetRegisterParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *DatasetRegisterParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// The purpose of the dataset. One of: - "post-training/messages": The dataset
-// contains a messages column with list of messages for post-training. {
-// "messages": [ {"role": "user", "content": "Hello, world!"}, {"role":
-// "assistant", "content": "Hello, world!"}, ] } - "eval/question-answer": The
-// dataset contains a question column and an answer column for evaluation. {
-// "question": "What is the capital of France?", "answer": "Paris" } -
-// "eval/messages-answer": The dataset contains a messages column with list of
-// messages and an answer column for evaluation. { "messages": [ {"role": "user",
-// "content": "Hello, my name is John Doe."}, {"role": "assistant", "content":
-// "Hello, John Doe. How can I help you today?"}, {"role": "user", "content":
-// "What's my name?"}, ], "answer": "John Doe" }
-type DatasetRegisterParamsPurpose string
-
-const (
- DatasetRegisterParamsPurposePostTrainingMessages DatasetRegisterParamsPurpose = "post-training/messages"
- DatasetRegisterParamsPurposeEvalQuestionAnswer DatasetRegisterParamsPurpose = "eval/question-answer"
- DatasetRegisterParamsPurposeEvalMessagesAnswer DatasetRegisterParamsPurpose = "eval/messages-answer"
-)
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type DatasetRegisterParamsSourceUnion struct {
- OfUri *DatasetRegisterParamsSourceUri `json:",omitzero,inline"`
- OfRows *DatasetRegisterParamsSourceRows `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u DatasetRegisterParamsSourceUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfUri, u.OfRows)
-}
-func (u *DatasetRegisterParamsSourceUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *DatasetRegisterParamsSourceUnion) asAny() any {
- if !param.IsOmitted(u.OfUri) {
- return u.OfUri
- } else if !param.IsOmitted(u.OfRows) {
- return u.OfRows
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u DatasetRegisterParamsSourceUnion) GetUri() *string {
- if vt := u.OfUri; vt != nil {
- return &vt.Uri
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u DatasetRegisterParamsSourceUnion) GetRows() []map[string]DatasetRegisterParamsSourceRowsRowUnion {
- if vt := u.OfRows; vt != nil {
- return vt.Rows
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u DatasetRegisterParamsSourceUnion) GetType() *string {
- if vt := u.OfUri; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfRows; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
-}
-
-func init() {
- apijson.RegisterUnion[DatasetRegisterParamsSourceUnion](
- "type",
- apijson.Discriminator[DatasetRegisterParamsSourceUri]("uri"),
- apijson.Discriminator[DatasetRegisterParamsSourceRows]("rows"),
- )
-}
-
-// A dataset that can be obtained from a URI.
-//
-// The properties Type, Uri are required.
-type DatasetRegisterParamsSourceUri struct {
- // The dataset can be obtained from a URI. E.g. -
- // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
- // "data:csv;base64,{base64_content}"
- Uri string `json:"uri,required"`
- // This field can be elided, and will marshal its zero value as "uri".
- Type constant.Uri `json:"type,required"`
- paramObj
-}
-
-func (r DatasetRegisterParamsSourceUri) MarshalJSON() (data []byte, err error) {
- type shadow DatasetRegisterParamsSourceUri
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *DatasetRegisterParamsSourceUri) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A dataset stored in rows.
-//
-// The properties Rows, Type are required.
-type DatasetRegisterParamsSourceRows struct {
- // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
- // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
- // ]
- Rows []map[string]DatasetRegisterParamsSourceRowsRowUnion `json:"rows,omitzero,required"`
- // This field can be elided, and will marshal its zero value as "rows".
- Type constant.Rows `json:"type,required"`
- paramObj
-}
-
-func (r DatasetRegisterParamsSourceRows) MarshalJSON() (data []byte, err error) {
- type shadow DatasetRegisterParamsSourceRows
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *DatasetRegisterParamsSourceRows) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type DatasetRegisterParamsSourceRowsRowUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u DatasetRegisterParamsSourceRowsRowUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *DatasetRegisterParamsSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *DatasetRegisterParamsSourceRowsRowUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type DatasetRegisterParamsMetadataUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u DatasetRegisterParamsMetadataUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *DatasetRegisterParamsMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *DatasetRegisterParamsMetadataUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
diff --git a/dataset_test.go b/dataset_test.go
deleted file mode 100644
index dc5ab37..0000000
--- a/dataset_test.go
+++ /dev/null
@@ -1,170 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-package llamastackclient_test
-
-import (
- "context"
- "errors"
- "os"
- "testing"
-
- "github.com/llamastack/llama-stack-client-go"
- "github.com/llamastack/llama-stack-client-go/internal/testutil"
- "github.com/llamastack/llama-stack-client-go/option"
-)
-
-func TestDatasetGet(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Datasets.Get(context.TODO(), "dataset_id")
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestDatasetList(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Datasets.List(context.TODO())
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestDatasetAppendrows(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- err := client.Datasets.Appendrows(
- context.TODO(),
- "dataset_id",
- llamastackclient.DatasetAppendrowsParams{
- Rows: []map[string]llamastackclient.DatasetAppendrowsParamsRowUnion{{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- }},
- },
- )
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestDatasetIterrowsWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Datasets.Iterrows(
- context.TODO(),
- "dataset_id",
- llamastackclient.DatasetIterrowsParams{
- Limit: llamastackclient.Int(0),
- StartIndex: llamastackclient.Int(0),
- },
- )
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestDatasetRegisterWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Datasets.Register(context.TODO(), llamastackclient.DatasetRegisterParams{
- Purpose: llamastackclient.DatasetRegisterParamsPurposePostTrainingMessages,
- Source: llamastackclient.DatasetRegisterParamsSourceUnion{
- OfUri: &llamastackclient.DatasetRegisterParamsSourceUri{
- Uri: "uri",
- },
- },
- DatasetID: llamastackclient.String("dataset_id"),
- Metadata: map[string]llamastackclient.DatasetRegisterParamsMetadataUnion{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestDatasetUnregister(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- err := client.Datasets.Unregister(context.TODO(), "dataset_id")
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
diff --git a/response.go b/response.go
index 37ce156..c3cf4dc 100644
--- a/response.go
+++ b/response.go
@@ -43,22 +43,13 @@ func NewResponseService(opts ...option.RequestOption) (r ResponseService) {
return
}
-// Create a new OpenAI response.
-func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *ResponseObject, err error) {
- opts = slices.Concat(r.Options, opts)
- path := "v1/responses"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
-// Create a new OpenAI response.
+// List all OpenAI responses.
func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseObjectStreamUnion]) {
var (
raw *http.Response
err error
)
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
return ssestream.NewStream[ResponseObjectStreamUnion](ssestream.NewDecoder(raw), err)
@@ -4505,28 +4496,58 @@ func (r *ResponseObjectStreamResponseCompleted) UnmarshalJSON(data []byte) error
return apijson.UnmarshalRoot(data, r)
}
+// Paginated list of OpenAI response objects with navigation metadata.
+type ResponseNewResponse struct {
+ // List of response objects with their input context
+ Data []ResponseNewResponseData `json:"data,required"`
+ // Identifier of the first item in this page
+ FirstID string `json:"first_id,required"`
+ // Whether there are more results available beyond this page
+ HasMore bool `json:"has_more,required"`
+ // Identifier of the last item in this page
+ LastID string `json:"last_id,required"`
+ // Object type identifier, always "list"
+ Object constant.List `json:"object,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ FirstID respjson.Field
+ HasMore respjson.Field
+ LastID respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// OpenAI response object extended with input context information.
-type ResponseListResponse struct {
+type ResponseNewResponseData struct {
// Unique identifier for this response
ID string `json:"id,required"`
// Unix timestamp when the response was created
CreatedAt int64 `json:"created_at,required"`
// List of input items that led to this response
- Input []ResponseListResponseInputUnion `json:"input,required"`
+ Input []ResponseNewResponseDataInputUnion `json:"input,required"`
// Model identifier used for generation
Model string `json:"model,required"`
// Object type identifier, always "response"
Object constant.Response `json:"object,required"`
// List of generated output items (messages, tool calls, etc.)
- Output []ResponseListResponseOutputUnion `json:"output,required"`
+ Output []ResponseNewResponseDataOutputUnion `json:"output,required"`
// Whether tool calls can be executed in parallel
ParallelToolCalls bool `json:"parallel_tool_calls,required"`
// Current status of the response generation
Status string `json:"status,required"`
// Text formatting configuration for the response
- Text ResponseListResponseText `json:"text,required"`
+ Text ResponseNewResponseDataText `json:"text,required"`
// (Optional) Error details if the response generation failed
- Error ResponseListResponseError `json:"error"`
+ Error ResponseNewResponseDataError `json:"error"`
// (Optional) ID of the previous response in a conversation
PreviousResponseID string `json:"previous_response_id"`
// (Optional) Sampling temperature used for generation
@@ -4557,53 +4578,53 @@ type ResponseListResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponse) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponse) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseData) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseData) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputUnion contains all possible properties and values from
-// [ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall],
-// [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall],
-// [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall],
-// [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput],
-// [ResponseListResponseInputOpenAIResponseMcpApprovalRequest],
-// [ResponseListResponseInputOpenAIResponseMcpApprovalResponse],
-// [ResponseListResponseInputOpenAIResponseMessage].
+// ResponseNewResponseDataInputUnion contains all possible properties and values
+// from [ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall],
+// [ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall],
+// [ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall],
+// [ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput],
+// [ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest],
+// [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse],
+// [ResponseNewResponseDataInputOpenAIResponseMessage].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseInputUnion struct {
+type ResponseNewResponseDataInputUnion struct {
ID string `json:"id"`
Status string `json:"status"`
Type string `json:"type"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
+ // [ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall].
Queries []string `json:"queries"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
- Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
- Arguments string `json:"arguments"`
- CallID string `json:"call_id"`
- Name string `json:"name"`
+ // [ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall].
+ Results []ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput].
+ // [ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput].
Output string `json:"output"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalRequest].
+ // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest].
ServerLabel string `json:"server_label"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse].
ApprovalRequestID string `json:"approval_request_id"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse].
Approve bool `json:"approve"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse].
Reason string `json:"reason"`
- // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
- Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content"`
- // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
- Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role"`
+ // This field is from variant [ResponseNewResponseDataInputOpenAIResponseMessage].
+ Content ResponseNewResponseDataInputOpenAIResponseMessageContentUnion `json:"content"`
+ // This field is from variant [ResponseNewResponseDataInputOpenAIResponseMessage].
+ Role ResponseNewResponseDataInputOpenAIResponseMessageRole `json:"role"`
JSON struct {
ID respjson.Field
Status respjson.Field
@@ -4624,50 +4645,50 @@ type ResponseListResponseInputUnion struct {
} `json:"-"`
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageWebSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseOutputMessageWebSearchToolCall() (v ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFileSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseOutputMessageFileSearchToolCall() (v ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFunctionToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseOutputMessageFunctionToolCall() (v ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseInputFunctionToolCallOutput() (v ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseInputFunctionToolCallOutput() (v ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseListResponseInputOpenAIResponseMcpApprovalRequest) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseListResponseInputOpenAIResponseMcpApprovalResponse) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseMessage() (v ResponseListResponseInputOpenAIResponseMessage) {
+func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseMessage() (v ResponseNewResponseDataInputOpenAIResponseMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseNewResponseDataInputUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseListResponseInputUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Web search tool call output message for OpenAI responses.
-type ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall struct {
+type ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// Current status of the web search operation
@@ -4685,15 +4706,15 @@ type ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall struc
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File search tool call output message for OpenAI responses.
-type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall struct {
+type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// List of search queries executed
@@ -4703,7 +4724,7 @@ type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall stru
// Tool call type identifier, always "file_search_call"
Type constant.FileSearchCall `json:"type,required"`
// (Optional) Search results returned by the file search operation
- Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Results []ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -4717,17 +4738,17 @@ type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall stru
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Search results returned by the file search operation.
-type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult struct {
+type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult struct {
// (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,required"`
+ Attributes map[string]ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,required"`
// Unique identifier of the file containing the result
FileID string `json:"file_id,required"`
// Name of the file containing the result
@@ -4749,14 +4770,14 @@ type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResul
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion
+// ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion
// contains all possible properties and values from [bool], [float64], [string],
// [[]any].
//
@@ -4764,7 +4785,7 @@ func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallR
//
// If the underlying value is not a json object, one of the following properties
// will be valid: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
+type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -4782,37 +4803,37 @@ type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResul
} `json:"-"`
}
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
+func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
+func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsString() (v string) {
+func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsAnyArray() (v []any) {
+func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) RawJSON() string {
+func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Function tool call output message for OpenAI responses.
-type ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall struct {
+type ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall struct {
// JSON string containing the function arguments
Arguments string `json:"arguments,required"`
// Unique identifier for the function call
@@ -4839,16 +4860,16 @@ type ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall struct
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// This represents the output of a function call that gets passed back to the
// model.
-type ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput struct {
+type ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput struct {
CallID string `json:"call_id,required"`
Output string `json:"output,required"`
Type constant.FunctionCallOutput `json:"type,required"`
@@ -4867,15 +4888,15 @@ type ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A request for human approval of a tool invocation.
-type ResponseListResponseInputOpenAIResponseMcpApprovalRequest struct {
+type ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest struct {
ID string `json:"id,required"`
Arguments string `json:"arguments,required"`
Name string `json:"name,required"`
@@ -4894,15 +4915,15 @@ type ResponseListResponseInputOpenAIResponseMcpApprovalRequest struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A response to an MCP approval request.
-type ResponseListResponseInputOpenAIResponseMcpApprovalResponse struct {
+type ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse struct {
ApprovalRequestID string `json:"approval_request_id,required"`
Approve bool `json:"approve,required"`
Type constant.McpApprovalResponse `json:"type,required"`
@@ -4921,23 +4942,23 @@ type ResponseListResponseInputOpenAIResponseMcpApprovalResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
-type ResponseListResponseInputOpenAIResponseMessage struct {
- Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content,required"`
+type ResponseNewResponseDataInputOpenAIResponseMessage struct {
+ Content ResponseNewResponseDataInputOpenAIResponseMessageContentUnion `json:"content,required"`
// Any of "system", "developer", "user", "assistant".
- Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role,required"`
- Type constant.Message `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
+ Role ResponseNewResponseDataInputOpenAIResponseMessageRole `json:"role,required"`
+ Type constant.Message `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -4951,85 +4972,85 @@ type ResponseListResponseInputOpenAIResponseMessage struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessage) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseInputOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataInputOpenAIResponseMessage) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataInputOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseMessageContentUnion contains all possible
-// properties and values from [string],
-// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion],
-// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem].
+// ResponseNewResponseDataInputOpenAIResponseMessageContentUnion contains all
+// possible properties and values from [string],
+// [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion],
+// [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem].
//
// 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: OfString
-// OfResponseListResponseInputOpenAIResponseMessageContentArray OfVariant2]
-type ResponseListResponseInputOpenAIResponseMessageContentUnion struct {
+// OfResponseNewResponseDataInputOpenAIResponseMessageContentArray OfVariant2]
+type ResponseNewResponseDataInputOpenAIResponseMessageContentUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] instead
- // of an object.
- OfResponseListResponseInputOpenAIResponseMessageContentArray []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion `json:",inline"`
+ // [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion]
+ // instead of an object.
+ OfResponseNewResponseDataInputOpenAIResponseMessageContentArray []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem] instead of an
- // object.
- OfVariant2 []ResponseListResponseInputOpenAIResponseMessageContentArrayItem `json:",inline"`
+ // [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem] instead of
+ // an object.
+ OfVariant2 []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem `json:",inline"`
JSON struct {
- OfString respjson.Field
- OfResponseListResponseInputOpenAIResponseMessageContentArray respjson.Field
- OfVariant2 respjson.Field
- raw string
+ OfString respjson.Field
+ OfResponseNewResponseDataInputOpenAIResponseMessageContentArray respjson.Field
+ OfVariant2 respjson.Field
+ raw string
} `json:"-"`
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsString() (v string) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsResponseListResponseInputOpenAIResponseMessageContentArray() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) AsResponseNewResponseDataInputOpenAIResponseMessageContentArray() (v []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsVariant2() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItem) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) AsVariant2() (v []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) RawJSON() string {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion contains all
-// possible properties and values from
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
+// ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion contains
+// all possible properties and values from
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText],
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage].
//
// Use the
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
// method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion struct {
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText].
+ // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText].
Text string `json:"text"`
// Any of "input_text", "input_image".
Type string `json:"type"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
- Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail"`
+ // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage].
+ Detail ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
+ // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage].
ImageURL string `json:"image_url"`
JSON struct {
Text respjson.Field
@@ -5040,29 +5061,29 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion struct
} `json:"-"`
}
-// anyResponseListResponseInputOpenAIResponseMessageContentArrayItem is implemented
-// by each variant of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] to add
+// anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem is
+// implemented by each variant of
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion] to add
// type safety for the return type of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
-type anyResponseListResponseInputOpenAIResponseMessageContentArrayItem interface {
- implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion()
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
+type anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem interface {
+ implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion()
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
+func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion() {
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
+func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage:
+// switch variant := ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion.AsAny().(type) {
+// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText:
+// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItem {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) AsAny() anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem {
switch u.Type {
case "input_text":
return u.AsInputText()
@@ -5072,27 +5093,27 @@ func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsA
return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) AsInputText() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) AsInputImage() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) RawJSON() string {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Text content for input messages in OpenAI response format.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText struct {
// The text content of the input message
Text string `json:"text,required"`
// Content type identifier, always "input_text"
@@ -5107,19 +5128,19 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText str
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content for input messages in OpenAI response format.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage struct {
// Level of detail for image processing, can be "low", "high", or "auto"
//
// Any of "low", "high", "auto".
- Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,required"`
+ Detail ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,required"`
// Content type identifier, always "input_image"
Type constant.InputImage `json:"type,required"`
// (Optional) URL of the image content
@@ -5135,35 +5156,35 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage st
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail string
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail string
const (
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
+ ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
+ ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
+ ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
)
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail string
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail string
const (
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "low"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "high"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "auto"
+ ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetailLow ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail = "low"
+ ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetailHigh ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail = "high"
+ ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetailAuto ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail = "auto"
)
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItem struct {
- Annotations []ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
- Text string `json:"text,required"`
- Type constant.OutputText `json:"type,required"`
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem struct {
+ Annotations []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
+ Text string `json:"text,required"`
+ Type constant.OutputText `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Annotations respjson.Field
@@ -5175,26 +5196,26 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItem struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItem) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion
+// ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion
// contains all possible properties and values from
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath].
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation],
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation],
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation],
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath].
//
// Use the
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
// method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
FileID string `json:"file_id"`
Filename string `json:"filename"`
Index int64 `json:"index"`
@@ -5203,13 +5224,13 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUni
EndIndex int64 `json:"end_index"`
StartIndex int64 `json:"start_index"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
Title string `json:"title"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
URL string `json:"url"`
// This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation].
+ // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation].
ContainerID string `json:"container_id"`
JSON struct {
FileID respjson.Field
@@ -5225,35 +5246,35 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUni
} `json:"-"`
}
-// anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation is
-// implemented by each variant of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion]
+// anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
+// is implemented by each variant of
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion]
// to add type safety for the return type of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
-type anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation interface {
- implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion()
+// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
+type anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation interface {
+ implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion()
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath:
+// switch variant := ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny().(type) {
+// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation:
+// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation:
+// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation:
+// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsAny() anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation {
switch u.Type {
case "file_citation":
return u.AsFileCitation()
@@ -5267,37 +5288,37 @@ func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation
return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) RawJSON() string {
+func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File citation annotation for referencing specific files in response content.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
// Unique identifier of the referenced file
FileID string `json:"file_id,required"`
// Name of the referenced file
@@ -5318,15 +5339,15 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFil
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// URL citation annotation for referencing external web resources.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
// End position of the citation span in the content
EndIndex int64 `json:"end_index,required"`
// Start position of the citation span in the content
@@ -5350,14 +5371,14 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURL
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
ContainerID string `json:"container_id,required"`
EndIndex int64 `json:"end_index,required"`
FileID string `json:"file_id,required"`
@@ -5378,14 +5399,14 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationCon
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
+type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
FileID string `json:"file_id,required"`
Index int64 `json:"index,required"`
Type constant.FilePath `json:"type,required"`
@@ -5400,66 +5421,69 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFil
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) RawJSON() string {
+func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseInputOpenAIResponseMessageRole string
+type ResponseNewResponseDataInputOpenAIResponseMessageRole string
const (
- ResponseListResponseInputOpenAIResponseMessageRoleSystem ResponseListResponseInputOpenAIResponseMessageRole = "system"
- ResponseListResponseInputOpenAIResponseMessageRoleDeveloper ResponseListResponseInputOpenAIResponseMessageRole = "developer"
- ResponseListResponseInputOpenAIResponseMessageRoleUser ResponseListResponseInputOpenAIResponseMessageRole = "user"
- ResponseListResponseInputOpenAIResponseMessageRoleAssistant ResponseListResponseInputOpenAIResponseMessageRole = "assistant"
+ ResponseNewResponseDataInputOpenAIResponseMessageRoleSystem ResponseNewResponseDataInputOpenAIResponseMessageRole = "system"
+ ResponseNewResponseDataInputOpenAIResponseMessageRoleDeveloper ResponseNewResponseDataInputOpenAIResponseMessageRole = "developer"
+ ResponseNewResponseDataInputOpenAIResponseMessageRoleUser ResponseNewResponseDataInputOpenAIResponseMessageRole = "user"
+ ResponseNewResponseDataInputOpenAIResponseMessageRoleAssistant ResponseNewResponseDataInputOpenAIResponseMessageRole = "assistant"
)
-type ResponseListResponseInputRole string
+type ResponseNewResponseDataInputRole string
const (
- ResponseListResponseInputRoleSystem ResponseListResponseInputRole = "system"
- ResponseListResponseInputRoleDeveloper ResponseListResponseInputRole = "developer"
- ResponseListResponseInputRoleUser ResponseListResponseInputRole = "user"
- ResponseListResponseInputRoleAssistant ResponseListResponseInputRole = "assistant"
+ ResponseNewResponseDataInputRoleSystem ResponseNewResponseDataInputRole = "system"
+ ResponseNewResponseDataInputRoleDeveloper ResponseNewResponseDataInputRole = "developer"
+ ResponseNewResponseDataInputRoleUser ResponseNewResponseDataInputRole = "user"
+ ResponseNewResponseDataInputRoleAssistant ResponseNewResponseDataInputRole = "assistant"
)
-// ResponseListResponseOutputUnion contains all possible properties and values from
-// [ResponseListResponseOutputMessage], [ResponseListResponseOutputWebSearchCall],
-// [ResponseListResponseOutputFileSearchCall],
-// [ResponseListResponseOutputFunctionCall], [ResponseListResponseOutputMcpCall],
-// [ResponseListResponseOutputMcpListTools],
-// [ResponseListResponseOutputMcpApprovalRequest].
+// ResponseNewResponseDataOutputUnion contains all possible properties and values
+// from [ResponseNewResponseDataOutputMessage],
+// [ResponseNewResponseDataOutputWebSearchCall],
+// [ResponseNewResponseDataOutputFileSearchCall],
+// [ResponseNewResponseDataOutputFunctionCall],
+// [ResponseNewResponseDataOutputMcpCall],
+// [ResponseNewResponseDataOutputMcpListTools],
+// [ResponseNewResponseDataOutputMcpApprovalRequest].
//
-// Use the [ResponseListResponseOutputUnion.AsAny] method to switch on the variant.
+// Use the [ResponseNewResponseDataOutputUnion.AsAny] method to switch on the
+// variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseOutputUnion struct {
- // This field is from variant [ResponseListResponseOutputMessage].
- Content ResponseListResponseOutputMessageContentUnion `json:"content"`
- // This field is from variant [ResponseListResponseOutputMessage].
- Role ResponseListResponseOutputMessageRole `json:"role"`
+type ResponseNewResponseDataOutputUnion struct {
+ // This field is from variant [ResponseNewResponseDataOutputMessage].
+ Content ResponseNewResponseDataOutputMessageContentUnion `json:"content"`
+ // This field is from variant [ResponseNewResponseDataOutputMessage].
+ Role ResponseNewResponseDataOutputMessageRole `json:"role"`
// Any of "message", "web_search_call", "file_search_call", "function_call",
// "mcp_call", "mcp_list_tools", "mcp_approval_request".
Type string `json:"type"`
ID string `json:"id"`
Status string `json:"status"`
- // This field is from variant [ResponseListResponseOutputFileSearchCall].
+ // This field is from variant [ResponseNewResponseDataOutputFileSearchCall].
Queries []string `json:"queries"`
- // This field is from variant [ResponseListResponseOutputFileSearchCall].
- Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
- Arguments string `json:"arguments"`
- // This field is from variant [ResponseListResponseOutputFunctionCall].
+ // This field is from variant [ResponseNewResponseDataOutputFileSearchCall].
+ Results []ResponseNewResponseDataOutputFileSearchCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ // This field is from variant [ResponseNewResponseDataOutputFunctionCall].
CallID string `json:"call_id"`
Name string `json:"name"`
ServerLabel string `json:"server_label"`
- // This field is from variant [ResponseListResponseOutputMcpCall].
+ // This field is from variant [ResponseNewResponseDataOutputMcpCall].
Error string `json:"error"`
- // This field is from variant [ResponseListResponseOutputMcpCall].
+ // This field is from variant [ResponseNewResponseDataOutputMcpCall].
Output string `json:"output"`
- // This field is from variant [ResponseListResponseOutputMcpListTools].
- Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools"`
+ // This field is from variant [ResponseNewResponseDataOutputMcpListTools].
+ Tools []ResponseNewResponseDataOutputMcpListToolsTool `json:"tools"`
JSON struct {
Content respjson.Field
Role respjson.Field
@@ -5479,35 +5503,35 @@ type ResponseListResponseOutputUnion struct {
} `json:"-"`
}
-// anyResponseListResponseOutput is implemented by each variant of
-// [ResponseListResponseOutputUnion] to add type safety for the return type of
-// [ResponseListResponseOutputUnion.AsAny]
-type anyResponseListResponseOutput interface {
- implResponseListResponseOutputUnion()
+// anyResponseNewResponseDataOutput is implemented by each variant of
+// [ResponseNewResponseDataOutputUnion] to add type safety for the return type of
+// [ResponseNewResponseDataOutputUnion.AsAny]
+type anyResponseNewResponseDataOutput interface {
+ implResponseNewResponseDataOutputUnion()
}
-func (ResponseListResponseOutputMessage) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputWebSearchCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputFileSearchCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputFunctionCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpApprovalRequest) implResponseListResponseOutputUnion() {}
+func (ResponseNewResponseDataOutputMessage) implResponseNewResponseDataOutputUnion() {}
+func (ResponseNewResponseDataOutputWebSearchCall) implResponseNewResponseDataOutputUnion() {}
+func (ResponseNewResponseDataOutputFileSearchCall) implResponseNewResponseDataOutputUnion() {}
+func (ResponseNewResponseDataOutputFunctionCall) implResponseNewResponseDataOutputUnion() {}
+func (ResponseNewResponseDataOutputMcpCall) implResponseNewResponseDataOutputUnion() {}
+func (ResponseNewResponseDataOutputMcpListTools) implResponseNewResponseDataOutputUnion() {}
+func (ResponseNewResponseDataOutputMcpApprovalRequest) implResponseNewResponseDataOutputUnion() {}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseListResponseOutputUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseOutputMessage:
-// case llamastackclient.ResponseListResponseOutputWebSearchCall:
-// case llamastackclient.ResponseListResponseOutputFileSearchCall:
-// case llamastackclient.ResponseListResponseOutputFunctionCall:
-// case llamastackclient.ResponseListResponseOutputMcpCall:
-// case llamastackclient.ResponseListResponseOutputMcpListTools:
-// case llamastackclient.ResponseListResponseOutputMcpApprovalRequest:
+// switch variant := ResponseNewResponseDataOutputUnion.AsAny().(type) {
+// case llamastackclient.ResponseNewResponseDataOutputMessage:
+// case llamastackclient.ResponseNewResponseDataOutputWebSearchCall:
+// case llamastackclient.ResponseNewResponseDataOutputFileSearchCall:
+// case llamastackclient.ResponseNewResponseDataOutputFunctionCall:
+// case llamastackclient.ResponseNewResponseDataOutputMcpCall:
+// case llamastackclient.ResponseNewResponseDataOutputMcpListTools:
+// case llamastackclient.ResponseNewResponseDataOutputMcpApprovalRequest:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseListResponseOutputUnion) AsAny() anyResponseListResponseOutput {
+func (u ResponseNewResponseDataOutputUnion) AsAny() anyResponseNewResponseDataOutput {
switch u.Type {
case "message":
return u.AsMessage()
@@ -5527,58 +5551,58 @@ func (u ResponseListResponseOutputUnion) AsAny() anyResponseListResponseOutput {
return nil
}
-func (u ResponseListResponseOutputUnion) AsMessage() (v ResponseListResponseOutputMessage) {
+func (u ResponseNewResponseDataOutputUnion) AsMessage() (v ResponseNewResponseDataOutputMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputUnion) AsWebSearchCall() (v ResponseListResponseOutputWebSearchCall) {
+func (u ResponseNewResponseDataOutputUnion) AsWebSearchCall() (v ResponseNewResponseDataOutputWebSearchCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputUnion) AsFileSearchCall() (v ResponseListResponseOutputFileSearchCall) {
+func (u ResponseNewResponseDataOutputUnion) AsFileSearchCall() (v ResponseNewResponseDataOutputFileSearchCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputUnion) AsFunctionCall() (v ResponseListResponseOutputFunctionCall) {
+func (u ResponseNewResponseDataOutputUnion) AsFunctionCall() (v ResponseNewResponseDataOutputFunctionCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputUnion) AsMcpCall() (v ResponseListResponseOutputMcpCall) {
+func (u ResponseNewResponseDataOutputUnion) AsMcpCall() (v ResponseNewResponseDataOutputMcpCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputUnion) AsMcpListTools() (v ResponseListResponseOutputMcpListTools) {
+func (u ResponseNewResponseDataOutputUnion) AsMcpListTools() (v ResponseNewResponseDataOutputMcpListTools) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputUnion) AsMcpApprovalRequest() (v ResponseListResponseOutputMcpApprovalRequest) {
+func (u ResponseNewResponseDataOutputUnion) AsMcpApprovalRequest() (v ResponseNewResponseDataOutputMcpApprovalRequest) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseNewResponseDataOutputUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseListResponseOutputUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
-type ResponseListResponseOutputMessage struct {
- Content ResponseListResponseOutputMessageContentUnion `json:"content,required"`
+type ResponseNewResponseDataOutputMessage struct {
+ Content ResponseNewResponseDataOutputMessageContentUnion `json:"content,required"`
// Any of "system", "developer", "user", "assistant".
- Role ResponseListResponseOutputMessageRole `json:"role,required"`
- Type constant.Message `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
+ Role ResponseNewResponseDataOutputMessageRole `json:"role,required"`
+ Type constant.Message `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -5592,80 +5616,81 @@ type ResponseListResponseOutputMessage struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessage) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMessage) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputMessage) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputMessage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseOutputMessageContentUnion contains all possible properties
-// and values from [string],
-// [[]ResponseListResponseOutputMessageContentArrayItemUnion],
-// [[]ResponseListResponseOutputMessageContentArrayItem].
+// ResponseNewResponseDataOutputMessageContentUnion contains all possible
+// properties and values from [string],
+// [[]ResponseNewResponseDataOutputMessageContentArrayItemUnion],
+// [[]ResponseNewResponseDataOutputMessageContentArrayItem].
//
// 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: OfString OfResponseListResponseOutputMessageContentArray
+// will be valid: OfString OfResponseNewResponseDataOutputMessageContentArray
// OfVariant2]
-type ResponseListResponseOutputMessageContentUnion struct {
+type ResponseNewResponseDataOutputMessageContentUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseListResponseOutputMessageContentArrayItemUnion] instead of an object.
- OfResponseListResponseOutputMessageContentArray []ResponseListResponseOutputMessageContentArrayItemUnion `json:",inline"`
+ // [[]ResponseNewResponseDataOutputMessageContentArrayItemUnion] instead of an
+ // object.
+ OfResponseNewResponseDataOutputMessageContentArray []ResponseNewResponseDataOutputMessageContentArrayItemUnion `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseListResponseOutputMessageContentArrayItem] instead of an object.
- OfVariant2 []ResponseListResponseOutputMessageContentArrayItem `json:",inline"`
+ // [[]ResponseNewResponseDataOutputMessageContentArrayItem] instead of an object.
+ OfVariant2 []ResponseNewResponseDataOutputMessageContentArrayItem `json:",inline"`
JSON struct {
- OfString respjson.Field
- OfResponseListResponseOutputMessageContentArray respjson.Field
- OfVariant2 respjson.Field
- raw string
+ OfString respjson.Field
+ OfResponseNewResponseDataOutputMessageContentArray respjson.Field
+ OfVariant2 respjson.Field
+ raw string
} `json:"-"`
}
-func (u ResponseListResponseOutputMessageContentUnion) AsString() (v string) {
+func (u ResponseNewResponseDataOutputMessageContentUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMessageContentUnion) AsResponseListResponseOutputMessageContentArray() (v []ResponseListResponseOutputMessageContentArrayItemUnion) {
+func (u ResponseNewResponseDataOutputMessageContentUnion) AsResponseNewResponseDataOutputMessageContentArray() (v []ResponseNewResponseDataOutputMessageContentArrayItemUnion) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMessageContentUnion) AsVariant2() (v []ResponseListResponseOutputMessageContentArrayItem) {
+func (u ResponseNewResponseDataOutputMessageContentUnion) AsVariant2() (v []ResponseNewResponseDataOutputMessageContentArrayItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseNewResponseDataOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseListResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseOutputMessageContentArrayItemUnion contains all possible
+// ResponseNewResponseDataOutputMessageContentArrayItemUnion contains all possible
// properties and values from
-// [ResponseListResponseOutputMessageContentArrayItemInputText],
-// [ResponseListResponseOutputMessageContentArrayItemInputImage].
+// [ResponseNewResponseDataOutputMessageContentArrayItemInputText],
+// [ResponseNewResponseDataOutputMessageContentArrayItemInputImage].
//
-// Use the [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny] method to
-// switch on the variant.
+// Use the [ResponseNewResponseDataOutputMessageContentArrayItemUnion.AsAny] method
+// to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseOutputMessageContentArrayItemUnion struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemUnion struct {
// This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemInputText].
+ // [ResponseNewResponseDataOutputMessageContentArrayItemInputText].
Text string `json:"text"`
// Any of "input_text", "input_image".
Type string `json:"type"`
// This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemInputImage].
- Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail"`
+ // [ResponseNewResponseDataOutputMessageContentArrayItemInputImage].
+ Detail ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail `json:"detail"`
// This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemInputImage].
+ // [ResponseNewResponseDataOutputMessageContentArrayItemInputImage].
ImageURL string `json:"image_url"`
JSON struct {
Text respjson.Field
@@ -5676,28 +5701,28 @@ type ResponseListResponseOutputMessageContentArrayItemUnion struct {
} `json:"-"`
}
-// anyResponseListResponseOutputMessageContentArrayItem is implemented by each
-// variant of [ResponseListResponseOutputMessageContentArrayItemUnion] to add type
-// safety for the return type of
-// [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny]
-type anyResponseListResponseOutputMessageContentArrayItem interface {
- implResponseListResponseOutputMessageContentArrayItemUnion()
+// anyResponseNewResponseDataOutputMessageContentArrayItem is implemented by each
+// variant of [ResponseNewResponseDataOutputMessageContentArrayItemUnion] to add
+// type safety for the return type of
+// [ResponseNewResponseDataOutputMessageContentArrayItemUnion.AsAny]
+type anyResponseNewResponseDataOutputMessageContentArrayItem interface {
+ implResponseNewResponseDataOutputMessageContentArrayItemUnion()
}
-func (ResponseListResponseOutputMessageContentArrayItemInputText) implResponseListResponseOutputMessageContentArrayItemUnion() {
+func (ResponseNewResponseDataOutputMessageContentArrayItemInputText) implResponseNewResponseDataOutputMessageContentArrayItemUnion() {
}
-func (ResponseListResponseOutputMessageContentArrayItemInputImage) implResponseListResponseOutputMessageContentArrayItemUnion() {
+func (ResponseNewResponseDataOutputMessageContentArrayItemInputImage) implResponseNewResponseDataOutputMessageContentArrayItemUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseListResponseOutputMessageContentArrayItemUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputText:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputImage:
+// switch variant := ResponseNewResponseDataOutputMessageContentArrayItemUnion.AsAny().(type) {
+// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemInputText:
+// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemInputImage:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItem {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsAny() anyResponseNewResponseDataOutputMessageContentArrayItem {
switch u.Type {
case "input_text":
return u.AsInputText()
@@ -5707,25 +5732,27 @@ func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsAny() anyRespo
return nil
}
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseOutputMessageContentArrayItemInputText) {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsInputText() (v ResponseNewResponseDataOutputMessageContentArrayItemInputText) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseOutputMessageContentArrayItemInputImage) {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsInputImage() (v ResponseNewResponseDataOutputMessageContentArrayItemInputImage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) RawJSON() string {
+ return u.JSON.raw
+}
-func (r *ResponseListResponseOutputMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Text content for input messages in OpenAI response format.
-type ResponseListResponseOutputMessageContentArrayItemInputText struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemInputText struct {
// The text content of the input message
Text string `json:"text,required"`
// Content type identifier, always "input_text"
@@ -5740,19 +5767,19 @@ type ResponseListResponseOutputMessageContentArrayItemInputText struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemInputText) RawJSON() string {
+func (r ResponseNewResponseDataOutputMessageContentArrayItemInputText) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content for input messages in OpenAI response format.
-type ResponseListResponseOutputMessageContentArrayItemInputImage struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemInputImage struct {
// Level of detail for image processing, can be "low", "high", or "auto"
//
// Any of "low", "high", "auto".
- Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail,required"`
+ Detail ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail `json:"detail,required"`
// Content type identifier, always "input_image"
Type constant.InputImage `json:"type,required"`
// (Optional) URL of the image content
@@ -5768,35 +5795,35 @@ type ResponseListResponseOutputMessageContentArrayItemInputImage struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemInputImage) RawJSON() string {
+func (r ResponseNewResponseDataOutputMessageContentArrayItemInputImage) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseOutputMessageContentArrayItemInputImageDetail string
+type ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail string
const (
- ResponseListResponseOutputMessageContentArrayItemInputImageDetailLow ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "low"
- ResponseListResponseOutputMessageContentArrayItemInputImageDetailHigh ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "high"
- ResponseListResponseOutputMessageContentArrayItemInputImageDetailAuto ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "auto"
+ ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetailLow ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail = "low"
+ ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetailHigh ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail = "high"
+ ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetailAuto ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail = "auto"
)
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseOutputMessageContentArrayItemDetail string
+type ResponseNewResponseDataOutputMessageContentArrayItemDetail string
const (
- ResponseListResponseOutputMessageContentArrayItemDetailLow ResponseListResponseOutputMessageContentArrayItemDetail = "low"
- ResponseListResponseOutputMessageContentArrayItemDetailHigh ResponseListResponseOutputMessageContentArrayItemDetail = "high"
- ResponseListResponseOutputMessageContentArrayItemDetailAuto ResponseListResponseOutputMessageContentArrayItemDetail = "auto"
+ ResponseNewResponseDataOutputMessageContentArrayItemDetailLow ResponseNewResponseDataOutputMessageContentArrayItemDetail = "low"
+ ResponseNewResponseDataOutputMessageContentArrayItemDetailHigh ResponseNewResponseDataOutputMessageContentArrayItemDetail = "high"
+ ResponseNewResponseDataOutputMessageContentArrayItemDetailAuto ResponseNewResponseDataOutputMessageContentArrayItemDetail = "auto"
)
-type ResponseListResponseOutputMessageContentArrayItem struct {
- Annotations []ResponseListResponseOutputMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
- Text string `json:"text,required"`
- Type constant.OutputText `json:"type,required"`
+type ResponseNewResponseDataOutputMessageContentArrayItem struct {
+ Annotations []ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
+ Text string `json:"text,required"`
+ Type constant.OutputText `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Annotations respjson.Field
@@ -5808,23 +5835,24 @@ type ResponseListResponseOutputMessageContentArrayItem struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItem) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputMessageContentArrayItem) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputMessageContentArrayItem) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseOutputMessageContentArrayItemAnnotationUnion contains all
+// ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion contains all
// possible properties and values from
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation],
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation],
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation],
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath].
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation],
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation],
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation],
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath].
//
-// Use the [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
+// Use the
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion.AsAny]
// method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseOutputMessageContentArrayItemAnnotationUnion struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion struct {
FileID string `json:"file_id"`
Filename string `json:"filename"`
Index int64 `json:"index"`
@@ -5833,13 +5861,13 @@ type ResponseListResponseOutputMessageContentArrayItemAnnotationUnion struct {
EndIndex int64 `json:"end_index"`
StartIndex int64 `json:"start_index"`
// This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation].
Title string `json:"title"`
// This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation].
URL string `json:"url"`
// This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation].
+ // [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation].
ContainerID string `json:"container_id"`
JSON struct {
FileID respjson.Field
@@ -5855,35 +5883,35 @@ type ResponseListResponseOutputMessageContentArrayItemAnnotationUnion struct {
} `json:"-"`
}
-// anyResponseListResponseOutputMessageContentArrayItemAnnotation is implemented by
-// each variant of
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion] to add type
-// safety for the return type of
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
-type anyResponseListResponseOutputMessageContentArrayItemAnnotation interface {
- implResponseListResponseOutputMessageContentArrayItemAnnotationUnion()
+// anyResponseNewResponseDataOutputMessageContentArrayItemAnnotation is implemented
+// by each variant of
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion] to add
+// type safety for the return type of
+// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion.AsAny]
+type anyResponseNewResponseDataOutputMessageContentArrayItemAnnotation interface {
+ implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion()
}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath:
+// switch variant := ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion.AsAny().(type) {
+// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation:
+// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation:
+// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation:
+// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItemAnnotation {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsAny() anyResponseNewResponseDataOutputMessageContentArrayItemAnnotation {
switch u.Type {
case "file_citation":
return u.AsFileCitation()
@@ -5897,37 +5925,37 @@ func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsAny(
return nil
}
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) RawJSON() string {
+func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File citation annotation for referencing specific files in response content.
-type ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation struct {
// Unique identifier of the referenced file
FileID string `json:"file_id,required"`
// Name of the referenced file
@@ -5948,15 +5976,15 @@ type ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation str
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
+func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// URL citation annotation for referencing external web resources.
-type ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation struct {
// End position of the citation span in the content
EndIndex int64 `json:"end_index,required"`
// Start position of the citation span in the content
@@ -5980,14 +6008,14 @@ type ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation stru
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
+func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation struct {
ContainerID string `json:"container_id,required"`
EndIndex int64 `json:"end_index,required"`
FileID string `json:"file_id,required"`
@@ -6008,14 +6036,14 @@ type ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCit
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
+func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath struct {
+type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath struct {
FileID string `json:"file_id,required"`
Index int64 `json:"index,required"`
Type constant.FilePath `json:"type,required"`
@@ -6030,24 +6058,24 @@ type ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath struct
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) RawJSON() string {
+func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseOutputMessageRole string
+type ResponseNewResponseDataOutputMessageRole string
const (
- ResponseListResponseOutputMessageRoleSystem ResponseListResponseOutputMessageRole = "system"
- ResponseListResponseOutputMessageRoleDeveloper ResponseListResponseOutputMessageRole = "developer"
- ResponseListResponseOutputMessageRoleUser ResponseListResponseOutputMessageRole = "user"
- ResponseListResponseOutputMessageRoleAssistant ResponseListResponseOutputMessageRole = "assistant"
+ ResponseNewResponseDataOutputMessageRoleSystem ResponseNewResponseDataOutputMessageRole = "system"
+ ResponseNewResponseDataOutputMessageRoleDeveloper ResponseNewResponseDataOutputMessageRole = "developer"
+ ResponseNewResponseDataOutputMessageRoleUser ResponseNewResponseDataOutputMessageRole = "user"
+ ResponseNewResponseDataOutputMessageRoleAssistant ResponseNewResponseDataOutputMessageRole = "assistant"
)
// Web search tool call output message for OpenAI responses.
-type ResponseListResponseOutputWebSearchCall struct {
+type ResponseNewResponseDataOutputWebSearchCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// Current status of the web search operation
@@ -6065,13 +6093,13 @@ type ResponseListResponseOutputWebSearchCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputWebSearchCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputWebSearchCall) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputWebSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputWebSearchCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File search tool call output message for OpenAI responses.
-type ResponseListResponseOutputFileSearchCall struct {
+type ResponseNewResponseDataOutputFileSearchCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// List of search queries executed
@@ -6081,7 +6109,7 @@ type ResponseListResponseOutputFileSearchCall struct {
// Tool call type identifier, always "file_search_call"
Type constant.FileSearchCall `json:"type,required"`
// (Optional) Search results returned by the file search operation
- Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
+ Results []ResponseNewResponseDataOutputFileSearchCallResult `json:"results"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -6095,15 +6123,15 @@ type ResponseListResponseOutputFileSearchCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputFileSearchCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputFileSearchCall) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputFileSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputFileSearchCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Search results returned by the file search operation.
-type ResponseListResponseOutputFileSearchCallResult struct {
+type ResponseNewResponseDataOutputFileSearchCallResult struct {
// (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseListResponseOutputFileSearchCallResultAttributeUnion `json:"attributes,required"`
+ Attributes map[string]ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion `json:"attributes,required"`
// Unique identifier of the file containing the result
FileID string `json:"file_id,required"`
// Name of the file containing the result
@@ -6125,19 +6153,19 @@ type ResponseListResponseOutputFileSearchCallResult struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputFileSearchCallResult) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputFileSearchCallResult) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputFileSearchCallResult) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputFileSearchCallResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseOutputFileSearchCallResultAttributeUnion contains all
+// ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion contains all
// possible properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseOutputFileSearchCallResultAttributeUnion struct {
+type ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -6155,37 +6183,37 @@ type ResponseListResponseOutputFileSearchCallResultAttributeUnion struct {
} `json:"-"`
}
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsBool() (v bool) {
+func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsFloat() (v float64) {
+func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsString() (v string) {
+func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsAnyArray() (v []any) {
+func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) RawJSON() string {
+func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseOutputFileSearchCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Function tool call output message for OpenAI responses.
-type ResponseListResponseOutputFunctionCall struct {
+type ResponseNewResponseDataOutputFunctionCall struct {
// JSON string containing the function arguments
Arguments string `json:"arguments,required"`
// Unique identifier for the function call
@@ -6212,13 +6240,13 @@ type ResponseListResponseOutputFunctionCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputFunctionCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputFunctionCall) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputFunctionCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputFunctionCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Model Context Protocol (MCP) call output message for OpenAI responses.
-type ResponseListResponseOutputMcpCall struct {
+type ResponseNewResponseDataOutputMcpCall struct {
// Unique identifier for this MCP call
ID string `json:"id,required"`
// JSON string containing the MCP call arguments
@@ -6248,19 +6276,19 @@ type ResponseListResponseOutputMcpCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpCall) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputMcpCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputMcpCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// MCP list tools output message containing available tools from an MCP server.
-type ResponseListResponseOutputMcpListTools struct {
+type ResponseNewResponseDataOutputMcpListTools struct {
// Unique identifier for this MCP list tools operation
ID string `json:"id,required"`
// Label identifying the MCP server providing the tools
ServerLabel string `json:"server_label,required"`
// List of available tools provided by the MCP server
- Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools,required"`
+ Tools []ResponseNewResponseDataOutputMcpListToolsTool `json:"tools,required"`
// Tool call type identifier, always "mcp_list_tools"
Type constant.McpListTools `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -6275,15 +6303,15 @@ type ResponseListResponseOutputMcpListTools struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpListTools) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpListTools) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputMcpListTools) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputMcpListTools) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Tool definition returned by MCP list tools operation.
-type ResponseListResponseOutputMcpListToolsTool struct {
+type ResponseNewResponseDataOutputMcpListToolsTool struct {
// JSON schema defining the tool's input parameters
- InputSchema map[string]ResponseListResponseOutputMcpListToolsToolInputSchemaUnion `json:"input_schema,required"`
+ InputSchema map[string]ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion `json:"input_schema,required"`
// Name of the tool
Name string `json:"name,required"`
// (Optional) Description of what the tool does
@@ -6299,19 +6327,19 @@ type ResponseListResponseOutputMcpListToolsTool struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpListToolsTool) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpListToolsTool) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputMcpListToolsTool) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputMcpListToolsTool) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseOutputMcpListToolsToolInputSchemaUnion contains all possible
-// properties and values from [bool], [float64], [string], [[]any].
+// ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion contains all
+// possible properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseOutputMcpListToolsToolInputSchemaUnion struct {
+type ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -6329,37 +6357,37 @@ type ResponseListResponseOutputMcpListToolsToolInputSchemaUnion struct {
} `json:"-"`
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsBool() (v bool) {
+func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsFloat() (v float64) {
+func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsString() (v string) {
+func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsAnyArray() (v []any) {
+func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) RawJSON() string {
+func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A request for human approval of a tool invocation.
-type ResponseListResponseOutputMcpApprovalRequest struct {
+type ResponseNewResponseDataOutputMcpApprovalRequest struct {
ID string `json:"id,required"`
Arguments string `json:"arguments,required"`
Name string `json:"name,required"`
@@ -6378,24 +6406,24 @@ type ResponseListResponseOutputMcpApprovalRequest struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseOutputRole string
+type ResponseNewResponseDataOutputRole string
const (
- ResponseListResponseOutputRoleSystem ResponseListResponseOutputRole = "system"
- ResponseListResponseOutputRoleDeveloper ResponseListResponseOutputRole = "developer"
- ResponseListResponseOutputRoleUser ResponseListResponseOutputRole = "user"
- ResponseListResponseOutputRoleAssistant ResponseListResponseOutputRole = "assistant"
+ ResponseNewResponseDataOutputRoleSystem ResponseNewResponseDataOutputRole = "system"
+ ResponseNewResponseDataOutputRoleDeveloper ResponseNewResponseDataOutputRole = "developer"
+ ResponseNewResponseDataOutputRoleUser ResponseNewResponseDataOutputRole = "user"
+ ResponseNewResponseDataOutputRoleAssistant ResponseNewResponseDataOutputRole = "assistant"
)
// Text formatting configuration for the response
-type ResponseListResponseText struct {
+type ResponseNewResponseDataText struct {
// (Optional) Text format configuration specifying output format requirements
- Format ResponseListResponseTextFormat `json:"format"`
+ Format ResponseNewResponseDataTextFormat `json:"format"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Format respjson.Field
@@ -6405,24 +6433,24 @@ type ResponseListResponseText struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseText) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseText) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataText) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Text format configuration specifying output format requirements
-type ResponseListResponseTextFormat struct {
+type ResponseNewResponseDataTextFormat struct {
// Must be "text", "json_schema", or "json_object" to identify the format type
//
// Any of "text", "json_schema", "json_object".
- Type ResponseListResponseTextFormatType `json:"type,required"`
+ Type ResponseNewResponseDataTextFormatType `json:"type,required"`
// (Optional) A description of the response format. Only used for json_schema.
Description string `json:"description"`
// The name of the response format. Only used for json_schema.
Name string `json:"name"`
// The JSON schema the response should conform to. In a Python SDK, this is often a
// `pydantic` model. Only used for json_schema.
- Schema map[string]ResponseListResponseTextFormatSchemaUnion `json:"schema"`
+ Schema map[string]ResponseNewResponseDataTextFormatSchemaUnion `json:"schema"`
// (Optional) Whether to strictly enforce the JSON schema. If true, the response
// must match the schema exactly. Only used for json_schema.
Strict bool `json:"strict"`
@@ -6439,28 +6467,28 @@ type ResponseListResponseTextFormat struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseTextFormat) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseTextFormat) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataTextFormat) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataTextFormat) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Must be "text", "json_schema", or "json_object" to identify the format type
-type ResponseListResponseTextFormatType string
+type ResponseNewResponseDataTextFormatType string
const (
- ResponseListResponseTextFormatTypeText ResponseListResponseTextFormatType = "text"
- ResponseListResponseTextFormatTypeJsonSchema ResponseListResponseTextFormatType = "json_schema"
- ResponseListResponseTextFormatTypeJsonObject ResponseListResponseTextFormatType = "json_object"
+ ResponseNewResponseDataTextFormatTypeText ResponseNewResponseDataTextFormatType = "text"
+ ResponseNewResponseDataTextFormatTypeJsonSchema ResponseNewResponseDataTextFormatType = "json_schema"
+ ResponseNewResponseDataTextFormatTypeJsonObject ResponseNewResponseDataTextFormatType = "json_object"
)
-// ResponseListResponseTextFormatSchemaUnion contains all possible properties and
-// values from [bool], [float64], [string], [[]any].
+// ResponseNewResponseDataTextFormatSchemaUnion contains all possible properties
+// and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseTextFormatSchemaUnion struct {
+type ResponseNewResponseDataTextFormatSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -6478,35 +6506,35 @@ type ResponseListResponseTextFormatSchemaUnion struct {
} `json:"-"`
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsBool() (v bool) {
+func (u ResponseNewResponseDataTextFormatSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsFloat() (v float64) {
+func (u ResponseNewResponseDataTextFormatSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsString() (v string) {
+func (u ResponseNewResponseDataTextFormatSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsAnyArray() (v []any) {
+func (u ResponseNewResponseDataTextFormatSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseListResponseTextFormatSchemaUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseNewResponseDataTextFormatSchemaUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseListResponseTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewResponseDataTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Error details if the response generation failed
-type ResponseListResponseError struct {
+type ResponseNewResponseDataError struct {
// Error code identifying the type of failure
Code string `json:"code,required"`
// Human-readable error message describing the failure
@@ -6521,349 +6549,234 @@ type ResponseListResponseError struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponseError) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseError) UnmarshalJSON(data []byte) error {
+func (r ResponseNewResponseDataError) RawJSON() string { return r.JSON.raw }
+func (r *ResponseNewResponseDataError) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Response object confirming deletion of an OpenAI response.
-type ResponseDeleteResponse struct {
- // Unique identifier of the deleted response
+// OpenAI response object extended with input context information.
+type ResponseListResponse struct {
+ // Unique identifier for this response
ID string `json:"id,required"`
- // Deletion confirmation flag, always True
- Deleted bool `json:"deleted,required"`
+ // Unix timestamp when the response was created
+ CreatedAt int64 `json:"created_at,required"`
+ // List of input items that led to this response
+ Input []ResponseListResponseInputUnion `json:"input,required"`
+ // Model identifier used for generation
+ Model string `json:"model,required"`
// Object type identifier, always "response"
Object constant.Response `json:"object,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Deleted respjson.Field
- Object respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseDeleteResponse) RawJSON() string { return r.JSON.raw }
-func (r *ResponseDeleteResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ResponseNewParams struct {
- // Input message(s) to create the response.
- Input ResponseNewParamsInputUnion `json:"input,omitzero,required"`
- // The underlying LLM used for completions.
- Model string `json:"model,required"`
- Instructions param.Opt[string] `json:"instructions,omitzero"`
- MaxInferIters param.Opt[int64] `json:"max_infer_iters,omitzero"`
- // (Optional) if specified, the new response will be a continuation of the previous
- // response. This can be used to easily fork-off new responses from existing
- // responses.
- PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
- Store param.Opt[bool] `json:"store,omitzero"`
- Temperature param.Opt[float64] `json:"temperature,omitzero"`
- // (Optional) Additional fields to include in the response.
- Include []string `json:"include,omitzero"`
- // Text response configuration for OpenAI responses.
- Text ResponseNewParamsText `json:"text,omitzero"`
- Tools []ResponseNewParamsToolUnion `json:"tools,omitzero"`
- paramObj
+ // List of generated output items (messages, tool calls, etc.)
+ Output []ResponseListResponseOutputUnion `json:"output,required"`
+ // Whether tool calls can be executed in parallel
+ ParallelToolCalls bool `json:"parallel_tool_calls,required"`
+ // Current status of the response generation
+ Status string `json:"status,required"`
+ // Text formatting configuration for the response
+ Text ResponseListResponseText `json:"text,required"`
+ // (Optional) Error details if the response generation failed
+ Error ResponseListResponseError `json:"error"`
+ // (Optional) ID of the previous response in a conversation
+ PreviousResponseID string `json:"previous_response_id"`
+ // (Optional) Sampling temperature used for generation
+ Temperature float64 `json:"temperature"`
+ // (Optional) Nucleus sampling parameter used for generation
+ TopP float64 `json:"top_p"`
+ // (Optional) Truncation strategy applied to the response
+ Truncation string `json:"truncation"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ CreatedAt respjson.Field
+ Input respjson.Field
+ Model respjson.Field
+ Object respjson.Field
+ Output respjson.Field
+ ParallelToolCalls respjson.Field
+ Status respjson.Field
+ Text respjson.Field
+ Error respjson.Field
+ PreviousResponseID respjson.Field
+ Temperature respjson.Field
+ TopP respjson.Field
+ Truncation respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParams) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParams) UnmarshalJSON(data []byte) error {
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponse) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsInputUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfResponseNewsInputArray []ResponseNewParamsInputArrayItemUnion `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsInputUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfResponseNewsInputArray)
-}
-func (u *ResponseNewParamsInputUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsInputUnion) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfResponseNewsInputArray) {
- return &u.OfResponseNewsInputArray
- }
- return nil
-}
-
-// Only one field can be non-zero.
+// ResponseListResponseInputUnion contains all possible properties and values from
+// [ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall],
+// [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall],
+// [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall],
+// [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput],
+// [ResponseListResponseInputOpenAIResponseMcpApprovalRequest],
+// [ResponseListResponseInputOpenAIResponseMcpApprovalResponse],
+// [ResponseListResponseInputOpenAIResponseMessage].
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsInputArrayItemUnion struct {
- OfOpenAIResponseOutputMessageWebSearchToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall `json:",omitzero,inline"`
- OfOpenAIResponseOutputMessageFileSearchToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall `json:",omitzero,inline"`
- OfOpenAIResponseOutputMessageFunctionToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall `json:",omitzero,inline"`
- OfOpenAIResponseInputFunctionToolCallOutput *ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput `json:",omitzero,inline"`
- OfOpenAIResponseMcpApprovalRequest *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest `json:",omitzero,inline"`
- OfOpenAIResponseMcpApprovalResponse *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse `json:",omitzero,inline"`
- OfOpenAIResponseMessage *ResponseNewParamsInputArrayItemOpenAIResponseMessage `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsInputArrayItemUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfOpenAIResponseOutputMessageWebSearchToolCall,
- u.OfOpenAIResponseOutputMessageFileSearchToolCall,
- u.OfOpenAIResponseOutputMessageFunctionToolCall,
- u.OfOpenAIResponseInputFunctionToolCallOutput,
- u.OfOpenAIResponseMcpApprovalRequest,
- u.OfOpenAIResponseMcpApprovalResponse,
- u.OfOpenAIResponseMessage)
-}
-func (u *ResponseNewParamsInputArrayItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsInputArrayItemUnion) asAny() any {
- if !param.IsOmitted(u.OfOpenAIResponseOutputMessageWebSearchToolCall) {
- return u.OfOpenAIResponseOutputMessageWebSearchToolCall
- } else if !param.IsOmitted(u.OfOpenAIResponseOutputMessageFileSearchToolCall) {
- return u.OfOpenAIResponseOutputMessageFileSearchToolCall
- } else if !param.IsOmitted(u.OfOpenAIResponseOutputMessageFunctionToolCall) {
- return u.OfOpenAIResponseOutputMessageFunctionToolCall
- } else if !param.IsOmitted(u.OfOpenAIResponseInputFunctionToolCallOutput) {
- return u.OfOpenAIResponseInputFunctionToolCallOutput
- } else if !param.IsOmitted(u.OfOpenAIResponseMcpApprovalRequest) {
- return u.OfOpenAIResponseMcpApprovalRequest
- } else if !param.IsOmitted(u.OfOpenAIResponseMcpApprovalResponse) {
- return u.OfOpenAIResponseMcpApprovalResponse
- } else if !param.IsOmitted(u.OfOpenAIResponseMessage) {
- return u.OfOpenAIResponseMessage
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetQueries() []string {
- if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
- return vt.Queries
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetResults() []ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult {
- if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
- return vt.Results
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetOutput() *string {
- if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
- return &vt.Output
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetServerLabel() *string {
- if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
- return &vt.ServerLabel
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetApprovalRequestID() *string {
- if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
- return &vt.ApprovalRequestID
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetApprove() *bool {
- if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
- return &vt.Approve
- }
- return nil
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseListResponseInputUnion struct {
+ ID string `json:"id"`
+ Status string `json:"status"`
+ Type string `json:"type"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
+ Queries []string `json:"queries"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
+ Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput].
+ Output string `json:"output"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalRequest].
+ ServerLabel string `json:"server_label"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ ApprovalRequestID string `json:"approval_request_id"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ Approve bool `json:"approve"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
+ Reason string `json:"reason"`
+ // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
+ Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content"`
+ // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
+ Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role"`
+ JSON struct {
+ ID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Output respjson.Field
+ ServerLabel respjson.Field
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Reason respjson.Field
+ Content respjson.Field
+ Role respjson.Field
+ raw string
+ } `json:"-"`
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetReason() *string {
- if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil && vt.Reason.Valid() {
- return &vt.Reason.Value
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageWebSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetContent() *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion {
- if vt := u.OfOpenAIResponseMessage; vt != nil {
- return &vt.Content
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFileSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetRole() *string {
- if vt := u.OfOpenAIResponseMessage; vt != nil {
- return (*string)(&vt.Role)
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFunctionToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetID() *string {
- if vt := u.OfOpenAIResponseOutputMessageWebSearchToolCall; vt != nil {
- return (*string)(&vt.ID)
- } else if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
- return (*string)(&vt.ID)
- } else if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil && vt.ID.Valid() {
- return &vt.ID.Value
- } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil && vt.ID.Valid() {
- return &vt.ID.Value
- } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
- return (*string)(&vt.ID)
- } else if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil && vt.ID.Valid() {
- return &vt.ID.Value
- } else if vt := u.OfOpenAIResponseMessage; vt != nil && vt.ID.Valid() {
- return &vt.ID.Value
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseInputFunctionToolCallOutput() (v ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetStatus() *string {
- if vt := u.OfOpenAIResponseOutputMessageWebSearchToolCall; vt != nil {
- return (*string)(&vt.Status)
- } else if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
- return (*string)(&vt.Status)
- } else if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil && vt.Status.Valid() {
- return &vt.Status.Value
- } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil && vt.Status.Valid() {
- return &vt.Status.Value
- } else if vt := u.OfOpenAIResponseMessage; vt != nil && vt.Status.Valid() {
- return &vt.Status.Value
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseListResponseInputOpenAIResponseMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetType() *string {
- if vt := u.OfOpenAIResponseOutputMessageWebSearchToolCall; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfOpenAIResponseMessage; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseListResponseInputOpenAIResponseMcpApprovalResponse) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetArguments() *string {
- if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
- return (*string)(&vt.Arguments)
- } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
- return (*string)(&vt.Arguments)
- }
- return nil
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMessage() (v ResponseListResponseInputOpenAIResponseMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetCallID() *string {
- if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
- return (*string)(&vt.CallID)
- } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
- return (*string)(&vt.CallID)
- }
- return nil
-}
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseInputUnion) RawJSON() string { return u.JSON.raw }
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemUnion) GetName() *string {
- if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
- return (*string)(&vt.Name)
- } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
- return (*string)(&vt.Name)
- }
- return nil
+func (r *ResponseListResponseInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
// Web search tool call output message for OpenAI responses.
-//
-// The properties ID, Status, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// Current status of the web search operation
Status string `json:"status,required"`
// Tool call type identifier, always "web_search_call"
- //
- // This field can be elided, and will marshal its zero value as "web_search_call".
Type constant.WebSearchCall `json:"type,required"`
- paramObj
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File search tool call output message for OpenAI responses.
-//
-// The properties ID, Queries, Status, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// List of search queries executed
- Queries []string `json:"queries,omitzero,required"`
+ Queries []string `json:"queries,required"`
// Current status of the file search operation
Status string `json:"status,required"`
- // (Optional) Search results returned by the file search operation
- Results []ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results,omitzero"`
// Tool call type identifier, always "file_search_call"
- //
- // This field can be elided, and will marshal its zero value as "file_search_call".
Type constant.FileSearchCall `json:"type,required"`
- paramObj
+ // (Optional) Search results returned by the file search operation
+ Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Queries respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Results respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Search results returned by the file search operation.
-//
-// The properties Attributes, FileID, Filename, Score, Text are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult struct {
// (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,omitzero,required"`
+ Attributes map[string]ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,required"`
// Unique identifier of the file containing the result
FileID string `json:"file_id,required"`
// Name of the file containing the result
@@ -6872,470 +6785,568 @@ type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCal
Score float64 `json:"score,required"`
// Text content of the search result
Text string `json:"text,required"`
- paramObj
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Attributes respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ Score respjson.Field
+ Text respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
+// ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion
+// contains all possible properties and values from [bool], [float64], [string],
+// [[]any].
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// Function tool call output message for OpenAI responses.
+// Use the methods beginning with 'As' to cast the union to one of its variants.
//
-// The properties Arguments, CallID, Name, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall struct {
- // JSON string containing the function arguments
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBool OfFloat OfString OfAnyArray]
+type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Function tool call output message for OpenAI responses.
+type ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall struct {
+ // JSON string containing the function arguments
Arguments string `json:"arguments,required"`
// Unique identifier for the function call
CallID string `json:"call_id,required"`
// Name of the function being called
Name string `json:"name,required"`
- // (Optional) Additional identifier for the tool call
- ID param.Opt[string] `json:"id,omitzero"`
- // (Optional) Current status of the function call execution
- Status param.Opt[string] `json:"status,omitzero"`
// Tool call type identifier, always "function_call"
- //
- // This field can be elided, and will marshal its zero value as "function_call".
Type constant.FunctionCall `json:"type,required"`
- paramObj
+ // (Optional) Additional identifier for the tool call
+ ID string `json:"id"`
+ // (Optional) Current status of the function call execution
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// This represents the output of a function call that gets passed back to the
// model.
-//
-// The properties CallID, Output, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput struct {
- CallID string `json:"call_id,required"`
- Output string `json:"output,required"`
- ID param.Opt[string] `json:"id,omitzero"`
- Status param.Opt[string] `json:"status,omitzero"`
- // This field can be elided, and will marshal its zero value as
- // "function_call_output".
- Type constant.FunctionCallOutput `json:"type,required"`
- paramObj
+type ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput struct {
+ CallID string `json:"call_id,required"`
+ Output string `json:"output,required"`
+ Type constant.FunctionCallOutput `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ CallID respjson.Field
+ Output respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A request for human approval of a tool invocation.
-//
-// The properties ID, Arguments, Name, ServerLabel, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest struct {
- ID string `json:"id,required"`
- Arguments string `json:"arguments,required"`
- Name string `json:"name,required"`
- ServerLabel string `json:"server_label,required"`
- // This field can be elided, and will marshal its zero value as
- // "mcp_approval_request".
- Type constant.McpApprovalRequest `json:"type,required"`
- paramObj
+type ResponseListResponseInputOpenAIResponseMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A response to an MCP approval request.
-//
-// The properties ApprovalRequestID, Approve, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse struct {
- ApprovalRequestID string `json:"approval_request_id,required"`
- Approve bool `json:"approve,required"`
- ID param.Opt[string] `json:"id,omitzero"`
- Reason param.Opt[string] `json:"reason,omitzero"`
- // This field can be elided, and will marshal its zero value as
- // "mcp_approval_response".
- Type constant.McpApprovalResponse `json:"type,required"`
- paramObj
+type ResponseListResponseInputOpenAIResponseMcpApprovalResponse struct {
+ ApprovalRequestID string `json:"approval_request_id,required"`
+ Approve bool `json:"approve,required"`
+ Type constant.McpApprovalResponse `json:"type,required"`
+ ID string `json:"id"`
+ Reason string `json:"reason"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ApprovalRequestID respjson.Field
+ Approve respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Reason respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
-//
-// The properties Content, Role, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessage struct {
- Content ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion `json:"content,omitzero,required"`
+type ResponseListResponseInputOpenAIResponseMessage struct {
+ Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content,required"`
// Any of "system", "developer", "user", "assistant".
- Role ResponseNewParamsInputArrayItemOpenAIResponseMessageRole `json:"role,omitzero,required"`
- ID param.Opt[string] `json:"id,omitzero"`
- Status param.Opt[string] `json:"status,omitzero"`
- // This field can be elided, and will marshal its zero value as "message".
- Type constant.Message `json:"type,required"`
- paramObj
+ Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role,required"`
+ Type constant.Message `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessage) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessage
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessage) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseInputOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
+// ResponseListResponseInputOpenAIResponseMessageContentUnion contains all possible
+// properties and values from [string],
+// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion],
+// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem].
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray []ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion `json:",omitzero,inline"`
- OfVariant2 []ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem `json:",omitzero,inline"`
- paramUnion
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfString
+// OfResponseListResponseInputOpenAIResponseMessageContentArray OfVariant2]
+type ResponseListResponseInputOpenAIResponseMessageContentUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] instead
+ // of an object.
+ OfResponseListResponseInputOpenAIResponseMessageContentArray []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem] instead of an
+ // object.
+ OfVariant2 []ResponseListResponseInputOpenAIResponseMessageContentArrayItem `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfResponseListResponseInputOpenAIResponseMessageContentArray respjson.Field
+ OfVariant2 respjson.Field
+ raw string
+ } `json:"-"`
}
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray, u.OfVariant2)
-}
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray) {
- return &u.OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray
- } else if !param.IsOmitted(u.OfVariant2) {
- return &u.OfVariant2
- }
- return nil
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsResponseListResponseInputOpenAIResponseMessageContentArray() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion struct {
- OfInputText *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText `json:",omitzero,inline"`
- OfInputImage *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage `json:",omitzero,inline"`
- paramUnion
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsVariant2() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfInputText, u.OfInputImage)
-}
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) RawJSON() string {
+ return u.JSON.raw
}
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) asAny() any {
- if !param.IsOmitted(u.OfInputText) {
- return u.OfInputText
- } else if !param.IsOmitted(u.OfInputImage) {
- return u.OfInputImage
- }
- return nil
+func (r *ResponseListResponseInputOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetText() *string {
- if vt := u.OfInputText; vt != nil {
- return &vt.Text
- }
- return nil
+// ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion contains all
+// possible properties and values from
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
+//
+// Use the
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion struct {
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image".
+ Type string `json:"type"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
+ Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
+ ImageURL string `json:"image_url"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ Detail respjson.Field
+ ImageURL respjson.Field
+ raw string
+ } `json:"-"`
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetDetail() *string {
- if vt := u.OfInputImage; vt != nil {
- return (*string)(&vt.Detail)
- }
- return nil
+// anyResponseListResponseInputOpenAIResponseMessageContentArrayItem is implemented
+// by each variant of
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] to add
+// type safety for the return type of
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
+type anyResponseListResponseInputOpenAIResponseMessageContentArrayItem interface {
+ implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion()
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetImageURL() *string {
- if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
- return &vt.ImageURL.Value
- }
- return nil
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
+}
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetType() *string {
- if vt := u.OfInputText; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfInputImage; vt != nil {
- return (*string)(&vt.Type)
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItem {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
}
return nil
}
-func init() {
- apijson.RegisterUnion[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion](
- "type",
- apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText]("input_text"),
- apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage]("input_image"),
- )
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
// Text content for input messages in OpenAI response format.
-//
-// The properties Text, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText struct {
// The text content of the input message
Text string `json:"text,required"`
// Content type identifier, always "input_text"
- //
- // This field can be elided, and will marshal its zero value as "input_text".
Type constant.InputText `json:"type,required"`
- paramObj
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content for input messages in OpenAI response format.
-//
-// The properties Detail, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage struct {
// Level of detail for image processing, can be "low", "high", or "auto"
//
// Any of "low", "high", "auto".
- Detail ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,omitzero,required"`
- // (Optional) URL of the image content
- ImageURL param.Opt[string] `json:"image_url,omitzero"`
+ Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,required"`
// Content type identifier, always "input_image"
- //
- // This field can be elided, and will marshal its zero value as "input_image".
Type constant.InputImage `json:"type,required"`
- paramObj
+ // (Optional) URL of the image content
+ ImageURL string `json:"image_url"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Detail respjson.Field
+ Type respjson.Field
+ ImageURL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail string
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail string
const (
- ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
- ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
- ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
)
-// The properties Annotations, Text, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem struct {
- Annotations []ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,omitzero,required"`
- Text string `json:"text,required"`
- // This field can be elided, and will marshal its zero value as "output_text".
- Type constant.OutputText `json:"type,required"`
- paramObj
+// Level of detail for image processing, can be "low", "high", or "auto"
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail string
+
+const (
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "low"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "high"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "auto"
+)
+
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItem struct {
+ Annotations []ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
+ Text string `json:"text,required"`
+ Type constant.OutputText `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItem) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
+// ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion
+// contains all possible properties and values from
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath].
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
- OfFileCitation *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation `json:",omitzero,inline"`
- OfURLCitation *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation `json:",omitzero,inline"`
- OfContainerFileCitation *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation `json:",omitzero,inline"`
- OfFilePath *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfFileCitation, u.OfURLCitation, u.OfContainerFileCitation, u.OfFilePath)
-}
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) asAny() any {
- if !param.IsOmitted(u.OfFileCitation) {
- return u.OfFileCitation
- } else if !param.IsOmitted(u.OfURLCitation) {
- return u.OfURLCitation
- } else if !param.IsOmitted(u.OfContainerFileCitation) {
- return u.OfContainerFileCitation
- } else if !param.IsOmitted(u.OfFilePath) {
- return u.OfFilePath
- }
- return nil
+// Use the
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
+ FileID string `json:"file_id"`
+ Filename string `json:"filename"`
+ Index int64 `json:"index"`
+ // Any of "file_citation", "url_citation", "container_file_citation", "file_path".
+ Type string `json:"type"`
+ EndIndex int64 `json:"end_index"`
+ StartIndex int64 `json:"start_index"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
+ Title string `json:"title"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
+ URL string `json:"url"`
+ // This field is from variant
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ URL respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetTitle() *string {
- if vt := u.OfURLCitation; vt != nil {
- return &vt.Title
- }
- return nil
+// anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation is
+// implemented by each variant of
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion]
+// to add type safety for the return type of
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
+type anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation interface {
+ implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion()
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetURL() *string {
- if vt := u.OfURLCitation; vt != nil {
- return &vt.URL
- }
- return nil
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetContainerID() *string {
- if vt := u.OfContainerFileCitation; vt != nil {
- return &vt.ContainerID
- }
- return nil
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+}
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+}
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetFileID() *string {
- if vt := u.OfFileCitation; vt != nil {
- return (*string)(&vt.FileID)
- } else if vt := u.OfContainerFileCitation; vt != nil {
- return (*string)(&vt.FileID)
- } else if vt := u.OfFilePath; vt != nil {
- return (*string)(&vt.FileID)
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation {
+ switch u.Type {
+ case "file_citation":
+ return u.AsFileCitation()
+ case "url_citation":
+ return u.AsURLCitation()
+ case "container_file_citation":
+ return u.AsContainerFileCitation()
+ case "file_path":
+ return u.AsFilePath()
}
return nil
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetFilename() *string {
- if vt := u.OfFileCitation; vt != nil {
- return (*string)(&vt.Filename)
- } else if vt := u.OfContainerFileCitation; vt != nil {
- return (*string)(&vt.Filename)
- }
- return nil
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetIndex() *int64 {
- if vt := u.OfFileCitation; vt != nil {
- return (*int64)(&vt.Index)
- } else if vt := u.OfFilePath; vt != nil {
- return (*int64)(&vt.Index)
- }
- return nil
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetType() *string {
- if vt := u.OfFileCitation; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfURLCitation; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfContainerFileCitation; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfFilePath; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetEndIndex() *int64 {
- if vt := u.OfURLCitation; vt != nil {
- return (*int64)(&vt.EndIndex)
- } else if vt := u.OfContainerFileCitation; vt != nil {
- return (*int64)(&vt.EndIndex)
- }
- return nil
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetStartIndex() *int64 {
- if vt := u.OfURLCitation; vt != nil {
- return (*int64)(&vt.StartIndex)
- } else if vt := u.OfContainerFileCitation; vt != nil {
- return (*int64)(&vt.StartIndex)
- }
- return nil
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) RawJSON() string {
+ return u.JSON.raw
}
-func init() {
- apijson.RegisterUnion[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion](
- "type",
- apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation]("file_citation"),
- apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation]("url_citation"),
- apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation]("container_file_citation"),
- apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath]("file_path"),
- )
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
// File citation annotation for referencing specific files in response content.
-//
-// The properties FileID, Filename, Index, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
// Unique identifier of the referenced file
FileID string `json:"file_id,required"`
// Name of the referenced file
@@ -7343,661 +7354,1280 @@ type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotat
// Position index of the citation within the content
Index int64 `json:"index,required"`
// Annotation type identifier, always "file_citation"
- //
- // This field can be elided, and will marshal its zero value as "file_citation".
Type constant.FileCitation `json:"type,required"`
- paramObj
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// URL citation annotation for referencing external web resources.
-//
-// The properties EndIndex, StartIndex, Title, Type, URL are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
// End position of the citation span in the content
EndIndex int64 `json:"end_index,required"`
// Start position of the citation span in the content
StartIndex int64 `json:"start_index,required"`
// Title of the referenced web resource
Title string `json:"title,required"`
- // URL of the referenced web resource
- URL string `json:"url,required"`
// Annotation type identifier, always "url_citation"
- //
- // This field can be elided, and will marshal its zero value as "url_citation".
Type constant.URLCitation `json:"type,required"`
- paramObj
+ // URL of the referenced web resource
+ URL string `json:"url,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The properties ContainerID, EndIndex, FileID, Filename, StartIndex, Type are
-// required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
- ContainerID string `json:"container_id,required"`
- EndIndex int64 `json:"end_index,required"`
- FileID string `json:"file_id,required"`
- Filename string `json:"filename,required"`
- StartIndex int64 `json:"start_index,required"`
- // This field can be elided, and will marshal its zero value as
- // "container_file_citation".
- Type constant.ContainerFileCitation `json:"type,required"`
- paramObj
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
+ ContainerID string `json:"container_id,required"`
+ EndIndex int64 `json:"end_index,required"`
+ FileID string `json:"file_id,required"`
+ Filename string `json:"filename,required"`
+ StartIndex int64 `json:"start_index,required"`
+ Type constant.ContainerFileCitation `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContainerID respjson.Field
+ EndIndex respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ StartIndex respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The properties FileID, Index, Type are required.
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
- FileID string `json:"file_id,required"`
- Index int64 `json:"index,required"`
- // This field can be elided, and will marshal its zero value as "file_path".
- Type constant.FilePath `json:"type,required"`
- paramObj
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
+ FileID string `json:"file_id,required"`
+ Index int64 `json:"index,required"`
+ Type constant.FilePath `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) RawJSON() string {
+ return r.JSON.raw
}
-func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewParamsInputArrayItemOpenAIResponseMessageRole string
+type ResponseListResponseInputOpenAIResponseMessageRole string
const (
- ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleSystem ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "system"
- ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleDeveloper ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "developer"
- ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleUser ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "user"
- ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleAssistant ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "assistant"
+ ResponseListResponseInputOpenAIResponseMessageRoleSystem ResponseListResponseInputOpenAIResponseMessageRole = "system"
+ ResponseListResponseInputOpenAIResponseMessageRoleDeveloper ResponseListResponseInputOpenAIResponseMessageRole = "developer"
+ ResponseListResponseInputOpenAIResponseMessageRoleUser ResponseListResponseInputOpenAIResponseMessageRole = "user"
+ ResponseListResponseInputOpenAIResponseMessageRoleAssistant ResponseListResponseInputOpenAIResponseMessageRole = "assistant"
)
-// Text response configuration for OpenAI responses.
-type ResponseNewParamsText struct {
- // (Optional) Text format configuration specifying output format requirements
- Format ResponseNewParamsTextFormat `json:"format,omitzero"`
- paramObj
-}
+type ResponseListResponseInputRole string
-func (r ResponseNewParamsText) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsText
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsText) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
+const (
+ ResponseListResponseInputRoleSystem ResponseListResponseInputRole = "system"
+ ResponseListResponseInputRoleDeveloper ResponseListResponseInputRole = "developer"
+ ResponseListResponseInputRoleUser ResponseListResponseInputRole = "user"
+ ResponseListResponseInputRoleAssistant ResponseListResponseInputRole = "assistant"
+)
-// (Optional) Text format configuration specifying output format requirements
+// ResponseListResponseOutputUnion contains all possible properties and values from
+// [ResponseListResponseOutputMessage], [ResponseListResponseOutputWebSearchCall],
+// [ResponseListResponseOutputFileSearchCall],
+// [ResponseListResponseOutputFunctionCall], [ResponseListResponseOutputMcpCall],
+// [ResponseListResponseOutputMcpListTools],
+// [ResponseListResponseOutputMcpApprovalRequest].
//
-// The property Type is required.
-type ResponseNewParamsTextFormat struct {
- // Must be "text", "json_schema", or "json_object" to identify the format type
- //
- // Any of "text", "json_schema", "json_object".
- Type ResponseNewParamsTextFormatType `json:"type,omitzero,required"`
- // (Optional) A description of the response format. Only used for json_schema.
- Description param.Opt[string] `json:"description,omitzero"`
- // The name of the response format. Only used for json_schema.
- Name param.Opt[string] `json:"name,omitzero"`
- // (Optional) Whether to strictly enforce the JSON schema. If true, the response
- // must match the schema exactly. Only used for json_schema.
- Strict param.Opt[bool] `json:"strict,omitzero"`
- // The JSON schema the response should conform to. In a Python SDK, this is often a
- // `pydantic` model. Only used for json_schema.
- Schema map[string]ResponseNewParamsTextFormatSchemaUnion `json:"schema,omitzero"`
- paramObj
+// Use the [ResponseListResponseOutputUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseListResponseOutputUnion struct {
+ // This field is from variant [ResponseListResponseOutputMessage].
+ Content ResponseListResponseOutputMessageContentUnion `json:"content"`
+ // This field is from variant [ResponseListResponseOutputMessage].
+ Role ResponseListResponseOutputMessageRole `json:"role"`
+ // Any of "message", "web_search_call", "file_search_call", "function_call",
+ // "mcp_call", "mcp_list_tools", "mcp_approval_request".
+ Type string `json:"type"`
+ ID string `json:"id"`
+ Status string `json:"status"`
+ // This field is from variant [ResponseListResponseOutputFileSearchCall].
+ Queries []string `json:"queries"`
+ // This field is from variant [ResponseListResponseOutputFileSearchCall].
+ Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ // This field is from variant [ResponseListResponseOutputFunctionCall].
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
+ ServerLabel string `json:"server_label"`
+ // This field is from variant [ResponseListResponseOutputMcpCall].
+ Error string `json:"error"`
+ // This field is from variant [ResponseListResponseOutputMcpCall].
+ Output string `json:"output"`
+ // This field is from variant [ResponseListResponseOutputMcpListTools].
+ Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools"`
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ Queries respjson.Field
+ Results respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Error respjson.Field
+ Output respjson.Field
+ Tools respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsTextFormat) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsTextFormat
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsTextFormat) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// anyResponseListResponseOutput is implemented by each variant of
+// [ResponseListResponseOutputUnion] to add type safety for the return type of
+// [ResponseListResponseOutputUnion.AsAny]
+type anyResponseListResponseOutput interface {
+ implResponseListResponseOutputUnion()
}
-// Must be "text", "json_schema", or "json_object" to identify the format type
-type ResponseNewParamsTextFormatType string
-
-const (
- ResponseNewParamsTextFormatTypeText ResponseNewParamsTextFormatType = "text"
- ResponseNewParamsTextFormatTypeJsonSchema ResponseNewParamsTextFormatType = "json_schema"
- ResponseNewParamsTextFormatTypeJsonObject ResponseNewParamsTextFormatType = "json_object"
-)
+func (ResponseListResponseOutputMessage) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputWebSearchCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputFileSearchCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputFunctionCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpApprovalRequest) implResponseListResponseOutputUnion() {}
-// Only one field can be non-zero.
+// Use the following switch statement to find the correct variant
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsTextFormatSchemaUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsTextFormatSchemaUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ResponseNewParamsTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsTextFormatSchemaUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
+// switch variant := ResponseListResponseOutputUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseOutputMessage:
+// case llamastackclient.ResponseListResponseOutputWebSearchCall:
+// case llamastackclient.ResponseListResponseOutputFileSearchCall:
+// case llamastackclient.ResponseListResponseOutputFunctionCall:
+// case llamastackclient.ResponseListResponseOutputMcpCall:
+// case llamastackclient.ResponseListResponseOutputMcpListTools:
+// case llamastackclient.ResponseListResponseOutputMcpApprovalRequest:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseListResponseOutputUnion) AsAny() anyResponseListResponseOutput {
+ switch u.Type {
+ case "message":
+ return u.AsMessage()
+ case "web_search_call":
+ return u.AsWebSearchCall()
+ case "file_search_call":
+ return u.AsFileSearchCall()
+ case "function_call":
+ return u.AsFunctionCall()
+ case "mcp_call":
+ return u.AsMcpCall()
+ case "mcp_list_tools":
+ return u.AsMcpListTools()
+ case "mcp_approval_request":
+ return u.AsMcpApprovalRequest()
}
return nil
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsToolUnion struct {
- OfOpenAIResponseInputToolWebSearch *ResponseNewParamsToolOpenAIResponseInputToolWebSearch `json:",omitzero,inline"`
- OfFileSearch *ResponseNewParamsToolFileSearch `json:",omitzero,inline"`
- OfFunction *ResponseNewParamsToolFunction `json:",omitzero,inline"`
- OfMcp *ResponseNewParamsToolMcp `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsToolUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfOpenAIResponseInputToolWebSearch, u.OfFileSearch, u.OfFunction, u.OfMcp)
-}
-func (u *ResponseNewParamsToolUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsToolUnion) asAny() any {
- if !param.IsOmitted(u.OfOpenAIResponseInputToolWebSearch) {
- return u.OfOpenAIResponseInputToolWebSearch
- } else if !param.IsOmitted(u.OfFileSearch) {
- return u.OfFileSearch
- } else if !param.IsOmitted(u.OfFunction) {
- return u.OfFunction
- } else if !param.IsOmitted(u.OfMcp) {
- return u.OfMcp
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsMessage() (v ResponseListResponseOutputMessage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetSearchContextSize() *string {
- if vt := u.OfOpenAIResponseInputToolWebSearch; vt != nil && vt.SearchContextSize.Valid() {
- return &vt.SearchContextSize.Value
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsWebSearchCall() (v ResponseListResponseOutputWebSearchCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetVectorStoreIDs() []string {
- if vt := u.OfFileSearch; vt != nil {
- return vt.VectorStoreIDs
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsFileSearchCall() (v ResponseListResponseOutputFileSearchCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetFilters() map[string]ResponseNewParamsToolFileSearchFilterUnion {
- if vt := u.OfFileSearch; vt != nil {
- return vt.Filters
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsFunctionCall() (v ResponseListResponseOutputFunctionCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetMaxNumResults() *int64 {
- if vt := u.OfFileSearch; vt != nil && vt.MaxNumResults.Valid() {
- return &vt.MaxNumResults.Value
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsMcpCall() (v ResponseListResponseOutputMcpCall) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetRankingOptions() *ResponseNewParamsToolFileSearchRankingOptions {
- if vt := u.OfFileSearch; vt != nil {
- return &vt.RankingOptions
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsMcpListTools() (v ResponseListResponseOutputMcpListTools) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetName() *string {
- if vt := u.OfFunction; vt != nil {
- return &vt.Name
- }
- return nil
+func (u ResponseListResponseOutputUnion) AsMcpApprovalRequest() (v ResponseListResponseOutputMcpApprovalRequest) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetDescription() *string {
- if vt := u.OfFunction; vt != nil && vt.Description.Valid() {
- return &vt.Description.Value
- }
- return nil
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseOutputUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseListResponseOutputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetParameters() map[string]ResponseNewParamsToolFunctionParameterUnion {
- if vt := u.OfFunction; vt != nil {
- return vt.Parameters
- }
- return nil
+// Corresponds to the various Message types in the Responses API. They are all
+// under one type because the Responses API gives them all the same "type" value,
+// and there is no way to tell them apart in certain scenarios.
+type ResponseListResponseOutputMessage struct {
+ Content ResponseListResponseOutputMessageContentUnion `json:"content,required"`
+ // Any of "system", "developer", "user", "assistant".
+ Role ResponseListResponseOutputMessageRole `json:"role,required"`
+ Type constant.Message `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Content respjson.Field
+ Role respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetStrict() *bool {
- if vt := u.OfFunction; vt != nil && vt.Strict.Valid() {
- return &vt.Strict.Value
- }
- return nil
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessage) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMessage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetRequireApproval() *ResponseNewParamsToolMcpRequireApprovalUnion {
- if vt := u.OfMcp; vt != nil {
- return &vt.RequireApproval
- }
- return nil
+// ResponseListResponseOutputMessageContentUnion contains all possible properties
+// and values from [string],
+// [[]ResponseListResponseOutputMessageContentArrayItemUnion],
+// [[]ResponseListResponseOutputMessageContentArrayItem].
+//
+// 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: OfString OfResponseListResponseOutputMessageContentArray
+// OfVariant2]
+type ResponseListResponseOutputMessageContentUnion struct {
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a
+ // [[]ResponseListResponseOutputMessageContentArrayItemUnion] instead of an object.
+ OfResponseListResponseOutputMessageContentArray []ResponseListResponseOutputMessageContentArrayItemUnion `json:",inline"`
+ // This field will be present if the value is a
+ // [[]ResponseListResponseOutputMessageContentArrayItem] instead of an object.
+ OfVariant2 []ResponseListResponseOutputMessageContentArrayItem `json:",inline"`
+ JSON struct {
+ OfString respjson.Field
+ OfResponseListResponseOutputMessageContentArray respjson.Field
+ OfVariant2 respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ResponseListResponseOutputMessageContentUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputMessageContentUnion) AsResponseListResponseOutputMessageContentArray() (v []ResponseListResponseOutputMessageContentArrayItemUnion) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputMessageContentUnion) AsVariant2() (v []ResponseListResponseOutputMessageContentArrayItem) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseListResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseListResponseOutputMessageContentArrayItemUnion contains all possible
+// properties and values from
+// [ResponseListResponseOutputMessageContentArrayItemInputText],
+// [ResponseListResponseOutputMessageContentArrayItemInputImage].
+//
+// Use the [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny] method to
+// switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseListResponseOutputMessageContentArrayItemUnion struct {
+ // This field is from variant
+ // [ResponseListResponseOutputMessageContentArrayItemInputText].
+ Text string `json:"text"`
+ // Any of "input_text", "input_image".
+ Type string `json:"type"`
+ // This field is from variant
+ // [ResponseListResponseOutputMessageContentArrayItemInputImage].
+ Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail"`
+ // This field is from variant
+ // [ResponseListResponseOutputMessageContentArrayItemInputImage].
+ ImageURL string `json:"image_url"`
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ Detail respjson.Field
+ ImageURL respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseListResponseOutputMessageContentArrayItem is implemented by each
+// variant of [ResponseListResponseOutputMessageContentArrayItemUnion] to add type
+// safety for the return type of
+// [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny]
+type anyResponseListResponseOutputMessageContentArrayItem interface {
+ implResponseListResponseOutputMessageContentArrayItemUnion()
+}
+
+func (ResponseListResponseOutputMessageContentArrayItemInputText) implResponseListResponseOutputMessageContentArrayItemUnion() {
+}
+func (ResponseListResponseOutputMessageContentArrayItemInputImage) implResponseListResponseOutputMessageContentArrayItemUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseListResponseOutputMessageContentArrayItemUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputText:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputImage:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItem {
+ switch u.Type {
+ case "input_text":
+ return u.AsInputText()
+ case "input_image":
+ return u.AsInputImage()
+ }
+ return nil
+}
+
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseOutputMessageContentArrayItemInputText) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseOutputMessageContentArrayItemInputImage) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ResponseListResponseOutputMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Text content for input messages in OpenAI response format.
+type ResponseListResponseOutputMessageContentArrayItemInputText struct {
+ // The text content of the input message
+ Text string `json:"text,required"`
+ // Content type identifier, always "input_text"
+ Type constant.InputText `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItemInputText) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseOutputMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Image content for input messages in OpenAI response format.
+type ResponseListResponseOutputMessageContentArrayItemInputImage struct {
+ // Level of detail for image processing, can be "low", "high", or "auto"
+ //
+ // Any of "low", "high", "auto".
+ Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail,required"`
+ // Content type identifier, always "input_image"
+ Type constant.InputImage `json:"type,required"`
+ // (Optional) URL of the image content
+ ImageURL string `json:"image_url"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Detail respjson.Field
+ Type respjson.Field
+ ImageURL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItemInputImage) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseOutputMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Level of detail for image processing, can be "low", "high", or "auto"
+type ResponseListResponseOutputMessageContentArrayItemInputImageDetail string
+
+const (
+ ResponseListResponseOutputMessageContentArrayItemInputImageDetailLow ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "low"
+ ResponseListResponseOutputMessageContentArrayItemInputImageDetailHigh ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "high"
+ ResponseListResponseOutputMessageContentArrayItemInputImageDetailAuto ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "auto"
+)
+
+// Level of detail for image processing, can be "low", "high", or "auto"
+type ResponseListResponseOutputMessageContentArrayItemDetail string
+
+const (
+ ResponseListResponseOutputMessageContentArrayItemDetailLow ResponseListResponseOutputMessageContentArrayItemDetail = "low"
+ ResponseListResponseOutputMessageContentArrayItemDetailHigh ResponseListResponseOutputMessageContentArrayItemDetail = "high"
+ ResponseListResponseOutputMessageContentArrayItemDetailAuto ResponseListResponseOutputMessageContentArrayItemDetail = "auto"
+)
+
+type ResponseListResponseOutputMessageContentArrayItem struct {
+ Annotations []ResponseListResponseOutputMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
+ Text string `json:"text,required"`
+ Type constant.OutputText `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Annotations respjson.Field
+ Text respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItem) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseListResponseOutputMessageContentArrayItemAnnotationUnion contains all
+// possible properties and values from
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation],
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation],
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation],
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath].
+//
+// Use the [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
+// method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ResponseListResponseOutputMessageContentArrayItemAnnotationUnion struct {
+ FileID string `json:"file_id"`
+ Filename string `json:"filename"`
+ Index int64 `json:"index"`
+ // Any of "file_citation", "url_citation", "container_file_citation", "file_path".
+ Type string `json:"type"`
+ EndIndex int64 `json:"end_index"`
+ StartIndex int64 `json:"start_index"`
+ // This field is from variant
+ // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
+ Title string `json:"title"`
+ // This field is from variant
+ // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
+ URL string `json:"url"`
+ // This field is from variant
+ // [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation].
+ ContainerID string `json:"container_id"`
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ URL respjson.Field
+ ContainerID respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyResponseListResponseOutputMessageContentArrayItemAnnotation is implemented by
+// each variant of
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion] to add type
+// safety for the return type of
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
+type anyResponseListResponseOutputMessageContentArrayItemAnnotation interface {
+ implResponseListResponseOutputMessageContentArrayItemAnnotationUnion()
+}
+
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+}
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+}
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+}
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
+}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItemAnnotation {
+ switch u.Type {
+ case "file_citation":
+ return u.AsFileCitation()
+ case "url_citation":
+ return u.AsURLCitation()
+ case "container_file_citation":
+ return u.AsContainerFileCitation()
+ case "file_path":
+ return u.AsFilePath()
+ }
+ return nil
+}
+
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// File citation annotation for referencing specific files in response content.
+type ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation struct {
+ // Unique identifier of the referenced file
+ FileID string `json:"file_id,required"`
+ // Name of the referenced file
+ Filename string `json:"filename,required"`
+ // Position index of the citation within the content
+ Index int64 `json:"index,required"`
+ // Annotation type identifier, always "file_citation"
+ Type constant.FileCitation `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Filename respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// URL citation annotation for referencing external web resources.
+type ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation struct {
+ // End position of the citation span in the content
+ EndIndex int64 `json:"end_index,required"`
+ // Start position of the citation span in the content
+ StartIndex int64 `json:"start_index,required"`
+ // Title of the referenced web resource
+ Title string `json:"title,required"`
+ // Annotation type identifier, always "url_citation"
+ Type constant.URLCitation `json:"type,required"`
+ // URL of the referenced web resource
+ URL string `json:"url,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ EndIndex respjson.Field
+ StartIndex respjson.Field
+ Title respjson.Field
+ Type respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation struct {
+ ContainerID string `json:"container_id,required"`
+ EndIndex int64 `json:"end_index,required"`
+ FileID string `json:"file_id,required"`
+ Filename string `json:"filename,required"`
+ StartIndex int64 `json:"start_index,required"`
+ Type constant.ContainerFileCitation `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ContainerID respjson.Field
+ EndIndex respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ StartIndex respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath struct {
+ FileID string `json:"file_id,required"`
+ Index int64 `json:"index,required"`
+ Type constant.FilePath `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ FileID respjson.Field
+ Index respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) RawJSON() string {
+ return r.JSON.raw
+}
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ResponseListResponseOutputMessageRole string
+
+const (
+ ResponseListResponseOutputMessageRoleSystem ResponseListResponseOutputMessageRole = "system"
+ ResponseListResponseOutputMessageRoleDeveloper ResponseListResponseOutputMessageRole = "developer"
+ ResponseListResponseOutputMessageRoleUser ResponseListResponseOutputMessageRole = "user"
+ ResponseListResponseOutputMessageRoleAssistant ResponseListResponseOutputMessageRole = "assistant"
+)
+
+// Web search tool call output message for OpenAI responses.
+type ResponseListResponseOutputWebSearchCall struct {
+ // Unique identifier for this tool call
+ ID string `json:"id,required"`
+ // Current status of the web search operation
+ Status string `json:"status,required"`
+ // Tool call type identifier, always "web_search_call"
+ Type constant.WebSearchCall `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputWebSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputWebSearchCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// File search tool call output message for OpenAI responses.
+type ResponseListResponseOutputFileSearchCall struct {
+ // Unique identifier for this tool call
+ ID string `json:"id,required"`
+ // List of search queries executed
+ Queries []string `json:"queries,required"`
+ // Current status of the file search operation
+ Status string `json:"status,required"`
+ // Tool call type identifier, always "file_search_call"
+ Type constant.FileSearchCall `json:"type,required"`
+ // (Optional) Search results returned by the file search operation
+ Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Queries respjson.Field
+ Status respjson.Field
+ Type respjson.Field
+ Results respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputFileSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputFileSearchCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Search results returned by the file search operation.
+type ResponseListResponseOutputFileSearchCallResult struct {
+ // (Optional) Key-value attributes associated with the file
+ Attributes map[string]ResponseListResponseOutputFileSearchCallResultAttributeUnion `json:"attributes,required"`
+ // Unique identifier of the file containing the result
+ FileID string `json:"file_id,required"`
+ // Name of the file containing the result
+ Filename string `json:"filename,required"`
+ // Relevance score for this search result (between 0 and 1)
+ Score float64 `json:"score,required"`
+ // Text content of the search result
+ Text string `json:"text,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Attributes respjson.Field
+ FileID respjson.Field
+ Filename respjson.Field
+ Score respjson.Field
+ Text respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputFileSearchCallResult) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputFileSearchCallResult) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseListResponseOutputFileSearchCallResultAttributeUnion contains all
+// possible properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ResponseListResponseOutputFileSearchCallResultAttributeUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) RawJSON() string {
+ return u.JSON.raw
+}
+
+func (r *ResponseListResponseOutputFileSearchCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Function tool call output message for OpenAI responses.
+type ResponseListResponseOutputFunctionCall struct {
+ // JSON string containing the function arguments
+ Arguments string `json:"arguments,required"`
+ // Unique identifier for the function call
+ CallID string `json:"call_id,required"`
+ // Name of the function being called
+ Name string `json:"name,required"`
+ // Tool call type identifier, always "function_call"
+ Type constant.FunctionCall `json:"type,required"`
+ // (Optional) Additional identifier for the tool call
+ ID string `json:"id"`
+ // (Optional) Current status of the function call execution
+ Status string `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Arguments respjson.Field
+ CallID respjson.Field
+ Name respjson.Field
+ Type respjson.Field
+ ID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputFunctionCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputFunctionCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Model Context Protocol (MCP) call output message for OpenAI responses.
+type ResponseListResponseOutputMcpCall struct {
+ // Unique identifier for this MCP call
+ ID string `json:"id,required"`
+ // JSON string containing the MCP call arguments
+ Arguments string `json:"arguments,required"`
+ // Name of the MCP method being called
+ Name string `json:"name,required"`
+ // Label identifying the MCP server handling the call
+ ServerLabel string `json:"server_label,required"`
+ // Tool call type identifier, always "mcp_call"
+ Type constant.McpCall `json:"type,required"`
+ // (Optional) Error message if the MCP call failed
+ Error string `json:"error"`
+ // (Optional) Output result from the successful MCP call
+ Output string `json:"output"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ Error respjson.Field
+ Output respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMcpCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpCall) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// MCP list tools output message containing available tools from an MCP server.
+type ResponseListResponseOutputMcpListTools struct {
+ // Unique identifier for this MCP list tools operation
+ ID string `json:"id,required"`
+ // Label identifying the MCP server providing the tools
+ ServerLabel string `json:"server_label,required"`
+ // List of available tools provided by the MCP server
+ Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools,required"`
+ // Tool call type identifier, always "mcp_list_tools"
+ Type constant.McpListTools `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ ServerLabel respjson.Field
+ Tools respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMcpListTools) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpListTools) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Tool definition returned by MCP list tools operation.
+type ResponseListResponseOutputMcpListToolsTool struct {
+ // JSON schema defining the tool's input parameters
+ InputSchema map[string]ResponseListResponseOutputMcpListToolsToolInputSchemaUnion `json:"input_schema,required"`
+ // Name of the tool
+ Name string `json:"name,required"`
+ // (Optional) Description of what the tool does
+ Description string `json:"description"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ InputSchema respjson.Field
+ Name respjson.Field
+ Description respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMcpListToolsTool) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpListToolsTool) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ResponseListResponseOutputMcpListToolsToolInputSchemaUnion contains all possible
+// properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ResponseListResponseOutputMcpListToolsToolInputSchemaUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetServerLabel() *string {
- if vt := u.OfMcp; vt != nil {
- return &vt.ServerLabel
- }
- return nil
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetServerURL() *string {
- if vt := u.OfMcp; vt != nil {
- return &vt.ServerURL
- }
- return nil
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetAllowedTools() *ResponseNewParamsToolMcpAllowedToolsUnion {
- if vt := u.OfMcp; vt != nil {
- return &vt.AllowedTools
- }
- return nil
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetHeaders() map[string]ResponseNewParamsToolMcpHeaderUnion {
- if vt := u.OfMcp; vt != nil {
- return vt.Headers
- }
- return nil
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u ResponseNewParamsToolUnion) GetType() *string {
- if vt := u.OfOpenAIResponseInputToolWebSearch; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfFileSearch; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfFunction; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfMcp; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) RawJSON() string {
+ return u.JSON.raw
}
-func init() {
- apijson.RegisterUnion[ResponseNewParamsToolUnion](
- "type",
- apijson.Discriminator[ResponseNewParamsToolOpenAIResponseInputToolWebSearch]("web_search"),
- apijson.Discriminator[ResponseNewParamsToolOpenAIResponseInputToolWebSearch]("web_search_preview"),
- apijson.Discriminator[ResponseNewParamsToolOpenAIResponseInputToolWebSearch]("web_search_preview_2025_03_11"),
- apijson.Discriminator[ResponseNewParamsToolFileSearch]("file_search"),
- apijson.Discriminator[ResponseNewParamsToolFunction]("function"),
- apijson.Discriminator[ResponseNewParamsToolMcp]("mcp"),
- )
+func (r *ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Web search tool configuration for OpenAI response inputs.
-//
-// The property Type is required.
-type ResponseNewParamsToolOpenAIResponseInputToolWebSearch struct {
- // Web search tool type variant to use
- //
- // Any of "web_search", "web_search_preview", "web_search_preview_2025_03_11".
- Type ResponseNewParamsToolOpenAIResponseInputToolWebSearchType `json:"type,omitzero,required"`
- // (Optional) Size of search context, must be "low", "medium", or "high"
- SearchContextSize param.Opt[string] `json:"search_context_size,omitzero"`
- paramObj
+// A request for human approval of a tool invocation.
+type ResponseListResponseOutputMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ Type constant.McpApprovalRequest `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Arguments respjson.Field
+ Name respjson.Field
+ ServerLabel respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsToolOpenAIResponseInputToolWebSearch) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolOpenAIResponseInputToolWebSearch
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsToolOpenAIResponseInputToolWebSearch) UnmarshalJSON(data []byte) error {
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Web search tool type variant to use
-type ResponseNewParamsToolOpenAIResponseInputToolWebSearchType string
+type ResponseListResponseOutputRole string
const (
- ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearch ResponseNewParamsToolOpenAIResponseInputToolWebSearchType = "web_search"
- ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearchPreview ResponseNewParamsToolOpenAIResponseInputToolWebSearchType = "web_search_preview"
- ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearchPreview2025_03_11 ResponseNewParamsToolOpenAIResponseInputToolWebSearchType = "web_search_preview_2025_03_11"
+ ResponseListResponseOutputRoleSystem ResponseListResponseOutputRole = "system"
+ ResponseListResponseOutputRoleDeveloper ResponseListResponseOutputRole = "developer"
+ ResponseListResponseOutputRoleUser ResponseListResponseOutputRole = "user"
+ ResponseListResponseOutputRoleAssistant ResponseListResponseOutputRole = "assistant"
)
-// File search tool configuration for OpenAI response inputs.
-//
-// The properties Type, VectorStoreIDs are required.
-type ResponseNewParamsToolFileSearch struct {
- // List of vector store identifiers to search within
- VectorStoreIDs []string `json:"vector_store_ids,omitzero,required"`
- // (Optional) Maximum number of search results to return (1-50)
- MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
- // (Optional) Additional filters to apply to the search
- Filters map[string]ResponseNewParamsToolFileSearchFilterUnion `json:"filters,omitzero"`
- // (Optional) Options for ranking and scoring search results
- RankingOptions ResponseNewParamsToolFileSearchRankingOptions `json:"ranking_options,omitzero"`
- // Tool type identifier, always "file_search"
- //
- // This field can be elided, and will marshal its zero value as "file_search".
- Type constant.FileSearch `json:"type,required"`
- paramObj
+// Text formatting configuration for the response
+type ResponseListResponseText struct {
+ // (Optional) Text format configuration specifying output format requirements
+ Format ResponseListResponseTextFormat `json:"format"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Format respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsToolFileSearch) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolFileSearch
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsToolFileSearch) UnmarshalJSON(data []byte) error {
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseText) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsToolFileSearchFilterUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsToolFileSearchFilterUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ResponseNewParamsToolFileSearchFilterUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsToolFileSearchFilterUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// (Optional) Options for ranking and scoring search results
-type ResponseNewParamsToolFileSearchRankingOptions struct {
- // (Optional) Name of the ranking algorithm to use
- Ranker param.Opt[string] `json:"ranker,omitzero"`
- // (Optional) Minimum relevance score threshold for results
- ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"`
- paramObj
+// (Optional) Text format configuration specifying output format requirements
+type ResponseListResponseTextFormat struct {
+ // Must be "text", "json_schema", or "json_object" to identify the format type
+ //
+ // Any of "text", "json_schema", "json_object".
+ Type ResponseListResponseTextFormatType `json:"type,required"`
+ // (Optional) A description of the response format. Only used for json_schema.
+ Description string `json:"description"`
+ // The name of the response format. Only used for json_schema.
+ Name string `json:"name"`
+ // The JSON schema the response should conform to. In a Python SDK, this is often a
+ // `pydantic` model. Only used for json_schema.
+ Schema map[string]ResponseListResponseTextFormatSchemaUnion `json:"schema"`
+ // (Optional) Whether to strictly enforce the JSON schema. If true, the response
+ // must match the schema exactly. Only used for json_schema.
+ Strict bool `json:"strict"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Description respjson.Field
+ Name respjson.Field
+ Schema respjson.Field
+ Strict respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsToolFileSearchRankingOptions) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolFileSearchRankingOptions
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsToolFileSearchRankingOptions) UnmarshalJSON(data []byte) error {
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseTextFormat) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseTextFormat) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Function tool configuration for OpenAI response inputs.
-//
-// The properties Name, Type are required.
-type ResponseNewParamsToolFunction struct {
- // Name of the function that can be called
- Name string `json:"name,required"`
- // (Optional) Description of what the function does
- Description param.Opt[string] `json:"description,omitzero"`
- // (Optional) Whether to enforce strict parameter validation
- Strict param.Opt[bool] `json:"strict,omitzero"`
- // (Optional) JSON schema defining the function's parameters
- Parameters map[string]ResponseNewParamsToolFunctionParameterUnion `json:"parameters,omitzero"`
- // Tool type identifier, always "function"
- //
- // This field can be elided, and will marshal its zero value as "function".
- Type constant.Function `json:"type,required"`
- paramObj
-}
+// Must be "text", "json_schema", or "json_object" to identify the format type
+type ResponseListResponseTextFormatType string
-func (r ResponseNewParamsToolFunction) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolFunction
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsToolFunction) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
+const (
+ ResponseListResponseTextFormatTypeText ResponseListResponseTextFormatType = "text"
+ ResponseListResponseTextFormatTypeJsonSchema ResponseListResponseTextFormatType = "json_schema"
+ ResponseListResponseTextFormatTypeJsonObject ResponseListResponseTextFormatType = "json_object"
+)
-// Only one field can be non-zero.
+// ResponseListResponseTextFormatSchemaUnion contains all possible properties and
+// values from [bool], [float64], [string], [[]any].
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsToolFunctionParameterUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsToolFunctionParameterUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ResponseNewParamsToolFunctionParameterUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsToolFunctionParameterUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
+// Use the methods beginning with 'As' to cast the union to one of its variants.
//
-// The properties RequireApproval, ServerLabel, ServerURL, Type are required.
-type ResponseNewParamsToolMcp struct {
- // Approval requirement for tool calls ("always", "never", or filter)
- RequireApproval ResponseNewParamsToolMcpRequireApprovalUnion `json:"require_approval,omitzero,required"`
- // Label to identify this MCP server
- ServerLabel string `json:"server_label,required"`
- // URL endpoint of the MCP server
- ServerURL string `json:"server_url,required"`
- // (Optional) Restriction on which tools can be used from this server
- AllowedTools ResponseNewParamsToolMcpAllowedToolsUnion `json:"allowed_tools,omitzero"`
- // (Optional) HTTP headers to include when connecting to the server
- Headers map[string]ResponseNewParamsToolMcpHeaderUnion `json:"headers,omitzero"`
- // Tool type identifier, always "mcp"
- //
- // This field can be elided, and will marshal its zero value as "mcp".
- Type constant.Mcp `json:"type,required"`
- paramObj
+// If the underlying value is not a json object, one of the following properties
+// will be valid: OfBool OfFloat OfString OfAnyArray]
+type ResponseListResponseTextFormatSchemaUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
}
-func (r ResponseNewParamsToolMcp) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolMcp
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsToolMcp) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func (u ResponseListResponseTextFormatSchemaUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsToolMcpRequireApprovalUnion struct {
- // Check if union is this variant with
- // !param.IsOmitted(union.OfResponseNewsToolMcpRequireApprovalString)
- OfResponseNewsToolMcpRequireApprovalString param.Opt[ResponseNewParamsToolMcpRequireApprovalString] `json:",omitzero,inline"`
- OfApprovalFilter *ResponseNewParamsToolMcpRequireApprovalApprovalFilter `json:",omitzero,inline"`
- paramUnion
+func (u ResponseListResponseTextFormatSchemaUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u ResponseNewParamsToolMcpRequireApprovalUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfResponseNewsToolMcpRequireApprovalString, u.OfApprovalFilter)
-}
-func (u *ResponseNewParamsToolMcpRequireApprovalUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+func (u ResponseListResponseTextFormatSchemaUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u *ResponseNewParamsToolMcpRequireApprovalUnion) asAny() any {
- if !param.IsOmitted(u.OfResponseNewsToolMcpRequireApprovalString) {
- return &u.OfResponseNewsToolMcpRequireApprovalString
- } else if !param.IsOmitted(u.OfApprovalFilter) {
- return u.OfApprovalFilter
- }
- return nil
+func (u ResponseListResponseTextFormatSchemaUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-type ResponseNewParamsToolMcpRequireApprovalString string
-
-const (
- ResponseNewParamsToolMcpRequireApprovalStringAlways ResponseNewParamsToolMcpRequireApprovalString = "always"
- ResponseNewParamsToolMcpRequireApprovalStringNever ResponseNewParamsToolMcpRequireApprovalString = "never"
-)
-
-// Filter configuration for MCP tool approval requirements.
-type ResponseNewParamsToolMcpRequireApprovalApprovalFilter struct {
- // (Optional) List of tool names that always require approval
- Always []string `json:"always,omitzero"`
- // (Optional) List of tool names that never require approval
- Never []string `json:"never,omitzero"`
- paramObj
-}
+// Returns the unmodified JSON received from the API
+func (u ResponseListResponseTextFormatSchemaUnion) RawJSON() string { return u.JSON.raw }
-func (r ResponseNewParamsToolMcpRequireApprovalApprovalFilter) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolMcpRequireApprovalApprovalFilter
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *ResponseNewParamsToolMcpRequireApprovalApprovalFilter) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsToolMcpAllowedToolsUnion struct {
- OfStringArray []string `json:",omitzero,inline"`
- OfAllowedToolsFilter *ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter `json:",omitzero,inline"`
- paramUnion
+// (Optional) Error details if the response generation failed
+type ResponseListResponseError struct {
+ // Error code identifying the type of failure
+ Code string `json:"code,required"`
+ // Human-readable error message describing the failure
+ Message string `json:"message,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Code respjson.Field
+ Message respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (u ResponseNewParamsToolMcpAllowedToolsUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfStringArray, u.OfAllowedToolsFilter)
+// Returns the unmodified JSON received from the API
+func (r ResponseListResponseError) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseError) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func (u *ResponseNewParamsToolMcpAllowedToolsUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+
+// Response object confirming deletion of an OpenAI response.
+type ResponseDeleteResponse struct {
+ // Unique identifier of the deleted response
+ ID string `json:"id,required"`
+ // Deletion confirmation flag, always True
+ Deleted bool `json:"deleted,required"`
+ // Object type identifier, always "response"
+ Object constant.Response `json:"object,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ Deleted respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
}
-func (u *ResponseNewParamsToolMcpAllowedToolsUnion) asAny() any {
- if !param.IsOmitted(u.OfStringArray) {
- return &u.OfStringArray
- } else if !param.IsOmitted(u.OfAllowedToolsFilter) {
- return u.OfAllowedToolsFilter
- }
- return nil
+// Returns the unmodified JSON received from the API
+func (r ResponseDeleteResponse) RawJSON() string { return r.JSON.raw }
+func (r *ResponseDeleteResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Filter configuration for restricting which MCP tools can be used.
-type ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter struct {
- // (Optional) List of specific tool names that are allowed
- ToolNames []string `json:"tool_names,omitzero"`
+type ResponseNewParams struct {
+ // The ID of the last response to return.
+ After param.Opt[string] `json:"after,omitzero"`
+ // The number of responses to return.
+ Limit param.Opt[int64] `json:"limit,omitzero"`
+ // The model to filter responses by.
+ Model param.Opt[string] `json:"model,omitzero"`
+ // The order to sort responses by when sorted by created_at ('asc' or 'desc').
+ //
+ // Any of "asc", "desc".
+ Order ResponseNewParamsOrder `json:"order,omitzero"`
paramObj
}
-func (r ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter
+func (r ResponseNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ResponseNewParamsToolMcpHeaderUnion struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ResponseNewParamsToolMcpHeaderUnion) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ResponseNewParamsToolMcpHeaderUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ResponseNewParamsToolMcpHeaderUnion) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
+// The order to sort responses by when sorted by created_at ('asc' or 'desc').
+type ResponseNewParamsOrder string
+
+const (
+ ResponseNewParamsOrderAsc ResponseNewParamsOrder = "asc"
+ ResponseNewParamsOrderDesc ResponseNewParamsOrder = "desc"
+)
type ResponseListParams struct {
// The ID of the last response to return.
diff --git a/response_test.go b/response_test.go
index 829b38b..bb41ff3 100644
--- a/response_test.go
+++ b/response_test.go
@@ -25,35 +25,10 @@ func TestResponseNewWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Responses.New(context.TODO(), llamastackclient.ResponseNewParams{
- Input: llamastackclient.ResponseNewParamsInputUnion{
- OfString: llamastackclient.String("string"),
- },
- Model: "model",
- Include: []string{"string"},
- Instructions: llamastackclient.String("instructions"),
- MaxInferIters: llamastackclient.Int(0),
- PreviousResponseID: llamastackclient.String("previous_response_id"),
- Store: llamastackclient.Bool(true),
- Temperature: llamastackclient.Float(0),
- Text: llamastackclient.ResponseNewParamsText{
- Format: llamastackclient.ResponseNewParamsTextFormat{
- Type: llamastackclient.ResponseNewParamsTextFormatTypeText,
- Description: llamastackclient.String("description"),
- Name: llamastackclient.String("name"),
- Schema: map[string]llamastackclient.ResponseNewParamsTextFormatSchemaUnion{
- "foo": {
- OfBool: llamastackclient.Bool(true),
- },
- },
- Strict: llamastackclient.Bool(true),
- },
- },
- Tools: []llamastackclient.ResponseNewParamsToolUnion{{
- OfOpenAIResponseInputToolWebSearch: &llamastackclient.ResponseNewParamsToolOpenAIResponseInputToolWebSearch{
- Type: llamastackclient.ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearch,
- SearchContextSize: llamastackclient.String("search_context_size"),
- },
- }},
+ After: llamastackclient.String("after"),
+ Limit: llamastackclient.Int(0),
+ Model: llamastackclient.String("model"),
+ Order: llamastackclient.ResponseNewParamsOrderAsc,
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index 8666cd4..a3fd044 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -39,7 +39,6 @@ type Embedding string // Always "embedding"
type File string // Always "file"
type FileCitation string // Always "file_citation"
type FilePath string // Always "file_path"
-type FileSearch string // Always "file_search"
type FileSearchCall string // Always "file_search_call"
type Function string // Always "function"
type FunctionCall string // Always "function_call"
@@ -58,7 +57,6 @@ type List string // Always "list"
type Llm string // Always "llm"
type LlmAsJudge string // Always "llm_as_judge"
type LoRa string // Always "LoRA"
-type Mcp string // Always "mcp"
type McpApprovalRequest string // Always "mcp_approval_request"
type McpApprovalResponse string // Always "mcp_approval_response"
type McpCall string // Always "mcp_call"
@@ -150,7 +148,6 @@ func (c Embedding) Default() Embedding { return "embeddi
func (c File) Default() File { return "file" }
func (c FileCitation) Default() FileCitation { return "file_citation" }
func (c FilePath) Default() FilePath { return "file_path" }
-func (c FileSearch) Default() FileSearch { return "file_search" }
func (c FileSearchCall) Default() FileSearchCall { return "file_search_call" }
func (c Function) Default() Function { return "function" }
func (c FunctionCall) Default() FunctionCall { return "function_call" }
@@ -169,7 +166,6 @@ func (c List) Default() List { return "list" }
func (c Llm) Default() Llm { return "llm" }
func (c LlmAsJudge) Default() LlmAsJudge { return "llm_as_judge" }
func (c LoRa) Default() LoRa { return "LoRA" }
-func (c Mcp) Default() Mcp { return "mcp" }
func (c McpApprovalRequest) Default() McpApprovalRequest { return "mcp_approval_request" }
func (c McpApprovalResponse) Default() McpApprovalResponse { return "mcp_approval_response" }
func (c McpCall) Default() McpCall { return "mcp_call" }
@@ -293,7 +289,6 @@ func (c Embedding) MarshalJSON() ([]byte, error) { retu
func (c File) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FileCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FilePath) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c FileSearch) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FileSearchCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Function) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FunctionCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -312,7 +307,6 @@ func (c List) MarshalJSON() ([]byte, error) { retu
func (c Llm) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c LlmAsJudge) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c LoRa) MarshalJSON() ([]byte, error) { return marshalString(c) }
-func (c Mcp) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpApprovalRequest) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpApprovalResponse) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
diff --git a/telemetry.go b/telemetry.go
index e55e1da..c81c037 100644
--- a/telemetry.go
+++ b/telemetry.go
@@ -4,9 +4,6 @@ package llamastackclient
import (
"context"
- "encoding/json"
- "errors"
- "fmt"
"net/http"
"slices"
"time"
@@ -15,7 +12,6 @@ import (
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/packages/respjson"
"github.com/llamastack/llama-stack-client-go/shared/constant"
)
@@ -38,51 +34,6 @@ func NewTelemetryService(opts ...option.RequestOption) (r TelemetryService) {
return
}
-// Get a span by its ID.
-func (r *TelemetryService) GetSpan(ctx context.Context, spanID string, query TelemetryGetSpanParams, opts ...option.RequestOption) (res *TelemetryGetSpanResponse, err error) {
- opts = slices.Concat(r.Options, opts)
- if query.TraceID == "" {
- err = errors.New("missing required trace_id parameter")
- return
- }
- if spanID == "" {
- err = errors.New("missing required span_id parameter")
- return
- }
- path := fmt.Sprintf("v1/telemetry/traces/%s/spans/%s", query.TraceID, spanID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
-// Get a span tree by its ID.
-func (r *TelemetryService) GetSpanTree(ctx context.Context, spanID string, body TelemetryGetSpanTreeParams, opts ...option.RequestOption) (res *TelemetryGetSpanTreeResponse, err error) {
- var env TelemetryGetSpanTreeResponseEnvelope
- opts = slices.Concat(r.Options, opts)
- if spanID == "" {
- err = errors.New("missing required span_id parameter")
- return
- }
- path := fmt.Sprintf("v1/telemetry/spans/%s/tree", spanID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
-// Get a trace by its ID.
-func (r *TelemetryService) GetTrace(ctx context.Context, traceID string, opts ...option.RequestOption) (res *Trace, err error) {
- opts = slices.Concat(r.Options, opts)
- if traceID == "" {
- err = errors.New("missing required trace_id parameter")
- return
- }
- path := fmt.Sprintf("v1/telemetry/traces/%s", traceID)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
// Log an event.
func (r *TelemetryService) LogEvent(ctx context.Context, body TelemetryLogEventParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
@@ -92,58 +43,6 @@ func (r *TelemetryService) LogEvent(ctx context.Context, body TelemetryLogEventP
return
}
-// Query metrics.
-func (r *TelemetryService) QueryMetrics(ctx context.Context, metricName string, body TelemetryQueryMetricsParams, opts ...option.RequestOption) (res *[]TelemetryQueryMetricsResponse, err error) {
- var env TelemetryQueryMetricsResponseEnvelope
- opts = slices.Concat(r.Options, opts)
- if metricName == "" {
- err = errors.New("missing required metric_name parameter")
- return
- }
- path := fmt.Sprintf("v1/telemetry/metrics/%s", metricName)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
-// Query spans.
-func (r *TelemetryService) QuerySpans(ctx context.Context, body TelemetryQuerySpansParams, opts ...option.RequestOption) (res *[]QuerySpansResponseData, err error) {
- var env QuerySpansResponse
- opts = slices.Concat(r.Options, opts)
- path := "v1/telemetry/spans"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
-// Query traces.
-func (r *TelemetryService) QueryTraces(ctx context.Context, body TelemetryQueryTracesParams, opts ...option.RequestOption) (res *[]Trace, err error) {
- var env TelemetryQueryTracesResponseEnvelope
- opts = slices.Concat(r.Options, opts)
- path := "v1/telemetry/traces"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
- if err != nil {
- return
- }
- res = &env.Data
- return
-}
-
-// Save spans to a dataset.
-func (r *TelemetryService) SaveSpansToDataset(ctx context.Context, body TelemetrySaveSpansToDatasetParams, opts ...option.RequestOption) (err error) {
- opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
- path := "v1/telemetry/spans/export"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
- return
-}
-
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
@@ -613,502 +512,6 @@ func (u *EventStructuredLogAttributeUnionParam) asAny() any {
return nil
}
-// A condition for filtering query results.
-//
-// The properties Key, Op, Value are required.
-type QueryConditionParam struct {
- // The value to compare against
- Value QueryConditionValueUnionParam `json:"value,omitzero,required"`
- // The attribute key to filter on
- Key string `json:"key,required"`
- // The comparison operator to apply
- //
- // Any of "eq", "ne", "gt", "lt".
- Op QueryConditionOp `json:"op,omitzero,required"`
- paramObj
-}
-
-func (r QueryConditionParam) MarshalJSON() (data []byte, err error) {
- type shadow QueryConditionParam
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *QueryConditionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// The comparison operator to apply
-type QueryConditionOp string
-
-const (
- QueryConditionOpEq QueryConditionOp = "eq"
- QueryConditionOpNe QueryConditionOp = "ne"
- QueryConditionOpGt QueryConditionOp = "gt"
- QueryConditionOpLt QueryConditionOp = "lt"
-)
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type QueryConditionValueUnionParam struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u QueryConditionValueUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *QueryConditionValueUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *QueryConditionValueUnionParam) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
-}
-
-// Response containing a list of spans.
-type QuerySpansResponse struct {
- // List of spans matching the query criteria
- Data []QuerySpansResponseData `json:"data,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 QuerySpansResponse) RawJSON() string { return r.JSON.raw }
-func (r *QuerySpansResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A span representing a single operation within a trace.
-type QuerySpansResponseData struct {
- // Human-readable name describing the operation this span represents
- Name string `json:"name,required"`
- // Unique identifier for the span
- SpanID string `json:"span_id,required"`
- // Timestamp when the operation began
- StartTime time.Time `json:"start_time,required" format:"date-time"`
- // Unique identifier for the trace this span belongs to
- TraceID string `json:"trace_id,required"`
- // (Optional) Key-value pairs containing additional metadata about the span
- Attributes map[string]QuerySpansResponseDataAttributeUnion `json:"attributes"`
- // (Optional) Timestamp when the operation finished, if completed
- EndTime time.Time `json:"end_time" format:"date-time"`
- // (Optional) Unique identifier for the parent span, if this is a child span
- ParentSpanID string `json:"parent_span_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Name respjson.Field
- SpanID respjson.Field
- StartTime respjson.Field
- TraceID respjson.Field
- Attributes respjson.Field
- EndTime respjson.Field
- ParentSpanID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r QuerySpansResponseData) RawJSON() string { return r.JSON.raw }
-func (r *QuerySpansResponseData) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// QuerySpansResponseDataAttributeUnion contains all possible properties and values
-// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type QuerySpansResponseDataAttributeUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u QuerySpansResponseDataAttributeUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u QuerySpansResponseDataAttributeUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u QuerySpansResponseDataAttributeUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u QuerySpansResponseDataAttributeUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u QuerySpansResponseDataAttributeUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *QuerySpansResponseDataAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A span that includes status information.
-type SpanWithStatus struct {
- // Human-readable name describing the operation this span represents
- Name string `json:"name,required"`
- // Unique identifier for the span
- SpanID string `json:"span_id,required"`
- // Timestamp when the operation began
- StartTime time.Time `json:"start_time,required" format:"date-time"`
- // Unique identifier for the trace this span belongs to
- TraceID string `json:"trace_id,required"`
- // (Optional) Key-value pairs containing additional metadata about the span
- Attributes map[string]SpanWithStatusAttributeUnion `json:"attributes"`
- // (Optional) Timestamp when the operation finished, if completed
- EndTime time.Time `json:"end_time" format:"date-time"`
- // (Optional) Unique identifier for the parent span, if this is a child span
- ParentSpanID string `json:"parent_span_id"`
- // (Optional) The current status of the span
- //
- // Any of "ok", "error".
- Status SpanWithStatusStatus `json:"status"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Name respjson.Field
- SpanID respjson.Field
- StartTime respjson.Field
- TraceID respjson.Field
- Attributes respjson.Field
- EndTime respjson.Field
- ParentSpanID respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r SpanWithStatus) RawJSON() string { return r.JSON.raw }
-func (r *SpanWithStatus) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// SpanWithStatusAttributeUnion contains all possible properties and values from
-// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type SpanWithStatusAttributeUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u SpanWithStatusAttributeUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SpanWithStatusAttributeUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SpanWithStatusAttributeUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u SpanWithStatusAttributeUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u SpanWithStatusAttributeUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *SpanWithStatusAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// (Optional) The current status of the span
-type SpanWithStatusStatus string
-
-const (
- SpanWithStatusStatusOk SpanWithStatusStatus = "ok"
- SpanWithStatusStatusError SpanWithStatusStatus = "error"
-)
-
-// A trace representing the complete execution path of a request across multiple
-// operations.
-type Trace struct {
- // Unique identifier for the root span that started this trace
- RootSpanID string `json:"root_span_id,required"`
- // Timestamp when the trace began
- StartTime time.Time `json:"start_time,required" format:"date-time"`
- // Unique identifier for the trace
- TraceID string `json:"trace_id,required"`
- // (Optional) Timestamp when the trace finished, if completed
- EndTime time.Time `json:"end_time" format:"date-time"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- RootSpanID respjson.Field
- StartTime respjson.Field
- TraceID respjson.Field
- EndTime respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r Trace) RawJSON() string { return r.JSON.raw }
-func (r *Trace) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A span representing a single operation within a trace.
-type TelemetryGetSpanResponse struct {
- // Human-readable name describing the operation this span represents
- Name string `json:"name,required"`
- // Unique identifier for the span
- SpanID string `json:"span_id,required"`
- // Timestamp when the operation began
- StartTime time.Time `json:"start_time,required" format:"date-time"`
- // Unique identifier for the trace this span belongs to
- TraceID string `json:"trace_id,required"`
- // (Optional) Key-value pairs containing additional metadata about the span
- Attributes map[string]TelemetryGetSpanResponseAttributeUnion `json:"attributes"`
- // (Optional) Timestamp when the operation finished, if completed
- EndTime time.Time `json:"end_time" format:"date-time"`
- // (Optional) Unique identifier for the parent span, if this is a child span
- ParentSpanID string `json:"parent_span_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Name respjson.Field
- SpanID respjson.Field
- StartTime respjson.Field
- TraceID respjson.Field
- Attributes respjson.Field
- EndTime respjson.Field
- ParentSpanID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TelemetryGetSpanResponse) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryGetSpanResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// TelemetryGetSpanResponseAttributeUnion contains all possible properties and
-// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type TelemetryGetSpanResponseAttributeUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u TelemetryGetSpanResponseAttributeUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TelemetryGetSpanResponseAttributeUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TelemetryGetSpanResponseAttributeUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u TelemetryGetSpanResponseAttributeUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u TelemetryGetSpanResponseAttributeUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *TelemetryGetSpanResponseAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type TelemetryGetSpanTreeResponse map[string]SpanWithStatus
-
-// A time series of metric data points.
-type TelemetryQueryMetricsResponse struct {
- // List of labels associated with this metric series
- Labels []TelemetryQueryMetricsResponseLabel `json:"labels,required"`
- // The name of the metric
- Metric string `json:"metric,required"`
- // List of data points in chronological order
- Values []TelemetryQueryMetricsResponseValue `json:"values,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Labels respjson.Field
- Metric respjson.Field
- Values respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TelemetryQueryMetricsResponse) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryQueryMetricsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A label associated with a metric.
-type TelemetryQueryMetricsResponseLabel struct {
- // The name of the label
- Name string `json:"name,required"`
- // The value of the label
- Value string `json:"value,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Name respjson.Field
- Value respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TelemetryQueryMetricsResponseLabel) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryQueryMetricsResponseLabel) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A single data point in a metric time series.
-type TelemetryQueryMetricsResponseValue struct {
- // Unix timestamp when the metric value was recorded
- Timestamp int64 `json:"timestamp,required"`
- Unit string `json:"unit,required"`
- // The numeric value of the metric at this timestamp
- Value float64 `json:"value,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Timestamp respjson.Field
- Unit respjson.Field
- Value respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r TelemetryQueryMetricsResponseValue) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryQueryMetricsResponseValue) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type TelemetryGetSpanParams struct {
- TraceID string `path:"trace_id,required" json:"-"`
- paramObj
-}
-
-type TelemetryGetSpanTreeParams struct {
- // The maximum depth of the tree.
- MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
- // The attributes to return in the tree.
- AttributesToReturn []string `json:"attributes_to_return,omitzero"`
- paramObj
-}
-
-func (r TelemetryGetSpanTreeParams) MarshalJSON() (data []byte, err error) {
- type shadow TelemetryGetSpanTreeParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *TelemetryGetSpanTreeParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Response containing a tree structure of spans.
-type TelemetryGetSpanTreeResponseEnvelope struct {
- // Dictionary mapping span IDs to spans with status information
- Data TelemetryGetSpanTreeResponse `json:"data,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 TelemetryGetSpanTreeResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryGetSpanTreeResponseEnvelope) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type TelemetryLogEventParams struct {
// The event to log.
Event EventUnionParam `json:"event,omitzero,required"`
@@ -1124,158 +527,3 @@ func (r TelemetryLogEventParams) MarshalJSON() (data []byte, err error) {
func (r *TelemetryLogEventParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-
-type TelemetryQueryMetricsParams struct {
- // The type of query to perform.
- //
- // Any of "range", "instant".
- QueryType TelemetryQueryMetricsParamsQueryType `json:"query_type,omitzero,required"`
- // The start time of the metric to query.
- StartTime int64 `json:"start_time,required"`
- // The end time of the metric to query.
- EndTime param.Opt[int64] `json:"end_time,omitzero"`
- // The granularity of the metric to query.
- Granularity param.Opt[string] `json:"granularity,omitzero"`
- // The label matchers to apply to the metric.
- LabelMatchers []TelemetryQueryMetricsParamsLabelMatcher `json:"label_matchers,omitzero"`
- paramObj
-}
-
-func (r TelemetryQueryMetricsParams) MarshalJSON() (data []byte, err error) {
- type shadow TelemetryQueryMetricsParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *TelemetryQueryMetricsParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// The type of query to perform.
-type TelemetryQueryMetricsParamsQueryType string
-
-const (
- TelemetryQueryMetricsParamsQueryTypeRange TelemetryQueryMetricsParamsQueryType = "range"
- TelemetryQueryMetricsParamsQueryTypeInstant TelemetryQueryMetricsParamsQueryType = "instant"
-)
-
-// A matcher for filtering metrics by label values.
-//
-// The properties Name, Operator, Value are required.
-type TelemetryQueryMetricsParamsLabelMatcher struct {
- // The name of the label to match
- Name string `json:"name,required"`
- // The comparison operator to use for matching
- //
- // Any of "=", "!=", "=~", "!~".
- Operator string `json:"operator,omitzero,required"`
- // The value to match against
- Value string `json:"value,required"`
- paramObj
-}
-
-func (r TelemetryQueryMetricsParamsLabelMatcher) MarshalJSON() (data []byte, err error) {
- type shadow TelemetryQueryMetricsParamsLabelMatcher
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *TelemetryQueryMetricsParamsLabelMatcher) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func init() {
- apijson.RegisterFieldValidator[TelemetryQueryMetricsParamsLabelMatcher](
- "operator", "=", "!=", "=~", "!~",
- )
-}
-
-// Response containing metric time series data.
-type TelemetryQueryMetricsResponseEnvelope struct {
- // List of metric series matching the query criteria
- Data []TelemetryQueryMetricsResponse `json:"data,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 TelemetryQueryMetricsResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryQueryMetricsResponseEnvelope) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type TelemetryQuerySpansParams struct {
- // The attribute filters to apply to the spans.
- AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero,required"`
- // The attributes to return in the spans.
- AttributesToReturn []string `json:"attributes_to_return,omitzero,required"`
- // The maximum depth of the tree.
- MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
- paramObj
-}
-
-func (r TelemetryQuerySpansParams) MarshalJSON() (data []byte, err error) {
- type shadow TelemetryQuerySpansParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *TelemetryQuerySpansParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type TelemetryQueryTracesParams struct {
- // The limit of traces to return.
- Limit param.Opt[int64] `json:"limit,omitzero"`
- // The offset of the traces to return.
- Offset param.Opt[int64] `json:"offset,omitzero"`
- // The attribute filters to apply to the traces.
- AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero"`
- // The order by of the traces to return.
- OrderBy []string `json:"order_by,omitzero"`
- paramObj
-}
-
-func (r TelemetryQueryTracesParams) MarshalJSON() (data []byte, err error) {
- type shadow TelemetryQueryTracesParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *TelemetryQueryTracesParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Response containing a list of traces.
-type TelemetryQueryTracesResponseEnvelope struct {
- // List of traces matching the query criteria
- Data []Trace `json:"data,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 TelemetryQueryTracesResponseEnvelope) RawJSON() string { return r.JSON.raw }
-func (r *TelemetryQueryTracesResponseEnvelope) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type TelemetrySaveSpansToDatasetParams struct {
- // The attribute filters to apply to the spans.
- AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero,required"`
- // The attributes to save to the dataset.
- AttributesToSave []string `json:"attributes_to_save,omitzero,required"`
- // The ID of the dataset to save the spans to.
- DatasetID string `json:"dataset_id,required"`
- // The maximum depth of the tree.
- MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
- paramObj
-}
-
-func (r TelemetrySaveSpansToDatasetParams) MarshalJSON() (data []byte, err error) {
- type shadow TelemetrySaveSpansToDatasetParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *TelemetrySaveSpansToDatasetParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
diff --git a/telemetry_test.go b/telemetry_test.go
index f46cfc7..de50fb3 100644
--- a/telemetry_test.go
+++ b/telemetry_test.go
@@ -14,82 +14,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestTelemetryGetSpan(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Telemetry.GetSpan(
- context.TODO(),
- "span_id",
- llamastackclient.TelemetryGetSpanParams{
- TraceID: "trace_id",
- },
- )
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestTelemetryGetSpanTreeWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Telemetry.GetSpanTree(
- context.TODO(),
- "span_id",
- llamastackclient.TelemetryGetSpanTreeParams{
- AttributesToReturn: []string{"string"},
- MaxDepth: llamastackclient.Int(0),
- },
- )
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestTelemetryGetTrace(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Telemetry.GetTrace(context.TODO(), "trace_id")
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
func TestTelemetryLogEventWithOptionalParams(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -126,136 +50,3 @@ func TestTelemetryLogEventWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
-
-func TestTelemetryQueryMetricsWithOptionalParams(t *testing.T) {
- t.Skip("unsupported query params in java / kotlin")
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Telemetry.QueryMetrics(
- context.TODO(),
- "metric_name",
- llamastackclient.TelemetryQueryMetricsParams{
- QueryType: llamastackclient.TelemetryQueryMetricsParamsQueryTypeRange,
- StartTime: 0,
- EndTime: llamastackclient.Int(0),
- Granularity: llamastackclient.String("granularity"),
- LabelMatchers: []llamastackclient.TelemetryQueryMetricsParamsLabelMatcher{{
- Name: "name",
- Operator: "=",
- Value: "value",
- }},
- },
- )
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestTelemetryQuerySpansWithOptionalParams(t *testing.T) {
- t.Skip("unsupported query params in java / kotlin")
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Telemetry.QuerySpans(context.TODO(), llamastackclient.TelemetryQuerySpansParams{
- AttributeFilters: []llamastackclient.QueryConditionParam{{
- Key: "key",
- Op: llamastackclient.QueryConditionOpEq,
- Value: llamastackclient.QueryConditionValueUnionParam{
- OfBool: llamastackclient.Bool(true),
- },
- }},
- AttributesToReturn: []string{"string"},
- MaxDepth: llamastackclient.Int(0),
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestTelemetryQueryTracesWithOptionalParams(t *testing.T) {
- t.Skip("unsupported query params in java / kotlin")
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Telemetry.QueryTraces(context.TODO(), llamastackclient.TelemetryQueryTracesParams{
- AttributeFilters: []llamastackclient.QueryConditionParam{{
- Key: "key",
- Op: llamastackclient.QueryConditionOpEq,
- Value: llamastackclient.QueryConditionValueUnionParam{
- OfBool: llamastackclient.Bool(true),
- },
- }},
- Limit: llamastackclient.Int(0),
- Offset: llamastackclient.Int(0),
- OrderBy: []string{"string"},
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
-func TestTelemetrySaveSpansToDatasetWithOptionalParams(t *testing.T) {
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := llamastackclient.NewClient(
- option.WithBaseURL(baseURL),
- )
- err := client.Telemetry.SaveSpansToDataset(context.TODO(), llamastackclient.TelemetrySaveSpansToDatasetParams{
- AttributeFilters: []llamastackclient.QueryConditionParam{{
- Key: "key",
- Op: llamastackclient.QueryConditionOpEq,
- Value: llamastackclient.QueryConditionValueUnionParam{
- OfBool: llamastackclient.Bool(true),
- },
- }},
- AttributesToSave: []string{"string"},
- DatasetID: "dataset_id",
- MaxDepth: llamastackclient.Int(0),
- })
- if err != nil {
- var apierr *llamastackclient.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
diff --git a/tool.go b/tool.go
index d2bbc35..adc6ac2 100644
--- a/tool.go
+++ b/tool.go
@@ -87,28 +87,25 @@ type Tool struct {
// Human-readable description of what the tool does
Description string `json:"description,required"`
Identifier string `json:"identifier,required"`
- ProviderID string `json:"provider_id,required"`
+ // List of parameters this tool accepts
+ Parameters []ToolParameter `json:"parameters,required"`
+ ProviderID string `json:"provider_id,required"`
// ID of the tool group this tool belongs to
ToolgroupID string `json:"toolgroup_id,required"`
// Type of resource, always 'tool'
Type constant.Tool `json:"type,required"`
- // JSON Schema for the tool's input parameters
- InputSchema map[string]ToolInputSchemaUnion `json:"input_schema"`
// (Optional) Additional metadata about the tool
- Metadata map[string]ToolMetadataUnion `json:"metadata"`
- // JSON Schema for the tool's output
- OutputSchema map[string]ToolOutputSchemaUnion `json:"output_schema"`
- ProviderResourceID string `json:"provider_resource_id"`
+ Metadata map[string]ToolMetadataUnion `json:"metadata"`
+ ProviderResourceID string `json:"provider_resource_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Description respjson.Field
Identifier respjson.Field
+ Parameters respjson.Field
ProviderID respjson.Field
ToolgroupID respjson.Field
Type respjson.Field
- InputSchema respjson.Field
Metadata respjson.Field
- OutputSchema respjson.Field
ProviderResourceID respjson.Field
ExtraFields map[string]respjson.Field
raw string
@@ -121,14 +118,50 @@ func (r *Tool) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ToolInputSchemaUnion contains all possible properties and values from [bool],
-// [float64], [string], [[]any].
+// Parameter definition for a tool.
+type ToolParameter struct {
+ // Human-readable description of what the parameter does
+ Description string `json:"description,required"`
+ // Name of the parameter
+ Name string `json:"name,required"`
+ // Type of the parameter (e.g., string, integer)
+ ParameterType string `json:"parameter_type,required"`
+ // Whether this parameter is required for tool invocation
+ Required bool `json:"required,required"`
+ // (Optional) Default value for the parameter if not provided
+ Default ToolParameterDefaultUnion `json:"default,nullable"`
+ // Type of the elements when parameter_type is array
+ Items any `json:"items"`
+ // (Optional) Title of the parameter
+ Title string `json:"title"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Description respjson.Field
+ Name respjson.Field
+ ParameterType respjson.Field
+ Required respjson.Field
+ Default respjson.Field
+ Items respjson.Field
+ Title respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolParameter) RawJSON() string { return r.JSON.raw }
+func (r *ToolParameter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToolParameterDefaultUnion contains all possible properties and values from
+// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolInputSchemaUnion struct {
+type ToolParameterDefaultUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -146,30 +179,30 @@ type ToolInputSchemaUnion struct {
} `json:"-"`
}
-func (u ToolInputSchemaUnion) AsBool() (v bool) {
+func (u ToolParameterDefaultUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolInputSchemaUnion) AsFloat() (v float64) {
+func (u ToolParameterDefaultUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolInputSchemaUnion) AsString() (v string) {
+func (u ToolParameterDefaultUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolInputSchemaUnion) AsAnyArray() (v []any) {
+func (u ToolParameterDefaultUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ToolInputSchemaUnion) RawJSON() string { return u.JSON.raw }
+func (u ToolParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
-func (r *ToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
+func (r *ToolParameterDefaultUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -225,58 +258,6 @@ func (r *ToolMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ToolOutputSchemaUnion contains all possible properties and values from [bool],
-// [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolOutputSchemaUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolOutputSchemaUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolOutputSchemaUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolOutputSchemaUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolOutputSchemaUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolOutputSchemaUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolOutputSchemaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type ToolListParams struct {
// The ID of the tool group to list tools for.
ToolgroupID param.Opt[string] `query:"toolgroup_id,omitzero" json:"-"`
diff --git a/toolruntime.go b/toolruntime.go
index ee34060..4336c9d 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -65,21 +65,18 @@ type ToolDef struct {
Name string `json:"name,required"`
// (Optional) Human-readable description of what the tool does
Description string `json:"description"`
- // (Optional) JSON Schema for tool inputs (MCP inputSchema)
- InputSchema map[string]ToolDefInputSchemaUnion `json:"input_schema"`
// (Optional) Additional metadata about the tool
Metadata map[string]ToolDefMetadataUnion `json:"metadata"`
- // (Optional) JSON Schema for tool outputs (MCP outputSchema)
- OutputSchema map[string]ToolDefOutputSchemaUnion `json:"output_schema"`
+ // (Optional) List of parameters this tool accepts
+ Parameters []ToolDefParameter `json:"parameters"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Name respjson.Field
- Description respjson.Field
- InputSchema respjson.Field
- Metadata respjson.Field
- OutputSchema respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Name respjson.Field
+ Description respjson.Field
+ Metadata respjson.Field
+ Parameters respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -98,58 +95,6 @@ func (r ToolDef) ToParam() ToolDefParam {
return param.Override[ToolDefParam](json.RawMessage(r.RawJSON()))
}
-// ToolDefInputSchemaUnion contains all possible properties and values from [bool],
-// [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolDefInputSchemaUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolDefInputSchemaUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolDefInputSchemaUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolDefInputSchemaUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolDefInputSchemaUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolDefInputSchemaUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolDefInputSchemaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// ToolDefMetadataUnion contains all possible properties and values from [bool],
// [float64], [string], [[]any].
//
@@ -202,14 +147,50 @@ func (r *ToolDefMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ToolDefOutputSchemaUnion contains all possible properties and values from
+// Parameter definition for a tool.
+type ToolDefParameter struct {
+ // Human-readable description of what the parameter does
+ Description string `json:"description,required"`
+ // Name of the parameter
+ Name string `json:"name,required"`
+ // Type of the parameter (e.g., string, integer)
+ ParameterType string `json:"parameter_type,required"`
+ // Whether this parameter is required for tool invocation
+ Required bool `json:"required,required"`
+ // (Optional) Default value for the parameter if not provided
+ Default ToolDefParameterDefaultUnion `json:"default,nullable"`
+ // Type of the elements when parameter_type is array
+ Items any `json:"items"`
+ // (Optional) Title of the parameter
+ Title string `json:"title"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Description respjson.Field
+ Name respjson.Field
+ ParameterType respjson.Field
+ Required respjson.Field
+ Default respjson.Field
+ Items respjson.Field
+ Title respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ToolDefParameter) RawJSON() string { return r.JSON.raw }
+func (r *ToolDefParameter) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ToolDefParameterDefaultUnion contains all possible properties and values from
// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolDefOutputSchemaUnion struct {
+type ToolDefParameterDefaultUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -227,30 +208,30 @@ type ToolDefOutputSchemaUnion struct {
} `json:"-"`
}
-func (u ToolDefOutputSchemaUnion) AsBool() (v bool) {
+func (u ToolDefParameterDefaultUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefOutputSchemaUnion) AsFloat() (v float64) {
+func (u ToolDefParameterDefaultUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefOutputSchemaUnion) AsString() (v string) {
+func (u ToolDefParameterDefaultUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefOutputSchemaUnion) AsAnyArray() (v []any) {
+func (u ToolDefParameterDefaultUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ToolDefOutputSchemaUnion) RawJSON() string { return u.JSON.raw }
+func (u ToolDefParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
-func (r *ToolDefOutputSchemaUnion) UnmarshalJSON(data []byte) error {
+func (r *ToolDefParameterDefaultUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -262,12 +243,10 @@ type ToolDefParam struct {
Name string `json:"name,required"`
// (Optional) Human-readable description of what the tool does
Description param.Opt[string] `json:"description,omitzero"`
- // (Optional) JSON Schema for tool inputs (MCP inputSchema)
- InputSchema map[string]ToolDefInputSchemaUnionParam `json:"input_schema,omitzero"`
// (Optional) Additional metadata about the tool
Metadata map[string]ToolDefMetadataUnionParam `json:"metadata,omitzero"`
- // (Optional) JSON Schema for tool outputs (MCP outputSchema)
- OutputSchema map[string]ToolDefOutputSchemaUnionParam `json:"output_schema,omitzero"`
+ // (Optional) List of parameters this tool accepts
+ Parameters []ToolDefParameterParam `json:"parameters,omitzero"`
paramObj
}
@@ -282,7 +261,7 @@ func (r *ToolDefParam) UnmarshalJSON(data []byte) error {
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefInputSchemaUnionParam struct {
+type ToolDefMetadataUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -290,14 +269,14 @@ type ToolDefInputSchemaUnionParam struct {
paramUnion
}
-func (u ToolDefInputSchemaUnionParam) MarshalJSON() ([]byte, error) {
+func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *ToolDefInputSchemaUnionParam) UnmarshalJSON(data []byte) error {
+func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *ToolDefInputSchemaUnionParam) asAny() any {
+func (u *ToolDefMetadataUnionParam) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -310,41 +289,39 @@ func (u *ToolDefInputSchemaUnionParam) asAny() any {
return nil
}
-// Only one field can be non-zero.
+// Parameter definition for a tool.
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefMetadataUnionParam struct {
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfAnyArray []any `json:",omitzero,inline"`
- paramUnion
+// The properties Description, Name, ParameterType, Required are required.
+type ToolDefParameterParam struct {
+ // Human-readable description of what the parameter does
+ Description string `json:"description,required"`
+ // Name of the parameter
+ Name string `json:"name,required"`
+ // Type of the parameter (e.g., string, integer)
+ ParameterType string `json:"parameter_type,required"`
+ // Whether this parameter is required for tool invocation
+ Required bool `json:"required,required"`
+ // (Optional) Title of the parameter
+ Title param.Opt[string] `json:"title,omitzero"`
+ // (Optional) Default value for the parameter if not provided
+ Default ToolDefParameterDefaultUnionParam `json:"default,omitzero"`
+ // Type of the elements when parameter_type is array
+ Items any `json:"items,omitzero"`
+ paramObj
}
-func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
-}
-func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+func (r ToolDefParameterParam) MarshalJSON() (data []byte, err error) {
+ type shadow ToolDefParameterParam
+ return param.MarshalObject(r, (*shadow)(&r))
}
-
-func (u *ToolDefMetadataUnionParam) asAny() any {
- if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfAnyArray) {
- return &u.OfAnyArray
- }
- return nil
+func (r *ToolDefParameterParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefOutputSchemaUnionParam struct {
+type ToolDefParameterDefaultUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -352,14 +329,14 @@ type ToolDefOutputSchemaUnionParam struct {
paramUnion
}
-func (u ToolDefOutputSchemaUnionParam) MarshalJSON() ([]byte, error) {
+func (u ToolDefParameterDefaultUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *ToolDefOutputSchemaUnionParam) UnmarshalJSON(data []byte) error {
+func (u *ToolDefParameterDefaultUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *ToolDefOutputSchemaUnionParam) asAny() any {
+func (u *ToolDefParameterDefaultUnionParam) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
From 65cef2268480297f4233dd1c4c817aa03943f18e Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 2 Oct 2025 18:05:31 +0000
Subject: [PATCH 30/33] fix(api): fix the ToolDefParam updates
---
.stats.yml | 4 +-
alphaagent_test.go | 18 +--
alphaagentturn.go | 17 +--
api.md | 9 +-
shared.go | 334 ++-------------------------------------------
tool.go | 220 +++--------------------------
toolruntime.go | 198 +++++++++++++++------------
7 files changed, 165 insertions(+), 635 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index cbd436b..724604d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 93
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-41cb5d8049e6ffd933a7ad6bbbb76b2fef2e864d0d857c91799ee16e9a796883.yml
-openapi_spec_hash: 5e0bdf64563e020ef14b968ab724d2db
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f26df77f0800baeaea40407776f6c1e618756037969411e29de209ce961655dd.yml
+openapi_spec_hash: e7c2329edc0f9f5aa1c78b6afb996e1c
config_hash: 0412cd40c0609550c1a47c69dd104e4f
diff --git a/alphaagent_test.go b/alphaagent_test.go
index 4fefd68..521bf81 100644
--- a/alphaagent_test.go
+++ b/alphaagent_test.go
@@ -31,22 +31,22 @@ func TestAlphaAgentNewWithOptionalParams(t *testing.T) {
ClientTools: []llamastackclient.ToolDefParam{{
Name: "name",
Description: llamastackclient.String("description"),
+ InputSchema: map[string]llamastackclient.ToolDefInputSchemaUnionParam{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ },
Metadata: map[string]llamastackclient.ToolDefMetadataUnionParam{
"foo": {
OfBool: llamastackclient.Bool(true),
},
},
- Parameters: []llamastackclient.ToolDefParameterParam{{
- Description: "description",
- Name: "name",
- ParameterType: "parameter_type",
- Required: true,
- Default: llamastackclient.ToolDefParameterDefaultUnionParam{
+ OutputSchema: map[string]llamastackclient.ToolDefOutputSchemaUnionParam{
+ "foo": {
OfBool: llamastackclient.Bool(true),
},
- Items: map[string]interface{}{},
- Title: llamastackclient.String("title"),
- }},
+ },
+ ToolgroupID: llamastackclient.String("toolgroup_id"),
}},
EnableSessionPersistence: llamastackclient.Bool(true),
InputShields: []string{"string"},
diff --git a/alphaagentturn.go b/alphaagentturn.go
index 8293df4..50da6a4 100644
--- a/alphaagentturn.go
+++ b/alphaagentturn.go
@@ -945,20 +945,17 @@ type TurnResponseEventPayloadStepProgressDeltaToolCallToolCallUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field is from variant [ToolCall].
- Arguments ToolCallArgumentsUnion `json:"arguments"`
+ Arguments string `json:"arguments"`
// This field is from variant [ToolCall].
CallID string `json:"call_id"`
// This field is from variant [ToolCall].
ToolName ToolCallToolName `json:"tool_name"`
- // This field is from variant [ToolCall].
- ArgumentsJson string `json:"arguments_json"`
- JSON struct {
- OfString respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- ToolName respjson.Field
- ArgumentsJson respjson.Field
- raw string
+ JSON struct {
+ OfString respjson.Field
+ Arguments respjson.Field
+ CallID respjson.Field
+ ToolName respjson.Field
+ raw string
} `json:"-"`
}
diff --git a/api.md b/api.md
index 6638d36..10a6da4 100644
--- a/api.md
+++ b/api.md
@@ -45,15 +45,10 @@ Methods:
# Tools
-Response Types:
-
-- llamastackclient.ListToolsResponse
-- llamastackclient.Tool
-
Methods:
-- client.Tools.List(ctx context.Context, query llamastackclient.ToolListParams) ([]llamastackclient.Tool, error)
-- client.Tools.Get(ctx context.Context, toolName string) (llamastackclient.Tool, error)
+- client.Tools.List(ctx context.Context, query llamastackclient.ToolListParams) ([]llamastackclient.ToolDef, error)
+- client.Tools.Get(ctx context.Context, toolName string) (llamastackclient.ToolDef, error)
# ToolRuntime
diff --git a/shared.go b/shared.go
index f87b0a5..bac7869 100644
--- a/shared.go
+++ b/shared.go
@@ -2825,18 +2825,16 @@ func (r *SystemMessageParam) UnmarshalJSON(data []byte) error {
}
type ToolCall struct {
- Arguments ToolCallArgumentsUnion `json:"arguments,required"`
- CallID string `json:"call_id,required"`
- ToolName ToolCallToolName `json:"tool_name,required"`
- ArgumentsJson string `json:"arguments_json"`
+ Arguments string `json:"arguments,required"`
+ CallID string `json:"call_id,required"`
+ ToolName ToolCallToolName `json:"tool_name,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Arguments respjson.Field
- CallID respjson.Field
- ToolName respjson.Field
- ArgumentsJson respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Arguments respjson.Field
+ CallID respjson.Field
+ ToolName respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -2855,196 +2853,6 @@ func (r ToolCall) ToParam() ToolCallParam {
return param.Override[ToolCallParam](json.RawMessage(r.RawJSON()))
}
-// ToolCallArgumentsUnion contains all possible properties and values from
-// [string], [map[string]ToolCallArgumentsMapItemUnion].
-//
-// 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: OfString OfFloat OfBool OfToolCallArgumentsMapItemArray]
-type ToolCallArgumentsUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a
- // [[]ToolCallArgumentsMapItemArrayItemUnion] instead of an object.
- OfToolCallArgumentsMapItemArray []ToolCallArgumentsMapItemArrayItemUnion `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfFloat respjson.Field
- OfBool respjson.Field
- OfToolCallArgumentsMapItemArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolCallArgumentsUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsUnion) AsToolCallArgumentsMapMap() (v map[string]ToolCallArgumentsMapItemUnion) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolCallArgumentsUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolCallArgumentsUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolCallArgumentsMapItemUnion contains all possible properties and values from
-// [string], [float64], [bool], [[]ToolCallArgumentsMapItemArrayItemUnion],
-// [map[string]ToolCallArgumentsMapItemMapItemUnion].
-//
-// 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: OfString OfFloat OfBool OfToolCallArgumentsMapItemArray]
-type ToolCallArgumentsMapItemUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a
- // [[]ToolCallArgumentsMapItemArrayItemUnion] instead of an object.
- OfToolCallArgumentsMapItemArray []ToolCallArgumentsMapItemArrayItemUnion `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfFloat respjson.Field
- OfBool respjson.Field
- OfToolCallArgumentsMapItemArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolCallArgumentsMapItemUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemUnion) AsToolCallArgumentsMapItemArray() (v []ToolCallArgumentsMapItemArrayItemUnion) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemUnion) AsToolCallArgumentsMapItemMapMap() (v map[string]ToolCallArgumentsMapItemMapItemUnion) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolCallArgumentsMapItemUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolCallArgumentsMapItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolCallArgumentsMapItemArrayItemUnion contains all possible properties and
-// values from [string], [float64], [bool].
-//
-// 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: OfString OfFloat OfBool]
-type ToolCallArgumentsMapItemArrayItemUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfFloat respjson.Field
- OfBool respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolCallArgumentsMapItemArrayItemUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemArrayItemUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemArrayItemUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolCallArgumentsMapItemArrayItemUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolCallArgumentsMapItemArrayItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolCallArgumentsMapItemMapItemUnion contains all possible properties and values
-// from [string], [float64], [bool].
-//
-// 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: OfString OfFloat OfBool]
-type ToolCallArgumentsMapItemMapItemUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfFloat respjson.Field
- OfBool respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolCallArgumentsMapItemMapItemUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemMapItemUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolCallArgumentsMapItemMapItemUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolCallArgumentsMapItemMapItemUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolCallArgumentsMapItemMapItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type ToolCallToolName string
const (
@@ -3056,10 +2864,9 @@ const (
// The properties Arguments, CallID, ToolName are required.
type ToolCallParam struct {
- Arguments ToolCallArgumentsUnionParam `json:"arguments,omitzero,required"`
- CallID string `json:"call_id,required"`
- ToolName ToolCallToolName `json:"tool_name,omitzero,required"`
- ArgumentsJson param.Opt[string] `json:"arguments_json,omitzero"`
+ Arguments string `json:"arguments,required"`
+ CallID string `json:"call_id,required"`
+ ToolName ToolCallToolName `json:"tool_name,omitzero,required"`
paramObj
}
@@ -3071,125 +2878,6 @@ func (r *ToolCallParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolCallArgumentsUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfToolCallArgumentsMapMap map[string]ToolCallArgumentsMapItemUnionParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ToolCallArgumentsUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfToolCallArgumentsMapMap)
-}
-func (u *ToolCallArgumentsUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ToolCallArgumentsUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfToolCallArgumentsMapMap) {
- return &u.OfToolCallArgumentsMapMap
- }
- return nil
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolCallArgumentsMapItemUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- OfToolCallArgumentsMapItemArray []ToolCallArgumentsMapItemArrayItemUnionParam `json:",omitzero,inline"`
- OfToolCallArgumentsMapItemMapMap map[string]ToolCallArgumentsMapItemMapItemUnionParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ToolCallArgumentsMapItemUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString,
- u.OfFloat,
- u.OfBool,
- u.OfToolCallArgumentsMapItemArray,
- u.OfToolCallArgumentsMapItemMapMap)
-}
-func (u *ToolCallArgumentsMapItemUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ToolCallArgumentsMapItemUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- } else if !param.IsOmitted(u.OfToolCallArgumentsMapItemArray) {
- return &u.OfToolCallArgumentsMapItemArray
- } else if !param.IsOmitted(u.OfToolCallArgumentsMapItemMapMap) {
- return &u.OfToolCallArgumentsMapItemMapMap
- }
- return nil
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolCallArgumentsMapItemArrayItemUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ToolCallArgumentsMapItemArrayItemUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
-}
-func (u *ToolCallArgumentsMapItemArrayItemUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ToolCallArgumentsMapItemArrayItemUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- }
- return nil
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type ToolCallArgumentsMapItemMapItemUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u ToolCallArgumentsMapItemMapItemUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
-}
-func (u *ToolCallArgumentsMapItemMapItemUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *ToolCallArgumentsMapItemMapItemUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- }
- return nil
-}
-
// A message representing the result of a tool invocation.
type ToolResponseMessage struct {
// Unique identifier for the tool call this response is for
diff --git a/tool.go b/tool.go
index adc6ac2..c2897cb 100644
--- a/tool.go
+++ b/tool.go
@@ -4,7 +4,6 @@ package llamastackclient
import (
"context"
- "encoding/json"
"errors"
"fmt"
"net/http"
@@ -17,7 +16,6 @@ import (
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
"github.com/llamastack/llama-stack-client-go/packages/respjson"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// ToolService contains methods and other services that help with interacting with
@@ -40,8 +38,8 @@ func NewToolService(opts ...option.RequestOption) (r ToolService) {
}
// List tools with optional tool group.
-func (r *ToolService) List(ctx context.Context, query ToolListParams, opts ...option.RequestOption) (res *[]Tool, err error) {
- var env ListToolsResponse
+func (r *ToolService) List(ctx context.Context, query ToolListParams, opts ...option.RequestOption) (res *[]ToolDef, err error) {
+ var env ToolListResponseEnvelope
opts = slices.Concat(r.Options, opts)
path := "v1/tools"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &env, opts...)
@@ -53,7 +51,7 @@ func (r *ToolService) List(ctx context.Context, query ToolListParams, opts ...op
}
// Get a tool by its name.
-func (r *ToolService) Get(ctx context.Context, toolName string, opts ...option.RequestOption) (res *Tool, err error) {
+func (r *ToolService) Get(ctx context.Context, toolName string, opts ...option.RequestOption) (res *ToolDef, err error) {
opts = slices.Concat(r.Options, opts)
if toolName == "" {
err = errors.New("missing required tool_name parameter")
@@ -64,200 +62,6 @@ func (r *ToolService) Get(ctx context.Context, toolName string, opts ...option.R
return
}
-// Response containing a list of tools.
-type ListToolsResponse struct {
- // List of tools
- Data []Tool `json:"data,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 ListToolsResponse) RawJSON() string { return r.JSON.raw }
-func (r *ListToolsResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// A tool that can be invoked by agents.
-type Tool struct {
- // Human-readable description of what the tool does
- Description string `json:"description,required"`
- Identifier string `json:"identifier,required"`
- // List of parameters this tool accepts
- Parameters []ToolParameter `json:"parameters,required"`
- ProviderID string `json:"provider_id,required"`
- // ID of the tool group this tool belongs to
- ToolgroupID string `json:"toolgroup_id,required"`
- // Type of resource, always 'tool'
- Type constant.Tool `json:"type,required"`
- // (Optional) Additional metadata about the tool
- Metadata map[string]ToolMetadataUnion `json:"metadata"`
- ProviderResourceID string `json:"provider_resource_id"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Description respjson.Field
- Identifier respjson.Field
- Parameters respjson.Field
- ProviderID respjson.Field
- ToolgroupID respjson.Field
- Type respjson.Field
- Metadata respjson.Field
- ProviderResourceID respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r Tool) RawJSON() string { return r.JSON.raw }
-func (r *Tool) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Parameter definition for a tool.
-type ToolParameter struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Default value for the parameter if not provided
- Default ToolParameterDefaultUnion `json:"default,nullable"`
- // Type of the elements when parameter_type is array
- Items any `json:"items"`
- // (Optional) Title of the parameter
- Title string `json:"title"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Description respjson.Field
- Name respjson.Field
- ParameterType respjson.Field
- Required respjson.Field
- Default respjson.Field
- Items respjson.Field
- Title respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ToolParameter) RawJSON() string { return r.JSON.raw }
-func (r *ToolParameter) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolParameterDefaultUnion contains all possible properties and values from
-// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolParameterDefaultUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolParameterDefaultUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolParameterDefaultUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolParameterDefaultUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolParameterDefaultUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolParameterDefaultUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolMetadataUnion contains all possible properties and values from [bool],
-// [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolMetadataUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ToolMetadataUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolMetadataUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolMetadataUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ToolMetadataUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ToolMetadataUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ToolMetadataUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type ToolListParams struct {
// The ID of the tool group to list tools for.
ToolgroupID param.Opt[string] `query:"toolgroup_id,omitzero" json:"-"`
@@ -271,3 +75,21 @@ func (r ToolListParams) URLQuery() (v url.Values, err error) {
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
+
+// Response containing a list of tool definitions.
+type ToolListResponseEnvelope struct {
+ // List of tool definitions
+ Data []ToolDef `json:"data,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 ToolListResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *ToolListResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
diff --git a/toolruntime.go b/toolruntime.go
index 4336c9d..8a9db97 100644
--- a/toolruntime.go
+++ b/toolruntime.go
@@ -65,18 +65,24 @@ type ToolDef struct {
Name string `json:"name,required"`
// (Optional) Human-readable description of what the tool does
Description string `json:"description"`
+ // (Optional) JSON Schema for tool inputs (MCP inputSchema)
+ InputSchema map[string]ToolDefInputSchemaUnion `json:"input_schema"`
// (Optional) Additional metadata about the tool
Metadata map[string]ToolDefMetadataUnion `json:"metadata"`
- // (Optional) List of parameters this tool accepts
- Parameters []ToolDefParameter `json:"parameters"`
+ // (Optional) JSON Schema for tool outputs (MCP outputSchema)
+ OutputSchema map[string]ToolDefOutputSchemaUnion `json:"output_schema"`
+ // (Optional) ID of the tool group this tool belongs to
+ ToolgroupID string `json:"toolgroup_id"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Name respjson.Field
- Description respjson.Field
- Metadata respjson.Field
- Parameters respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ Name respjson.Field
+ Description respjson.Field
+ InputSchema respjson.Field
+ Metadata respjson.Field
+ OutputSchema respjson.Field
+ ToolgroupID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -95,6 +101,58 @@ func (r ToolDef) ToParam() ToolDefParam {
return param.Override[ToolDefParam](json.RawMessage(r.RawJSON()))
}
+// ToolDefInputSchemaUnion contains all possible properties and values from [bool],
+// [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ToolDefInputSchemaUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ToolDefInputSchemaUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefInputSchemaUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefInputSchemaUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ToolDefInputSchemaUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ToolDefInputSchemaUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ToolDefInputSchemaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
// ToolDefMetadataUnion contains all possible properties and values from [bool],
// [float64], [string], [[]any].
//
@@ -147,50 +205,14 @@ func (r *ToolDefMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Parameter definition for a tool.
-type ToolDefParameter struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Default value for the parameter if not provided
- Default ToolDefParameterDefaultUnion `json:"default,nullable"`
- // Type of the elements when parameter_type is array
- Items any `json:"items"`
- // (Optional) Title of the parameter
- Title string `json:"title"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Description respjson.Field
- Name respjson.Field
- ParameterType respjson.Field
- Required respjson.Field
- Default respjson.Field
- Items respjson.Field
- Title respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ToolDefParameter) RawJSON() string { return r.JSON.raw }
-func (r *ToolDefParameter) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ToolDefParameterDefaultUnion contains all possible properties and values from
+// ToolDefOutputSchemaUnion contains all possible properties and values from
// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ToolDefParameterDefaultUnion struct {
+type ToolDefOutputSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -208,30 +230,30 @@ type ToolDefParameterDefaultUnion struct {
} `json:"-"`
}
-func (u ToolDefParameterDefaultUnion) AsBool() (v bool) {
+func (u ToolDefOutputSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefParameterDefaultUnion) AsFloat() (v float64) {
+func (u ToolDefOutputSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefParameterDefaultUnion) AsString() (v string) {
+func (u ToolDefOutputSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ToolDefParameterDefaultUnion) AsAnyArray() (v []any) {
+func (u ToolDefOutputSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ToolDefParameterDefaultUnion) RawJSON() string { return u.JSON.raw }
+func (u ToolDefOutputSchemaUnion) RawJSON() string { return u.JSON.raw }
-func (r *ToolDefParameterDefaultUnion) UnmarshalJSON(data []byte) error {
+func (r *ToolDefOutputSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
@@ -243,10 +265,14 @@ type ToolDefParam struct {
Name string `json:"name,required"`
// (Optional) Human-readable description of what the tool does
Description param.Opt[string] `json:"description,omitzero"`
+ // (Optional) ID of the tool group this tool belongs to
+ ToolgroupID param.Opt[string] `json:"toolgroup_id,omitzero"`
+ // (Optional) JSON Schema for tool inputs (MCP inputSchema)
+ InputSchema map[string]ToolDefInputSchemaUnionParam `json:"input_schema,omitzero"`
// (Optional) Additional metadata about the tool
Metadata map[string]ToolDefMetadataUnionParam `json:"metadata,omitzero"`
- // (Optional) List of parameters this tool accepts
- Parameters []ToolDefParameterParam `json:"parameters,omitzero"`
+ // (Optional) JSON Schema for tool outputs (MCP outputSchema)
+ OutputSchema map[string]ToolDefOutputSchemaUnionParam `json:"output_schema,omitzero"`
paramObj
}
@@ -261,7 +287,7 @@ func (r *ToolDefParam) UnmarshalJSON(data []byte) error {
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefMetadataUnionParam struct {
+type ToolDefInputSchemaUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -269,14 +295,14 @@ type ToolDefMetadataUnionParam struct {
paramUnion
}
-func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
+func (u ToolDefInputSchemaUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
+func (u *ToolDefInputSchemaUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *ToolDefMetadataUnionParam) asAny() any {
+func (u *ToolDefInputSchemaUnionParam) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
@@ -289,39 +315,41 @@ func (u *ToolDefMetadataUnionParam) asAny() any {
return nil
}
-// Parameter definition for a tool.
+// Only one field can be non-zero.
//
-// The properties Description, Name, ParameterType, Required are required.
-type ToolDefParameterParam struct {
- // Human-readable description of what the parameter does
- Description string `json:"description,required"`
- // Name of the parameter
- Name string `json:"name,required"`
- // Type of the parameter (e.g., string, integer)
- ParameterType string `json:"parameter_type,required"`
- // Whether this parameter is required for tool invocation
- Required bool `json:"required,required"`
- // (Optional) Title of the parameter
- Title param.Opt[string] `json:"title,omitzero"`
- // (Optional) Default value for the parameter if not provided
- Default ToolDefParameterDefaultUnionParam `json:"default,omitzero"`
- // Type of the elements when parameter_type is array
- Items any `json:"items,omitzero"`
- paramObj
+// Use [param.IsOmitted] to confirm if a field is set.
+type ToolDefMetadataUnionParam struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
}
-func (r ToolDefParameterParam) MarshalJSON() (data []byte, err error) {
- type shadow ToolDefParameterParam
- return param.MarshalObject(r, (*shadow)(&r))
+func (u ToolDefMetadataUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (r *ToolDefParameterParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func (u *ToolDefMetadataUnionParam) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ToolDefMetadataUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
}
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type ToolDefParameterDefaultUnionParam struct {
+type ToolDefOutputSchemaUnionParam struct {
OfBool param.Opt[bool] `json:",omitzero,inline"`
OfFloat param.Opt[float64] `json:",omitzero,inline"`
OfString param.Opt[string] `json:",omitzero,inline"`
@@ -329,14 +357,14 @@ type ToolDefParameterDefaultUnionParam struct {
paramUnion
}
-func (u ToolDefParameterDefaultUnionParam) MarshalJSON() ([]byte, error) {
+func (u ToolDefOutputSchemaUnionParam) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *ToolDefParameterDefaultUnionParam) UnmarshalJSON(data []byte) error {
+func (u *ToolDefOutputSchemaUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *ToolDefParameterDefaultUnionParam) asAny() any {
+func (u *ToolDefOutputSchemaUnionParam) asAny() any {
if !param.IsOmitted(u.OfBool) {
return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
From 6c9752f49b98e57c4ce06c6310f33d19207b3ae1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 2 Oct 2025 18:18:40 +0000
Subject: [PATCH 31/33] feat(api): fixes to URLs
---
.stats.yml | 4 +-
api.md | 46 +-
benchmark.go | 202 ++++++++
benchmark_test.go | 88 ++++
dataset.go | 1236 +++++++++++++++++++++++++++++++++++++++++++++
dataset_test.go | 170 +++++++
telemetry.go | 985 +++++++++++++++++++++++-------------
telemetry_test.go | 205 +++++++-
8 files changed, 2551 insertions(+), 385 deletions(-)
create mode 100644 benchmark_test.go
create mode 100644 dataset_test.go
diff --git a/.stats.yml b/.stats.yml
index 724604d..a88d26a 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 93
+configured_endpoints: 108
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f26df77f0800baeaea40407776f6c1e618756037969411e29de209ce961655dd.yml
openapi_spec_hash: e7c2329edc0f9f5aa1c78b6afb996e1c
-config_hash: 0412cd40c0609550c1a47c69dd104e4f
+config_hash: 8800bdff1a087b9d5211dda2a7b9f66f
diff --git a/api.md b/api.md
index 10a6da4..8980691 100644
--- a/api.md
+++ b/api.md
@@ -102,6 +102,22 @@ Methods:
# Datasets
+Response Types:
+
+- llamastackclient.ListDatasetsResponse
+- llamastackclient.DatasetGetResponse
+- llamastackclient.DatasetIterrowsResponse
+- llamastackclient.DatasetRegisterResponse
+
+Methods:
+
+- client.Datasets.Get(ctx context.Context, datasetID string) (llamastackclient.DatasetGetResponse, error)
+- client.Datasets.List(ctx context.Context) ([]llamastackclient.ListDatasetsResponseData, error)
+- client.Datasets.Appendrows(ctx context.Context, datasetID string, body llamastackclient.DatasetAppendrowsParams) error
+- client.Datasets.Iterrows(ctx context.Context, datasetID string, query llamastackclient.DatasetIterrowsParams) (llamastackclient.DatasetIterrowsResponse, error)
+- client.Datasets.Register(ctx context.Context, body llamastackclient.DatasetRegisterParams) (llamastackclient.DatasetRegisterResponse, error)
+- client.Datasets.Unregister(ctx context.Context, datasetID string) error
+
# Inspect
Response Types:
@@ -320,11 +336,26 @@ Methods:
Params Types:
-- llamastackclient.EventUnionParam
+- llamastackclient.QueryConditionParam
+
+Response Types:
+
+- llamastackclient.QuerySpansResponse
+- llamastackclient.SpanWithStatus
+- llamastackclient.Trace
+- llamastackclient.TelemetryGetSpanResponse
+- llamastackclient.TelemetryGetSpanTreeResponse
+- llamastackclient.TelemetryQueryMetricsResponse
Methods:
-- client.Telemetry.LogEvent(ctx context.Context, body llamastackclient.TelemetryLogEventParams) error
+- client.Telemetry.GetSpan(ctx context.Context, spanID string, query llamastackclient.TelemetryGetSpanParams) (llamastackclient.TelemetryGetSpanResponse, error)
+- client.Telemetry.GetSpanTree(ctx context.Context, spanID string, body llamastackclient.TelemetryGetSpanTreeParams) (llamastackclient.TelemetryGetSpanTreeResponse, error)
+- client.Telemetry.GetTrace(ctx context.Context, traceID string) (llamastackclient.Trace, error)
+- client.Telemetry.QueryMetrics(ctx context.Context, metricName string, body llamastackclient.TelemetryQueryMetricsParams) ([]llamastackclient.TelemetryQueryMetricsResponse, error)
+- client.Telemetry.QuerySpans(ctx context.Context, body llamastackclient.TelemetryQuerySpansParams) ([]llamastackclient.QuerySpansResponseData, error)
+- client.Telemetry.QueryTraces(ctx context.Context, body llamastackclient.TelemetryQueryTracesParams) ([]llamastackclient.Trace, error)
+- client.Telemetry.SaveSpansToDataset(ctx context.Context, body llamastackclient.TelemetrySaveSpansToDatasetParams) error
# Scoring
@@ -358,6 +389,17 @@ Methods:
# Benchmarks
+Response Types:
+
+- llamastackclient.Benchmark
+- llamastackclient.ListBenchmarksResponse
+
+Methods:
+
+- client.Benchmarks.Get(ctx context.Context, benchmarkID string) (llamastackclient.Benchmark, error)
+- client.Benchmarks.List(ctx context.Context) ([]llamastackclient.Benchmark, error)
+- client.Benchmarks.Register(ctx context.Context, body llamastackclient.BenchmarkRegisterParams) error
+
# Files
Response Types:
diff --git a/benchmark.go b/benchmark.go
index 93f2c30..2e68c53 100644
--- a/benchmark.go
+++ b/benchmark.go
@@ -3,7 +3,19 @@
package llamastackclient
import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "net/http"
+ "slices"
+
+ "github.com/llamastack/llama-stack-client-go/internal/apijson"
+ "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
+ "github.com/llamastack/llama-stack-client-go/packages/param"
+ "github.com/llamastack/llama-stack-client-go/packages/respjson"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// BenchmarkService contains methods and other services that help with interacting
@@ -24,3 +36,193 @@ func NewBenchmarkService(opts ...option.RequestOption) (r BenchmarkService) {
r.Options = opts
return
}
+
+// Get a benchmark by its ID.
+func (r *BenchmarkService) Get(ctx context.Context, benchmarkID string, opts ...option.RequestOption) (res *Benchmark, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if benchmarkID == "" {
+ err = errors.New("missing required benchmark_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1alpha/eval/benchmarks/%s", benchmarkID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
+// List all benchmarks.
+func (r *BenchmarkService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Benchmark, err error) {
+ var env ListBenchmarksResponse
+ opts = slices.Concat(r.Options, opts)
+ path := "v1alpha/eval/benchmarks"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Data
+ return
+}
+
+// Register a benchmark.
+func (r *BenchmarkService) Register(ctx context.Context, body BenchmarkRegisterParams, opts ...option.RequestOption) (err error) {
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ path := "v1alpha/eval/benchmarks"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
+ return
+}
+
+// A benchmark resource for evaluating model performance.
+type Benchmark struct {
+ // Identifier of the dataset to use for the benchmark evaluation
+ DatasetID string `json:"dataset_id,required"`
+ Identifier string `json:"identifier,required"`
+ // Metadata for this evaluation task
+ Metadata map[string]BenchmarkMetadataUnion `json:"metadata,required"`
+ ProviderID string `json:"provider_id,required"`
+ // List of scoring function identifiers to apply during evaluation
+ ScoringFunctions []string `json:"scoring_functions,required"`
+ // The resource type, always benchmark
+ Type constant.Benchmark `json:"type,required"`
+ ProviderResourceID string `json:"provider_resource_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ DatasetID respjson.Field
+ Identifier respjson.Field
+ Metadata respjson.Field
+ ProviderID respjson.Field
+ ScoringFunctions respjson.Field
+ Type respjson.Field
+ ProviderResourceID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r Benchmark) RawJSON() string { return r.JSON.raw }
+func (r *Benchmark) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// BenchmarkMetadataUnion contains all possible properties and values from [bool],
+// [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type BenchmarkMetadataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u BenchmarkMetadataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BenchmarkMetadataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BenchmarkMetadataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u BenchmarkMetadataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u BenchmarkMetadataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *BenchmarkMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type ListBenchmarksResponse struct {
+ Data []Benchmark `json:"data,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 ListBenchmarksResponse) RawJSON() string { return r.JSON.raw }
+func (r *ListBenchmarksResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type BenchmarkRegisterParams struct {
+ // The ID of the benchmark to register.
+ BenchmarkID string `json:"benchmark_id,required"`
+ // The ID of the dataset to use for the benchmark.
+ DatasetID string `json:"dataset_id,required"`
+ // The scoring functions to use for the benchmark.
+ ScoringFunctions []string `json:"scoring_functions,omitzero,required"`
+ // The ID of the provider benchmark to use for the benchmark.
+ ProviderBenchmarkID param.Opt[string] `json:"provider_benchmark_id,omitzero"`
+ // The ID of the provider to use for the benchmark.
+ ProviderID param.Opt[string] `json:"provider_id,omitzero"`
+ // The metadata to use for the benchmark.
+ Metadata map[string]BenchmarkRegisterParamsMetadataUnion `json:"metadata,omitzero"`
+ paramObj
+}
+
+func (r BenchmarkRegisterParams) MarshalJSON() (data []byte, err error) {
+ type shadow BenchmarkRegisterParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *BenchmarkRegisterParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type BenchmarkRegisterParamsMetadataUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u BenchmarkRegisterParamsMetadataUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *BenchmarkRegisterParamsMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *BenchmarkRegisterParamsMetadataUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
diff --git a/benchmark_test.go b/benchmark_test.go
new file mode 100644
index 0000000..368eeb7
--- /dev/null
+++ b/benchmark_test.go
@@ -0,0 +1,88 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/llamastack/llama-stack-client-go"
+ "github.com/llamastack/llama-stack-client-go/internal/testutil"
+ "github.com/llamastack/llama-stack-client-go/option"
+)
+
+func TestBenchmarkGet(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Benchmarks.Get(context.TODO(), "benchmark_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestBenchmarkList(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Benchmarks.List(context.TODO())
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestBenchmarkRegisterWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ err := client.Benchmarks.Register(context.TODO(), llamastackclient.BenchmarkRegisterParams{
+ BenchmarkID: "benchmark_id",
+ DatasetID: "dataset_id",
+ ScoringFunctions: []string{"string"},
+ Metadata: map[string]llamastackclient.BenchmarkRegisterParamsMetadataUnion{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ },
+ ProviderBenchmarkID: llamastackclient.String("provider_benchmark_id"),
+ ProviderID: llamastackclient.String("provider_id"),
+ })
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/dataset.go b/dataset.go
index 5821c4a..018219b 100644
--- a/dataset.go
+++ b/dataset.go
@@ -3,7 +3,21 @@
package llamastackclient
import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "slices"
+
+ "github.com/llamastack/llama-stack-client-go/internal/apijson"
+ "github.com/llamastack/llama-stack-client-go/internal/apiquery"
+ "github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
+ "github.com/llamastack/llama-stack-client-go/packages/param"
+ "github.com/llamastack/llama-stack-client-go/packages/respjson"
+ "github.com/llamastack/llama-stack-client-go/shared/constant"
)
// DatasetService contains methods and other services that help with interacting
@@ -24,3 +38,1225 @@ func NewDatasetService(opts ...option.RequestOption) (r DatasetService) {
r.Options = opts
return
}
+
+// Get a dataset by its ID.
+func (r *DatasetService) Get(ctx context.Context, datasetID string, opts ...option.RequestOption) (res *DatasetGetResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if datasetID == "" {
+ err = errors.New("missing required dataset_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1beta/datasets/%s", datasetID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
+// List all datasets.
+func (r *DatasetService) List(ctx context.Context, opts ...option.RequestOption) (res *[]ListDatasetsResponseData, err error) {
+ var env ListDatasetsResponse
+ opts = slices.Concat(r.Options, opts)
+ path := "v1beta/datasets"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &env, opts...)
+ if err != nil {
+ return
+ }
+ res = &env.Data
+ return
+}
+
+// Append rows to a dataset.
+func (r *DatasetService) Appendrows(ctx context.Context, datasetID string, body DatasetAppendrowsParams, opts ...option.RequestOption) (err error) {
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ if datasetID == "" {
+ err = errors.New("missing required dataset_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1beta/datasetio/append-rows/%s", datasetID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
+ return
+}
+
+// Get a paginated list of rows from a dataset. Uses offset-based pagination where:
+//
+// - start_index: The starting index (0-based). If None, starts from beginning.
+// - limit: Number of items to return. If None or -1, returns all items.
+//
+// The response includes:
+//
+// - data: List of items for the current page.
+// - has_more: Whether there are more items available after this set.
+func (r *DatasetService) Iterrows(ctx context.Context, datasetID string, query DatasetIterrowsParams, opts ...option.RequestOption) (res *DatasetIterrowsResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if datasetID == "" {
+ err = errors.New("missing required dataset_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1beta/datasetio/iterrows/%s", datasetID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
+ return
+}
+
+// Register a new dataset.
+func (r *DatasetService) Register(ctx context.Context, body DatasetRegisterParams, opts ...option.RequestOption) (res *DatasetRegisterResponse, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1beta/datasets"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Unregister a dataset by its ID.
+func (r *DatasetService) Unregister(ctx context.Context, datasetID string, opts ...option.RequestOption) (err error) {
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ if datasetID == "" {
+ err = errors.New("missing required dataset_id parameter")
+ return
+ }
+ path := fmt.Sprintf("v1beta/datasets/%s", datasetID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodDelete, path, nil, nil, opts...)
+ return
+}
+
+// Response from listing datasets.
+type ListDatasetsResponse struct {
+ // List of datasets
+ Data []ListDatasetsResponseData `json:"data,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 ListDatasetsResponse) RawJSON() string { return r.JSON.raw }
+func (r *ListDatasetsResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Dataset resource for storing and accessing training or evaluation data.
+type ListDatasetsResponseData struct {
+ Identifier string `json:"identifier,required"`
+ // Additional metadata for the dataset
+ Metadata map[string]ListDatasetsResponseDataMetadataUnion `json:"metadata,required"`
+ ProviderID string `json:"provider_id,required"`
+ // Purpose of the dataset indicating its intended use
+ //
+ // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
+ Purpose string `json:"purpose,required"`
+ // Data source configuration for the dataset
+ Source ListDatasetsResponseDataSourceUnion `json:"source,required"`
+ // Type of resource, always 'dataset' for datasets
+ Type constant.Dataset `json:"type,required"`
+ ProviderResourceID string `json:"provider_resource_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Identifier respjson.Field
+ Metadata respjson.Field
+ ProviderID respjson.Field
+ Purpose respjson.Field
+ Source respjson.Field
+ Type respjson.Field
+ ProviderResourceID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ListDatasetsResponseData) RawJSON() string { return r.JSON.raw }
+func (r *ListDatasetsResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ListDatasetsResponseDataMetadataUnion contains all possible properties and
+// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ListDatasetsResponseDataMetadataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ListDatasetsResponseDataMetadataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataMetadataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataMetadataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataMetadataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ListDatasetsResponseDataMetadataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ListDatasetsResponseDataMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ListDatasetsResponseDataSourceUnion contains all possible properties and values
+// from [ListDatasetsResponseDataSourceUri], [ListDatasetsResponseDataSourceRows].
+//
+// Use the [ListDatasetsResponseDataSourceUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type ListDatasetsResponseDataSourceUnion struct {
+ // Any of "uri", "rows".
+ Type string `json:"type"`
+ // This field is from variant [ListDatasetsResponseDataSourceUri].
+ Uri string `json:"uri"`
+ // This field is from variant [ListDatasetsResponseDataSourceRows].
+ Rows []map[string]ListDatasetsResponseDataSourceRowsRowUnion `json:"rows"`
+ JSON struct {
+ Type respjson.Field
+ Uri respjson.Field
+ Rows respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyListDatasetsResponseDataSource is implemented by each variant of
+// [ListDatasetsResponseDataSourceUnion] to add type safety for the return type of
+// [ListDatasetsResponseDataSourceUnion.AsAny]
+type anyListDatasetsResponseDataSource interface {
+ implListDatasetsResponseDataSourceUnion()
+}
+
+func (ListDatasetsResponseDataSourceUri) implListDatasetsResponseDataSourceUnion() {}
+func (ListDatasetsResponseDataSourceRows) implListDatasetsResponseDataSourceUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ListDatasetsResponseDataSourceUnion.AsAny().(type) {
+// case llamastackclient.ListDatasetsResponseDataSourceUri:
+// case llamastackclient.ListDatasetsResponseDataSourceRows:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ListDatasetsResponseDataSourceUnion) AsAny() anyListDatasetsResponseDataSource {
+ switch u.Type {
+ case "uri":
+ return u.AsUri()
+ case "rows":
+ return u.AsRows()
+ }
+ return nil
+}
+
+func (u ListDatasetsResponseDataSourceUnion) AsUri() (v ListDatasetsResponseDataSourceUri) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataSourceUnion) AsRows() (v ListDatasetsResponseDataSourceRows) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ListDatasetsResponseDataSourceUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ListDatasetsResponseDataSourceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset that can be obtained from a URI.
+type ListDatasetsResponseDataSourceUri struct {
+ Type constant.Uri `json:"type,required"`
+ // The dataset can be obtained from a URI. E.g. -
+ // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
+ // "data:csv;base64,{base64_content}"
+ Uri string `json:"uri,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Uri respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ListDatasetsResponseDataSourceUri) RawJSON() string { return r.JSON.raw }
+func (r *ListDatasetsResponseDataSourceUri) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset stored in rows.
+type ListDatasetsResponseDataSourceRows struct {
+ // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
+ // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
+ // ]
+ Rows []map[string]ListDatasetsResponseDataSourceRowsRowUnion `json:"rows,required"`
+ Type constant.Rows `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Rows respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r ListDatasetsResponseDataSourceRows) RawJSON() string { return r.JSON.raw }
+func (r *ListDatasetsResponseDataSourceRows) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// ListDatasetsResponseDataSourceRowsRowUnion contains all possible properties and
+// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type ListDatasetsResponseDataSourceRowsRowUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u ListDatasetsResponseDataSourceRowsRowUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataSourceRowsRowUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataSourceRowsRowUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u ListDatasetsResponseDataSourceRowsRowUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u ListDatasetsResponseDataSourceRowsRowUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *ListDatasetsResponseDataSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Dataset resource for storing and accessing training or evaluation data.
+type DatasetGetResponse struct {
+ Identifier string `json:"identifier,required"`
+ // Additional metadata for the dataset
+ Metadata map[string]DatasetGetResponseMetadataUnion `json:"metadata,required"`
+ ProviderID string `json:"provider_id,required"`
+ // Purpose of the dataset indicating its intended use
+ //
+ // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
+ Purpose DatasetGetResponsePurpose `json:"purpose,required"`
+ // Data source configuration for the dataset
+ Source DatasetGetResponseSourceUnion `json:"source,required"`
+ // Type of resource, always 'dataset' for datasets
+ Type constant.Dataset `json:"type,required"`
+ ProviderResourceID string `json:"provider_resource_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Identifier respjson.Field
+ Metadata respjson.Field
+ ProviderID respjson.Field
+ Purpose respjson.Field
+ Source respjson.Field
+ Type respjson.Field
+ ProviderResourceID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetGetResponse) RawJSON() string { return r.JSON.raw }
+func (r *DatasetGetResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// DatasetGetResponseMetadataUnion contains all possible properties and values from
+// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type DatasetGetResponseMetadataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u DatasetGetResponseMetadataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseMetadataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseMetadataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseMetadataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetGetResponseMetadataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetGetResponseMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Purpose of the dataset indicating its intended use
+type DatasetGetResponsePurpose string
+
+const (
+ DatasetGetResponsePurposePostTrainingMessages DatasetGetResponsePurpose = "post-training/messages"
+ DatasetGetResponsePurposeEvalQuestionAnswer DatasetGetResponsePurpose = "eval/question-answer"
+ DatasetGetResponsePurposeEvalMessagesAnswer DatasetGetResponsePurpose = "eval/messages-answer"
+)
+
+// DatasetGetResponseSourceUnion contains all possible properties and values from
+// [DatasetGetResponseSourceUri], [DatasetGetResponseSourceRows].
+//
+// Use the [DatasetGetResponseSourceUnion.AsAny] method to switch on the variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type DatasetGetResponseSourceUnion struct {
+ // Any of "uri", "rows".
+ Type string `json:"type"`
+ // This field is from variant [DatasetGetResponseSourceUri].
+ Uri string `json:"uri"`
+ // This field is from variant [DatasetGetResponseSourceRows].
+ Rows []map[string]DatasetGetResponseSourceRowsRowUnion `json:"rows"`
+ JSON struct {
+ Type respjson.Field
+ Uri respjson.Field
+ Rows respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyDatasetGetResponseSource is implemented by each variant of
+// [DatasetGetResponseSourceUnion] to add type safety for the return type of
+// [DatasetGetResponseSourceUnion.AsAny]
+type anyDatasetGetResponseSource interface {
+ implDatasetGetResponseSourceUnion()
+}
+
+func (DatasetGetResponseSourceUri) implDatasetGetResponseSourceUnion() {}
+func (DatasetGetResponseSourceRows) implDatasetGetResponseSourceUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := DatasetGetResponseSourceUnion.AsAny().(type) {
+// case llamastackclient.DatasetGetResponseSourceUri:
+// case llamastackclient.DatasetGetResponseSourceRows:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u DatasetGetResponseSourceUnion) AsAny() anyDatasetGetResponseSource {
+ switch u.Type {
+ case "uri":
+ return u.AsUri()
+ case "rows":
+ return u.AsRows()
+ }
+ return nil
+}
+
+func (u DatasetGetResponseSourceUnion) AsUri() (v DatasetGetResponseSourceUri) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseSourceUnion) AsRows() (v DatasetGetResponseSourceRows) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetGetResponseSourceUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetGetResponseSourceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset that can be obtained from a URI.
+type DatasetGetResponseSourceUri struct {
+ Type constant.Uri `json:"type,required"`
+ // The dataset can be obtained from a URI. E.g. -
+ // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
+ // "data:csv;base64,{base64_content}"
+ Uri string `json:"uri,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Uri respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetGetResponseSourceUri) RawJSON() string { return r.JSON.raw }
+func (r *DatasetGetResponseSourceUri) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset stored in rows.
+type DatasetGetResponseSourceRows struct {
+ // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
+ // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
+ // ]
+ Rows []map[string]DatasetGetResponseSourceRowsRowUnion `json:"rows,required"`
+ Type constant.Rows `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Rows respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetGetResponseSourceRows) RawJSON() string { return r.JSON.raw }
+func (r *DatasetGetResponseSourceRows) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// DatasetGetResponseSourceRowsRowUnion contains all possible properties and values
+// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type DatasetGetResponseSourceRowsRowUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u DatasetGetResponseSourceRowsRowUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseSourceRowsRowUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseSourceRowsRowUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetGetResponseSourceRowsRowUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetGetResponseSourceRowsRowUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetGetResponseSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A generic paginated response that follows a simple format.
+type DatasetIterrowsResponse struct {
+ // The list of items for the current page
+ Data []map[string]DatasetIterrowsResponseDataUnion `json:"data,required"`
+ // Whether there are more items available after this set
+ HasMore bool `json:"has_more,required"`
+ // The URL for accessing this list
+ URL string `json:"url"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ HasMore respjson.Field
+ URL respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetIterrowsResponse) RawJSON() string { return r.JSON.raw }
+func (r *DatasetIterrowsResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// DatasetIterrowsResponseDataUnion contains all possible properties and values
+// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type DatasetIterrowsResponseDataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u DatasetIterrowsResponseDataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetIterrowsResponseDataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetIterrowsResponseDataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetIterrowsResponseDataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetIterrowsResponseDataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetIterrowsResponseDataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Dataset resource for storing and accessing training or evaluation data.
+type DatasetRegisterResponse struct {
+ Identifier string `json:"identifier,required"`
+ // Additional metadata for the dataset
+ Metadata map[string]DatasetRegisterResponseMetadataUnion `json:"metadata,required"`
+ ProviderID string `json:"provider_id,required"`
+ // Purpose of the dataset indicating its intended use
+ //
+ // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
+ Purpose DatasetRegisterResponsePurpose `json:"purpose,required"`
+ // Data source configuration for the dataset
+ Source DatasetRegisterResponseSourceUnion `json:"source,required"`
+ // Type of resource, always 'dataset' for datasets
+ Type constant.Dataset `json:"type,required"`
+ ProviderResourceID string `json:"provider_resource_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Identifier respjson.Field
+ Metadata respjson.Field
+ ProviderID respjson.Field
+ Purpose respjson.Field
+ Source respjson.Field
+ Type respjson.Field
+ ProviderResourceID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetRegisterResponse) RawJSON() string { return r.JSON.raw }
+func (r *DatasetRegisterResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// DatasetRegisterResponseMetadataUnion contains all possible properties and values
+// from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type DatasetRegisterResponseMetadataUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u DatasetRegisterResponseMetadataUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseMetadataUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseMetadataUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseMetadataUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetRegisterResponseMetadataUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetRegisterResponseMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Purpose of the dataset indicating its intended use
+type DatasetRegisterResponsePurpose string
+
+const (
+ DatasetRegisterResponsePurposePostTrainingMessages DatasetRegisterResponsePurpose = "post-training/messages"
+ DatasetRegisterResponsePurposeEvalQuestionAnswer DatasetRegisterResponsePurpose = "eval/question-answer"
+ DatasetRegisterResponsePurposeEvalMessagesAnswer DatasetRegisterResponsePurpose = "eval/messages-answer"
+)
+
+// DatasetRegisterResponseSourceUnion contains all possible properties and values
+// from [DatasetRegisterResponseSourceUri], [DatasetRegisterResponseSourceRows].
+//
+// Use the [DatasetRegisterResponseSourceUnion.AsAny] method to switch on the
+// variant.
+//
+// Use the methods beginning with 'As' to cast the union to one of its variants.
+type DatasetRegisterResponseSourceUnion struct {
+ // Any of "uri", "rows".
+ Type string `json:"type"`
+ // This field is from variant [DatasetRegisterResponseSourceUri].
+ Uri string `json:"uri"`
+ // This field is from variant [DatasetRegisterResponseSourceRows].
+ Rows []map[string]DatasetRegisterResponseSourceRowsRowUnion `json:"rows"`
+ JSON struct {
+ Type respjson.Field
+ Uri respjson.Field
+ Rows respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// anyDatasetRegisterResponseSource is implemented by each variant of
+// [DatasetRegisterResponseSourceUnion] to add type safety for the return type of
+// [DatasetRegisterResponseSourceUnion.AsAny]
+type anyDatasetRegisterResponseSource interface {
+ implDatasetRegisterResponseSourceUnion()
+}
+
+func (DatasetRegisterResponseSourceUri) implDatasetRegisterResponseSourceUnion() {}
+func (DatasetRegisterResponseSourceRows) implDatasetRegisterResponseSourceUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := DatasetRegisterResponseSourceUnion.AsAny().(type) {
+// case llamastackclient.DatasetRegisterResponseSourceUri:
+// case llamastackclient.DatasetRegisterResponseSourceRows:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u DatasetRegisterResponseSourceUnion) AsAny() anyDatasetRegisterResponseSource {
+ switch u.Type {
+ case "uri":
+ return u.AsUri()
+ case "rows":
+ return u.AsRows()
+ }
+ return nil
+}
+
+func (u DatasetRegisterResponseSourceUnion) AsUri() (v DatasetRegisterResponseSourceUri) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseSourceUnion) AsRows() (v DatasetRegisterResponseSourceRows) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetRegisterResponseSourceUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetRegisterResponseSourceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset that can be obtained from a URI.
+type DatasetRegisterResponseSourceUri struct {
+ Type constant.Uri `json:"type,required"`
+ // The dataset can be obtained from a URI. E.g. -
+ // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
+ // "data:csv;base64,{base64_content}"
+ Uri string `json:"uri,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Type respjson.Field
+ Uri respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetRegisterResponseSourceUri) RawJSON() string { return r.JSON.raw }
+func (r *DatasetRegisterResponseSourceUri) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset stored in rows.
+type DatasetRegisterResponseSourceRows struct {
+ // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
+ // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
+ // ]
+ Rows []map[string]DatasetRegisterResponseSourceRowsRowUnion `json:"rows,required"`
+ Type constant.Rows `json:"type,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Rows respjson.Field
+ Type respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r DatasetRegisterResponseSourceRows) RawJSON() string { return r.JSON.raw }
+func (r *DatasetRegisterResponseSourceRows) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// DatasetRegisterResponseSourceRowsRowUnion contains all possible properties and
+// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type DatasetRegisterResponseSourceRowsRowUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u DatasetRegisterResponseSourceRowsRowUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseSourceRowsRowUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseSourceRowsRowUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u DatasetRegisterResponseSourceRowsRowUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u DatasetRegisterResponseSourceRowsRowUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *DatasetRegisterResponseSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type DatasetAppendrowsParams struct {
+ // The rows to append to the dataset.
+ Rows []map[string]DatasetAppendrowsParamsRowUnion `json:"rows,omitzero,required"`
+ paramObj
+}
+
+func (r DatasetAppendrowsParams) MarshalJSON() (data []byte, err error) {
+ type shadow DatasetAppendrowsParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *DatasetAppendrowsParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type DatasetAppendrowsParamsRowUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u DatasetAppendrowsParamsRowUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *DatasetAppendrowsParamsRowUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *DatasetAppendrowsParamsRowUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
+type DatasetIterrowsParams struct {
+ // The number of rows to get.
+ Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
+ // Index into dataset for the first row to get. Get all rows if None.
+ StartIndex param.Opt[int64] `query:"start_index,omitzero" json:"-"`
+ paramObj
+}
+
+// URLQuery serializes [DatasetIterrowsParams]'s query parameters as `url.Values`.
+func (r DatasetIterrowsParams) URLQuery() (v url.Values, err error) {
+ return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
+ ArrayFormat: apiquery.ArrayQueryFormatComma,
+ NestedFormat: apiquery.NestedQueryFormatBrackets,
+ })
+}
+
+type DatasetRegisterParams struct {
+ // The purpose of the dataset. One of: - "post-training/messages": The dataset
+ // contains a messages column with list of messages for post-training. {
+ // "messages": [ {"role": "user", "content": "Hello, world!"}, {"role":
+ // "assistant", "content": "Hello, world!"}, ] } - "eval/question-answer": The
+ // dataset contains a question column and an answer column for evaluation. {
+ // "question": "What is the capital of France?", "answer": "Paris" } -
+ // "eval/messages-answer": The dataset contains a messages column with list of
+ // messages and an answer column for evaluation. { "messages": [ {"role": "user",
+ // "content": "Hello, my name is John Doe."}, {"role": "assistant", "content":
+ // "Hello, John Doe. How can I help you today?"}, {"role": "user", "content":
+ // "What's my name?"}, ], "answer": "John Doe" }
+ //
+ // Any of "post-training/messages", "eval/question-answer", "eval/messages-answer".
+ Purpose DatasetRegisterParamsPurpose `json:"purpose,omitzero,required"`
+ // The data source of the dataset. Ensure that the data source schema is compatible
+ // with the purpose of the dataset. Examples: - { "type": "uri", "uri":
+ // "https://mywebsite.com/mydata.jsonl" } - { "type": "uri", "uri":
+ // "lsfs://mydata.jsonl" } - { "type": "uri", "uri":
+ // "data:csv;base64,{base64_content}" } - { "type": "uri", "uri":
+ // "huggingface://llamastack/simpleqa?split=train" } - { "type": "rows", "rows": [
+ // { "messages": [ {"role": "user", "content": "Hello, world!"}, {"role":
+ // "assistant", "content": "Hello, world!"}, ] } ] }
+ Source DatasetRegisterParamsSourceUnion `json:"source,omitzero,required"`
+ // The ID of the dataset. If not provided, an ID will be generated.
+ DatasetID param.Opt[string] `json:"dataset_id,omitzero"`
+ // The metadata for the dataset. - E.g. {"description": "My dataset"}.
+ Metadata map[string]DatasetRegisterParamsMetadataUnion `json:"metadata,omitzero"`
+ paramObj
+}
+
+func (r DatasetRegisterParams) MarshalJSON() (data []byte, err error) {
+ type shadow DatasetRegisterParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *DatasetRegisterParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// The purpose of the dataset. One of: - "post-training/messages": The dataset
+// contains a messages column with list of messages for post-training. {
+// "messages": [ {"role": "user", "content": "Hello, world!"}, {"role":
+// "assistant", "content": "Hello, world!"}, ] } - "eval/question-answer": The
+// dataset contains a question column and an answer column for evaluation. {
+// "question": "What is the capital of France?", "answer": "Paris" } -
+// "eval/messages-answer": The dataset contains a messages column with list of
+// messages and an answer column for evaluation. { "messages": [ {"role": "user",
+// "content": "Hello, my name is John Doe."}, {"role": "assistant", "content":
+// "Hello, John Doe. How can I help you today?"}, {"role": "user", "content":
+// "What's my name?"}, ], "answer": "John Doe" }
+type DatasetRegisterParamsPurpose string
+
+const (
+ DatasetRegisterParamsPurposePostTrainingMessages DatasetRegisterParamsPurpose = "post-training/messages"
+ DatasetRegisterParamsPurposeEvalQuestionAnswer DatasetRegisterParamsPurpose = "eval/question-answer"
+ DatasetRegisterParamsPurposeEvalMessagesAnswer DatasetRegisterParamsPurpose = "eval/messages-answer"
+)
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type DatasetRegisterParamsSourceUnion struct {
+ OfUri *DatasetRegisterParamsSourceUri `json:",omitzero,inline"`
+ OfRows *DatasetRegisterParamsSourceRows `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u DatasetRegisterParamsSourceUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfUri, u.OfRows)
+}
+func (u *DatasetRegisterParamsSourceUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *DatasetRegisterParamsSourceUnion) asAny() any {
+ if !param.IsOmitted(u.OfUri) {
+ return u.OfUri
+ } else if !param.IsOmitted(u.OfRows) {
+ return u.OfRows
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u DatasetRegisterParamsSourceUnion) GetUri() *string {
+ if vt := u.OfUri; vt != nil {
+ return &vt.Uri
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u DatasetRegisterParamsSourceUnion) GetRows() []map[string]DatasetRegisterParamsSourceRowsRowUnion {
+ if vt := u.OfRows; vt != nil {
+ return vt.Rows
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u DatasetRegisterParamsSourceUnion) GetType() *string {
+ if vt := u.OfUri; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfRows; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+func init() {
+ apijson.RegisterUnion[DatasetRegisterParamsSourceUnion](
+ "type",
+ apijson.Discriminator[DatasetRegisterParamsSourceUri]("uri"),
+ apijson.Discriminator[DatasetRegisterParamsSourceRows]("rows"),
+ )
+}
+
+// A dataset that can be obtained from a URI.
+//
+// The properties Type, Uri are required.
+type DatasetRegisterParamsSourceUri struct {
+ // The dataset can be obtained from a URI. E.g. -
+ // "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" -
+ // "data:csv;base64,{base64_content}"
+ Uri string `json:"uri,required"`
+ // This field can be elided, and will marshal its zero value as "uri".
+ Type constant.Uri `json:"type,required"`
+ paramObj
+}
+
+func (r DatasetRegisterParamsSourceUri) MarshalJSON() (data []byte, err error) {
+ type shadow DatasetRegisterParamsSourceUri
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *DatasetRegisterParamsSourceUri) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A dataset stored in rows.
+//
+// The properties Rows, Type are required.
+type DatasetRegisterParamsSourceRows struct {
+ // The dataset is stored in rows. E.g. - [ {"messages": [{"role": "user",
+ // "content": "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}]}
+ // ]
+ Rows []map[string]DatasetRegisterParamsSourceRowsRowUnion `json:"rows,omitzero,required"`
+ // This field can be elided, and will marshal its zero value as "rows".
+ Type constant.Rows `json:"type,required"`
+ paramObj
+}
+
+func (r DatasetRegisterParamsSourceRows) MarshalJSON() (data []byte, err error) {
+ type shadow DatasetRegisterParamsSourceRows
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *DatasetRegisterParamsSourceRows) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type DatasetRegisterParamsSourceRowsRowUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u DatasetRegisterParamsSourceRowsRowUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *DatasetRegisterParamsSourceRowsRowUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *DatasetRegisterParamsSourceRowsRowUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type DatasetRegisterParamsMetadataUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u DatasetRegisterParamsMetadataUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *DatasetRegisterParamsMetadataUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *DatasetRegisterParamsMetadataUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
diff --git a/dataset_test.go b/dataset_test.go
new file mode 100644
index 0000000..dc5ab37
--- /dev/null
+++ b/dataset_test.go
@@ -0,0 +1,170 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+package llamastackclient_test
+
+import (
+ "context"
+ "errors"
+ "os"
+ "testing"
+
+ "github.com/llamastack/llama-stack-client-go"
+ "github.com/llamastack/llama-stack-client-go/internal/testutil"
+ "github.com/llamastack/llama-stack-client-go/option"
+)
+
+func TestDatasetGet(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Datasets.Get(context.TODO(), "dataset_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestDatasetList(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Datasets.List(context.TODO())
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestDatasetAppendrows(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ err := client.Datasets.Appendrows(
+ context.TODO(),
+ "dataset_id",
+ llamastackclient.DatasetAppendrowsParams{
+ Rows: []map[string]llamastackclient.DatasetAppendrowsParamsRowUnion{{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ }},
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestDatasetIterrowsWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Datasets.Iterrows(
+ context.TODO(),
+ "dataset_id",
+ llamastackclient.DatasetIterrowsParams{
+ Limit: llamastackclient.Int(0),
+ StartIndex: llamastackclient.Int(0),
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestDatasetRegisterWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Datasets.Register(context.TODO(), llamastackclient.DatasetRegisterParams{
+ Purpose: llamastackclient.DatasetRegisterParamsPurposePostTrainingMessages,
+ Source: llamastackclient.DatasetRegisterParamsSourceUnion{
+ OfUri: &llamastackclient.DatasetRegisterParamsSourceUri{
+ Uri: "uri",
+ },
+ },
+ DatasetID: llamastackclient.String("dataset_id"),
+ Metadata: map[string]llamastackclient.DatasetRegisterParamsMetadataUnion{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ },
+ })
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestDatasetUnregister(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ err := client.Datasets.Unregister(context.TODO(), "dataset_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/telemetry.go b/telemetry.go
index c81c037..23409da 100644
--- a/telemetry.go
+++ b/telemetry.go
@@ -4,6 +4,9 @@ package llamastackclient
import (
"context"
+ "encoding/json"
+ "errors"
+ "fmt"
"net/http"
"slices"
"time"
@@ -12,7 +15,7 @@ import (
"github.com/llamastack/llama-stack-client-go/internal/requestconfig"
"github.com/llamastack/llama-stack-client-go/option"
"github.com/llamastack/llama-stack-client-go/packages/param"
- "github.com/llamastack/llama-stack-client-go/shared/constant"
+ "github.com/llamastack/llama-stack-client-go/packages/respjson"
)
// TelemetryService contains methods and other services that help with interacting
@@ -34,496 +37,750 @@ func NewTelemetryService(opts ...option.RequestOption) (r TelemetryService) {
return
}
-// Log an event.
-func (r *TelemetryService) LogEvent(ctx context.Context, body TelemetryLogEventParams, opts ...option.RequestOption) (err error) {
+// Get a span by its ID.
+func (r *TelemetryService) GetSpan(ctx context.Context, spanID string, query TelemetryGetSpanParams, opts ...option.RequestOption) (res *TelemetryGetSpanResponse, err error) {
opts = slices.Concat(r.Options, opts)
- opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
- path := "v1/telemetry/events"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
- return
-}
-
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type EventUnionParam struct {
- OfUnstructuredLog *EventUnstructuredLogParam `json:",omitzero,inline"`
- OfMetric *EventMetricParam `json:",omitzero,inline"`
- OfStructuredLog *EventStructuredLogParam `json:",omitzero,inline"`
- paramUnion
-}
-
-func (u EventUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfUnstructuredLog, u.OfMetric, u.OfStructuredLog)
-}
-func (u *EventUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
-}
-
-func (u *EventUnionParam) asAny() any {
- if !param.IsOmitted(u.OfUnstructuredLog) {
- return u.OfUnstructuredLog
- } else if !param.IsOmitted(u.OfMetric) {
- return u.OfMetric
- } else if !param.IsOmitted(u.OfStructuredLog) {
- return u.OfStructuredLog
+ if query.TraceID == "" {
+ err = errors.New("missing required trace_id parameter")
+ return
}
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetMessage() *string {
- if vt := u.OfUnstructuredLog; vt != nil {
- return &vt.Message
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetSeverity() *string {
- if vt := u.OfUnstructuredLog; vt != nil {
- return &vt.Severity
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetMetric() *string {
- if vt := u.OfMetric; vt != nil {
- return &vt.Metric
- }
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetUnit() *string {
- if vt := u.OfMetric; vt != nil {
- return &vt.Unit
+ if spanID == "" {
+ err = errors.New("missing required span_id parameter")
+ return
}
- return nil
+ path := fmt.Sprintf("v1alpha/telemetry/traces/%s/spans/%s", query.TraceID, spanID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetValue() *float64 {
- if vt := u.OfMetric; vt != nil {
- return &vt.Value
+// Get a span tree by its ID.
+func (r *TelemetryService) GetSpanTree(ctx context.Context, spanID string, body TelemetryGetSpanTreeParams, opts ...option.RequestOption) (res *TelemetryGetSpanTreeResponse, err error) {
+ var env TelemetryGetSpanTreeResponseEnvelope
+ opts = slices.Concat(r.Options, opts)
+ if spanID == "" {
+ err = errors.New("missing required span_id parameter")
+ return
}
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetPayload() *EventStructuredLogPayloadUnionParam {
- if vt := u.OfStructuredLog; vt != nil {
- return &vt.Payload
+ path := fmt.Sprintf("v1alpha/telemetry/spans/%s/tree", spanID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
}
- return nil
+ res = &env.Data
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetSpanID() *string {
- if vt := u.OfUnstructuredLog; vt != nil {
- return (*string)(&vt.SpanID)
- } else if vt := u.OfMetric; vt != nil {
- return (*string)(&vt.SpanID)
- } else if vt := u.OfStructuredLog; vt != nil {
- return (*string)(&vt.SpanID)
+// Get a trace by its ID.
+func (r *TelemetryService) GetTrace(ctx context.Context, traceID string, opts ...option.RequestOption) (res *Trace, err error) {
+ opts = slices.Concat(r.Options, opts)
+ if traceID == "" {
+ err = errors.New("missing required trace_id parameter")
+ return
}
- return nil
+ path := fmt.Sprintf("v1alpha/telemetry/traces/%s", traceID)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetTraceID() *string {
- if vt := u.OfUnstructuredLog; vt != nil {
- return (*string)(&vt.TraceID)
- } else if vt := u.OfMetric; vt != nil {
- return (*string)(&vt.TraceID)
- } else if vt := u.OfStructuredLog; vt != nil {
- return (*string)(&vt.TraceID)
+// Query metrics.
+func (r *TelemetryService) QueryMetrics(ctx context.Context, metricName string, body TelemetryQueryMetricsParams, opts ...option.RequestOption) (res *[]TelemetryQueryMetricsResponse, err error) {
+ var env TelemetryQueryMetricsResponseEnvelope
+ opts = slices.Concat(r.Options, opts)
+ if metricName == "" {
+ err = errors.New("missing required metric_name parameter")
+ return
}
- return nil
-}
-
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventUnionParam) GetType() *string {
- if vt := u.OfUnstructuredLog; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfMetric; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfStructuredLog; vt != nil {
- return (*string)(&vt.Type)
+ path := fmt.Sprintf("v1alpha/telemetry/metrics/%s", metricName)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
}
- return nil
+ res = &env.Data
+ return
}
-// Returns a pointer to the underlying variant's Timestamp property, if present.
-func (u EventUnionParam) GetTimestamp() *time.Time {
- if vt := u.OfUnstructuredLog; vt != nil {
- return &vt.Timestamp
- } else if vt := u.OfMetric; vt != nil {
- return &vt.Timestamp
- } else if vt := u.OfStructuredLog; vt != nil {
- return &vt.Timestamp
+// Query spans.
+func (r *TelemetryService) QuerySpans(ctx context.Context, body TelemetryQuerySpansParams, opts ...option.RequestOption) (res *[]QuerySpansResponseData, err error) {
+ var env QuerySpansResponse
+ opts = slices.Concat(r.Options, opts)
+ path := "v1alpha/telemetry/spans"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
}
- return nil
+ res = &env.Data
+ return
}
-// Returns a subunion which exports methods to access subproperties
-//
-// Or use AsAny() to get the underlying value
-func (u EventUnionParam) GetAttributes() (res eventUnionParamAttributes) {
- if vt := u.OfUnstructuredLog; vt != nil {
- res.any = &vt.Attributes
- } else if vt := u.OfMetric; vt != nil {
- res.any = &vt.Attributes
- } else if vt := u.OfStructuredLog; vt != nil {
- res.any = &vt.Attributes
+// Query traces.
+func (r *TelemetryService) QueryTraces(ctx context.Context, body TelemetryQueryTracesParams, opts ...option.RequestOption) (res *[]Trace, err error) {
+ var env TelemetryQueryTracesResponseEnvelope
+ opts = slices.Concat(r.Options, opts)
+ path := "v1alpha/telemetry/traces"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &env, opts...)
+ if err != nil {
+ return
}
+ res = &env.Data
return
}
-// Can have the runtime types
-// [*map[string]EventUnstructuredLogAttributeUnionParam],
-// [*map[string]EventMetricAttributeUnionParam],
-// [\*map[string]EventStructuredLogAttributeUnionParam]
-type eventUnionParamAttributes struct{ any }
-
-// Use the following switch statement to get the type of the union:
-//
-// switch u.AsAny().(type) {
-// case *map[string]llamastackclient.EventUnstructuredLogAttributeUnionParam:
-// case *map[string]llamastackclient.EventMetricAttributeUnionParam:
-// case *map[string]llamastackclient.EventStructuredLogAttributeUnionParam:
-// default:
-// fmt.Errorf("not present")
-// }
-func (u eventUnionParamAttributes) AsAny() any { return u.any }
-
-func init() {
- apijson.RegisterUnion[EventUnionParam](
- "type",
- apijson.Discriminator[EventUnstructuredLogParam]("unstructured_log"),
- apijson.Discriminator[EventMetricParam]("metric"),
- apijson.Discriminator[EventStructuredLogParam]("structured_log"),
- )
+// Save spans to a dataset.
+func (r *TelemetryService) SaveSpansToDataset(ctx context.Context, body TelemetrySaveSpansToDatasetParams, opts ...option.RequestOption) (err error) {
+ opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
+ path := "v1alpha/telemetry/spans/export"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
+ return
}
-// An unstructured log event containing a simple text message.
+// A condition for filtering query results.
//
-// The properties Message, Severity, SpanID, Timestamp, TraceID, Type are required.
-type EventUnstructuredLogParam struct {
- // The log message text
- Message string `json:"message,required"`
- // The severity level of the log message
- //
- // Any of "verbose", "debug", "info", "warn", "error", "critical".
- Severity string `json:"severity,omitzero,required"`
- // Unique identifier for the span this event belongs to
- SpanID string `json:"span_id,required"`
- // Timestamp when the event occurred
- Timestamp time.Time `json:"timestamp,required" format:"date-time"`
- // Unique identifier for the trace this event belongs to
- TraceID string `json:"trace_id,required"`
- // (Optional) Key-value pairs containing additional metadata about the event
- Attributes map[string]EventUnstructuredLogAttributeUnionParam `json:"attributes,omitzero"`
- // Event type identifier set to UNSTRUCTURED_LOG
+// The properties Key, Op, Value are required.
+type QueryConditionParam struct {
+ // The value to compare against
+ Value QueryConditionValueUnionParam `json:"value,omitzero,required"`
+ // The attribute key to filter on
+ Key string `json:"key,required"`
+ // The comparison operator to apply
//
- // This field can be elided, and will marshal its zero value as "unstructured_log".
- Type constant.UnstructuredLog `json:"type,required"`
+ // Any of "eq", "ne", "gt", "lt".
+ Op QueryConditionOp `json:"op,omitzero,required"`
paramObj
}
-func (r EventUnstructuredLogParam) MarshalJSON() (data []byte, err error) {
- type shadow EventUnstructuredLogParam
+func (r QueryConditionParam) MarshalJSON() (data []byte, err error) {
+ type shadow QueryConditionParam
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EventUnstructuredLogParam) UnmarshalJSON(data []byte) error {
+func (r *QueryConditionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-func init() {
- apijson.RegisterFieldValidator[EventUnstructuredLogParam](
- "severity", "verbose", "debug", "info", "warn", "error", "critical",
- )
-}
+// The comparison operator to apply
+type QueryConditionOp string
+
+const (
+ QueryConditionOpEq QueryConditionOp = "eq"
+ QueryConditionOpNe QueryConditionOp = "ne"
+ QueryConditionOpGt QueryConditionOp = "gt"
+ QueryConditionOpLt QueryConditionOp = "lt"
+)
// Only one field can be non-zero.
//
// Use [param.IsOmitted] to confirm if a field is set.
-type EventUnstructuredLogAttributeUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfBool param.Opt[bool] `json:",omitzero,inline"`
+type QueryConditionValueUnionParam struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
paramUnion
}
-func (u EventUnstructuredLogAttributeUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
+func (u QueryConditionValueUnionParam) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
-func (u *EventUnstructuredLogAttributeUnionParam) UnmarshalJSON(data []byte) error {
+func (u *QueryConditionValueUnionParam) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}
-func (u *EventUnstructuredLogAttributeUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
+func (u *QueryConditionValueUnionParam) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
} else if !param.IsOmitted(u.OfFloat) {
return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
}
return nil
}
-// A metric event containing a measured value.
-//
-// The properties Metric, SpanID, Timestamp, TraceID, Type, Unit, Value are
-// required.
-type EventMetricParam struct {
- // The name of the metric being measured
- Metric string `json:"metric,required"`
- // Unique identifier for the span this event belongs to
- SpanID string `json:"span_id,required"`
- // Timestamp when the event occurred
- Timestamp time.Time `json:"timestamp,required" format:"date-time"`
- // Unique identifier for the trace this event belongs to
- TraceID string `json:"trace_id,required"`
- // The unit of measurement for the metric value
- Unit string `json:"unit,required"`
- // The numeric value of the metric measurement
- Value float64 `json:"value,required"`
- // (Optional) Key-value pairs containing additional metadata about the event
- Attributes map[string]EventMetricAttributeUnionParam `json:"attributes,omitzero"`
- // Event type identifier set to METRIC
- //
- // This field can be elided, and will marshal its zero value as "metric".
- Type constant.Metric `json:"type,required"`
- paramObj
+// Response containing a list of spans.
+type QuerySpansResponse struct {
+ // List of spans matching the query criteria
+ Data []QuerySpansResponseData `json:"data,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:"-"`
}
-func (r EventMetricParam) MarshalJSON() (data []byte, err error) {
- type shadow EventMetricParam
- return param.MarshalObject(r, (*shadow)(&r))
+// Returns the unmodified JSON received from the API
+func (r QuerySpansResponse) RawJSON() string { return r.JSON.raw }
+func (r *QuerySpansResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func (r *EventMetricParam) UnmarshalJSON(data []byte) error {
+
+// A span representing a single operation within a trace.
+type QuerySpansResponseData struct {
+ // Human-readable name describing the operation this span represents
+ Name string `json:"name,required"`
+ // Unique identifier for the span
+ SpanID string `json:"span_id,required"`
+ // Timestamp when the operation began
+ StartTime time.Time `json:"start_time,required" format:"date-time"`
+ // Unique identifier for the trace this span belongs to
+ TraceID string `json:"trace_id,required"`
+ // (Optional) Key-value pairs containing additional metadata about the span
+ Attributes map[string]QuerySpansResponseDataAttributeUnion `json:"attributes"`
+ // (Optional) Timestamp when the operation finished, if completed
+ EndTime time.Time `json:"end_time" format:"date-time"`
+ // (Optional) Unique identifier for the parent span, if this is a child span
+ ParentSpanID string `json:"parent_span_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ SpanID respjson.Field
+ StartTime respjson.Field
+ TraceID respjson.Field
+ Attributes respjson.Field
+ EndTime respjson.Field
+ ParentSpanID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r QuerySpansResponseData) RawJSON() string { return r.JSON.raw }
+func (r *QuerySpansResponseData) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
+// QuerySpansResponseDataAttributeUnion contains all possible properties and values
+// from [bool], [float64], [string], [[]any].
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type EventMetricAttributeUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- paramUnion
+// 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: OfBool OfFloat OfString OfAnyArray]
+type QuerySpansResponseDataAttributeUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u QuerySpansResponseDataAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u EventMetricAttributeUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
+func (u QuerySpansResponseDataAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u *EventMetricAttributeUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+
+func (u QuerySpansResponseDataAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u *EventMetricAttributeUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- }
- return nil
+func (u QuerySpansResponseDataAttributeUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// A structured log event containing typed payload data.
-//
-// The properties Payload, SpanID, Timestamp, TraceID, Type are required.
-type EventStructuredLogParam struct {
- // The structured payload data for the log event
- Payload EventStructuredLogPayloadUnionParam `json:"payload,omitzero,required"`
- // Unique identifier for the span this event belongs to
+// Returns the unmodified JSON received from the API
+func (u QuerySpansResponseDataAttributeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *QuerySpansResponseDataAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A span that includes status information.
+type SpanWithStatus struct {
+ // Human-readable name describing the operation this span represents
+ Name string `json:"name,required"`
+ // Unique identifier for the span
SpanID string `json:"span_id,required"`
- // Timestamp when the event occurred
- Timestamp time.Time `json:"timestamp,required" format:"date-time"`
- // Unique identifier for the trace this event belongs to
+ // Timestamp when the operation began
+ StartTime time.Time `json:"start_time,required" format:"date-time"`
+ // Unique identifier for the trace this span belongs to
TraceID string `json:"trace_id,required"`
- // (Optional) Key-value pairs containing additional metadata about the event
- Attributes map[string]EventStructuredLogAttributeUnionParam `json:"attributes,omitzero"`
- // Event type identifier set to STRUCTURED_LOG
+ // (Optional) Key-value pairs containing additional metadata about the span
+ Attributes map[string]SpanWithStatusAttributeUnion `json:"attributes"`
+ // (Optional) Timestamp when the operation finished, if completed
+ EndTime time.Time `json:"end_time" format:"date-time"`
+ // (Optional) Unique identifier for the parent span, if this is a child span
+ ParentSpanID string `json:"parent_span_id"`
+ // (Optional) The current status of the span
//
- // This field can be elided, and will marshal its zero value as "structured_log".
- Type constant.StructuredLog `json:"type,required"`
- paramObj
+ // Any of "ok", "error".
+ Status SpanWithStatusStatus `json:"status"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ SpanID respjson.Field
+ StartTime respjson.Field
+ TraceID respjson.Field
+ Attributes respjson.Field
+ EndTime respjson.Field
+ ParentSpanID respjson.Field
+ Status respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r SpanWithStatus) RawJSON() string { return r.JSON.raw }
+func (r *SpanWithStatus) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func (r EventStructuredLogParam) MarshalJSON() (data []byte, err error) {
- type shadow EventStructuredLogParam
- return param.MarshalObject(r, (*shadow)(&r))
+// SpanWithStatusAttributeUnion contains all possible properties and values from
+// [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
+type SpanWithStatusAttributeUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u SpanWithStatusAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (r *EventStructuredLogParam) UnmarshalJSON(data []byte) error {
+
+func (u SpanWithStatusAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u SpanWithStatusAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+func (u SpanWithStatusAttributeUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
+}
+
+// Returns the unmodified JSON received from the API
+func (u SpanWithStatusAttributeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *SpanWithStatusAttributeUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Only one field can be non-zero.
+// (Optional) The current status of the span
+type SpanWithStatusStatus string
+
+const (
+ SpanWithStatusStatusOk SpanWithStatusStatus = "ok"
+ SpanWithStatusStatusError SpanWithStatusStatus = "error"
+)
+
+// A trace representing the complete execution path of a request across multiple
+// operations.
+type Trace struct {
+ // Unique identifier for the root span that started this trace
+ RootSpanID string `json:"root_span_id,required"`
+ // Timestamp when the trace began
+ StartTime time.Time `json:"start_time,required" format:"date-time"`
+ // Unique identifier for the trace
+ TraceID string `json:"trace_id,required"`
+ // (Optional) Timestamp when the trace finished, if completed
+ EndTime time.Time `json:"end_time" format:"date-time"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ RootSpanID respjson.Field
+ StartTime respjson.Field
+ TraceID respjson.Field
+ EndTime respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r Trace) RawJSON() string { return r.JSON.raw }
+func (r *Trace) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// A span representing a single operation within a trace.
+type TelemetryGetSpanResponse struct {
+ // Human-readable name describing the operation this span represents
+ Name string `json:"name,required"`
+ // Unique identifier for the span
+ SpanID string `json:"span_id,required"`
+ // Timestamp when the operation began
+ StartTime time.Time `json:"start_time,required" format:"date-time"`
+ // Unique identifier for the trace this span belongs to
+ TraceID string `json:"trace_id,required"`
+ // (Optional) Key-value pairs containing additional metadata about the span
+ Attributes map[string]TelemetryGetSpanResponseAttributeUnion `json:"attributes"`
+ // (Optional) Timestamp when the operation finished, if completed
+ EndTime time.Time `json:"end_time" format:"date-time"`
+ // (Optional) Unique identifier for the parent span, if this is a child span
+ ParentSpanID string `json:"parent_span_id"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ SpanID respjson.Field
+ StartTime respjson.Field
+ TraceID respjson.Field
+ Attributes respjson.Field
+ EndTime respjson.Field
+ ParentSpanID respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryGetSpanResponse) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryGetSpanResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// TelemetryGetSpanResponseAttributeUnion contains all possible properties and
+// values from [bool], [float64], [string], [[]any].
//
-// Use [param.IsOmitted] to confirm if a field is set.
-type EventStructuredLogPayloadUnionParam struct {
- OfSpanStart *EventStructuredLogPayloadSpanStartParam `json:",omitzero,inline"`
- OfSpanEnd *EventStructuredLogPayloadSpanEndParam `json:",omitzero,inline"`
- paramUnion
+// 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: OfBool OfFloat OfString OfAnyArray]
+type TelemetryGetSpanResponseAttributeUnion struct {
+ // This field will be present if the value is a [bool] instead of an object.
+ OfBool bool `json:",inline"`
+ // This field will be present if the value is a [float64] instead of an object.
+ OfFloat float64 `json:",inline"`
+ // This field will be present if the value is a [string] instead of an object.
+ OfString string `json:",inline"`
+ // This field will be present if the value is a [[]any] instead of an object.
+ OfAnyArray []any `json:",inline"`
+ JSON struct {
+ OfBool respjson.Field
+ OfFloat respjson.Field
+ OfString respjson.Field
+ OfAnyArray respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+func (u TelemetryGetSpanResponseAttributeUnion) AsBool() (v bool) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u EventStructuredLogPayloadUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfSpanStart, u.OfSpanEnd)
+func (u TelemetryGetSpanResponseAttributeUnion) AsFloat() (v float64) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u *EventStructuredLogPayloadUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+
+func (u TelemetryGetSpanResponseAttributeUnion) AsString() (v string) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-func (u *EventStructuredLogPayloadUnionParam) asAny() any {
- if !param.IsOmitted(u.OfSpanStart) {
- return u.OfSpanStart
- } else if !param.IsOmitted(u.OfSpanEnd) {
- return u.OfSpanEnd
- }
- return nil
+func (u TelemetryGetSpanResponseAttributeUnion) AsAnyArray() (v []any) {
+ apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
+ return
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventStructuredLogPayloadUnionParam) GetName() *string {
- if vt := u.OfSpanStart; vt != nil {
- return &vt.Name
- }
- return nil
+// Returns the unmodified JSON received from the API
+func (u TelemetryGetSpanResponseAttributeUnion) RawJSON() string { return u.JSON.raw }
+
+func (r *TelemetryGetSpanResponseAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventStructuredLogPayloadUnionParam) GetParentSpanID() *string {
- if vt := u.OfSpanStart; vt != nil && vt.ParentSpanID.Valid() {
- return &vt.ParentSpanID.Value
- }
- return nil
+type TelemetryGetSpanTreeResponse map[string]SpanWithStatus
+
+// A time series of metric data points.
+type TelemetryQueryMetricsResponse struct {
+ // List of labels associated with this metric series
+ Labels []TelemetryQueryMetricsResponseLabel `json:"labels,required"`
+ // The name of the metric
+ Metric string `json:"metric,required"`
+ // List of data points in chronological order
+ Values []TelemetryQueryMetricsResponseValue `json:"values,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Labels respjson.Field
+ Metric respjson.Field
+ Values respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponse) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventStructuredLogPayloadUnionParam) GetStatus() *string {
- if vt := u.OfSpanEnd; vt != nil {
- return &vt.Status
- }
- return nil
+// A label associated with a metric.
+type TelemetryQueryMetricsResponseLabel struct {
+ // The name of the label
+ Name string `json:"name,required"`
+ // The value of the label
+ Value string `json:"value,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Name respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponseLabel) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponseLabel) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-// Returns a pointer to the underlying variant's property, if present.
-func (u EventStructuredLogPayloadUnionParam) GetType() *string {
- if vt := u.OfSpanStart; vt != nil {
- return (*string)(&vt.Type)
- } else if vt := u.OfSpanEnd; vt != nil {
- return (*string)(&vt.Type)
- }
- return nil
+// A single data point in a metric time series.
+type TelemetryQueryMetricsResponseValue struct {
+ // Unix timestamp when the metric value was recorded
+ Timestamp int64 `json:"timestamp,required"`
+ Unit string `json:"unit,required"`
+ // The numeric value of the metric at this timestamp
+ Value float64 `json:"value,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Timestamp respjson.Field
+ Unit respjson.Field
+ Value respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponseValue) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponseValue) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func init() {
- apijson.RegisterUnion[EventStructuredLogPayloadUnionParam](
- "type",
- apijson.Discriminator[EventStructuredLogPayloadSpanStartParam]("span_start"),
- apijson.Discriminator[EventStructuredLogPayloadSpanEndParam]("span_end"),
- )
+type TelemetryGetSpanParams struct {
+ TraceID string `path:"trace_id,required" json:"-"`
+ paramObj
}
-// Payload for a span start event.
-//
-// The properties Name, Type are required.
-type EventStructuredLogPayloadSpanStartParam struct {
- // Human-readable name describing the operation this span represents
- Name string `json:"name,required"`
- // (Optional) Unique identifier for the parent span, if this is a child span
- ParentSpanID param.Opt[string] `json:"parent_span_id,omitzero"`
- // Payload type identifier set to SPAN_START
+type TelemetryGetSpanTreeParams struct {
+ // The maximum depth of the tree.
+ MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
+ // The attributes to return in the tree.
+ AttributesToReturn []string `json:"attributes_to_return,omitzero"`
+ paramObj
+}
+
+func (r TelemetryGetSpanTreeParams) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryGetSpanTreeParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *TelemetryGetSpanTreeParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Response containing a tree structure of spans.
+type TelemetryGetSpanTreeResponseEnvelope struct {
+ // Dictionary mapping span IDs to spans with status information
+ Data TelemetryGetSpanTreeResponse `json:"data,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 TelemetryGetSpanTreeResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryGetSpanTreeResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type TelemetryQueryMetricsParams struct {
+ // The type of query to perform.
//
- // This field can be elided, and will marshal its zero value as "span_start".
- Type constant.SpanStart `json:"type,required"`
+ // Any of "range", "instant".
+ QueryType TelemetryQueryMetricsParamsQueryType `json:"query_type,omitzero,required"`
+ // The start time of the metric to query.
+ StartTime int64 `json:"start_time,required"`
+ // The end time of the metric to query.
+ EndTime param.Opt[int64] `json:"end_time,omitzero"`
+ // The granularity of the metric to query.
+ Granularity param.Opt[string] `json:"granularity,omitzero"`
+ // The label matchers to apply to the metric.
+ LabelMatchers []TelemetryQueryMetricsParamsLabelMatcher `json:"label_matchers,omitzero"`
paramObj
}
-func (r EventStructuredLogPayloadSpanStartParam) MarshalJSON() (data []byte, err error) {
- type shadow EventStructuredLogPayloadSpanStartParam
+func (r TelemetryQueryMetricsParams) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryQueryMetricsParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EventStructuredLogPayloadSpanStartParam) UnmarshalJSON(data []byte) error {
+func (r *TelemetryQueryMetricsParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Payload for a span end event.
+// The type of query to perform.
+type TelemetryQueryMetricsParamsQueryType string
+
+const (
+ TelemetryQueryMetricsParamsQueryTypeRange TelemetryQueryMetricsParamsQueryType = "range"
+ TelemetryQueryMetricsParamsQueryTypeInstant TelemetryQueryMetricsParamsQueryType = "instant"
+)
+
+// A matcher for filtering metrics by label values.
//
-// The properties Status, Type are required.
-type EventStructuredLogPayloadSpanEndParam struct {
- // The final status of the span indicating success or failure
- //
- // Any of "ok", "error".
- Status string `json:"status,omitzero,required"`
- // Payload type identifier set to SPAN_END
+// The properties Name, Operator, Value are required.
+type TelemetryQueryMetricsParamsLabelMatcher struct {
+ // The name of the label to match
+ Name string `json:"name,required"`
+ // The comparison operator to use for matching
//
- // This field can be elided, and will marshal its zero value as "span_end".
- Type constant.SpanEnd `json:"type,required"`
+ // Any of "=", "!=", "=~", "!~".
+ Operator string `json:"operator,omitzero,required"`
+ // The value to match against
+ Value string `json:"value,required"`
paramObj
}
-func (r EventStructuredLogPayloadSpanEndParam) MarshalJSON() (data []byte, err error) {
- type shadow EventStructuredLogPayloadSpanEndParam
+func (r TelemetryQueryMetricsParamsLabelMatcher) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryQueryMetricsParamsLabelMatcher
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *EventStructuredLogPayloadSpanEndParam) UnmarshalJSON(data []byte) error {
+func (r *TelemetryQueryMetricsParamsLabelMatcher) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
func init() {
- apijson.RegisterFieldValidator[EventStructuredLogPayloadSpanEndParam](
- "status", "ok", "error",
+ apijson.RegisterFieldValidator[TelemetryQueryMetricsParamsLabelMatcher](
+ "operator", "=", "!=", "=~", "!~",
)
}
-// Only one field can be non-zero.
-//
-// Use [param.IsOmitted] to confirm if a field is set.
-type EventStructuredLogAttributeUnionParam struct {
- OfString param.Opt[string] `json:",omitzero,inline"`
- OfFloat param.Opt[float64] `json:",omitzero,inline"`
- OfBool param.Opt[bool] `json:",omitzero,inline"`
- paramUnion
+// Response containing metric time series data.
+type TelemetryQueryMetricsResponseEnvelope struct {
+ // List of metric series matching the query criteria
+ Data []TelemetryQueryMetricsResponse `json:"data,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:"-"`
}
-func (u EventStructuredLogAttributeUnionParam) MarshalJSON() ([]byte, error) {
- return param.MarshalUnion(u, u.OfString, u.OfFloat, u.OfBool)
+// Returns the unmodified JSON received from the API
+func (r TelemetryQueryMetricsResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryMetricsResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func (u *EventStructuredLogAttributeUnionParam) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, u)
+
+type TelemetryQuerySpansParams struct {
+ // The attribute filters to apply to the spans.
+ AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero,required"`
+ // The attributes to return in the spans.
+ AttributesToReturn []string `json:"attributes_to_return,omitzero,required"`
+ // The maximum depth of the tree.
+ MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
+ paramObj
}
-func (u *EventStructuredLogAttributeUnionParam) asAny() any {
- if !param.IsOmitted(u.OfString) {
- return &u.OfString.Value
- } else if !param.IsOmitted(u.OfFloat) {
- return &u.OfFloat.Value
- } else if !param.IsOmitted(u.OfBool) {
- return &u.OfBool.Value
- }
- return nil
+func (r TelemetryQuerySpansParams) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryQuerySpansParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *TelemetryQuerySpansParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type TelemetryQueryTracesParams struct {
+ // The limit of traces to return.
+ Limit param.Opt[int64] `json:"limit,omitzero"`
+ // The offset of the traces to return.
+ Offset param.Opt[int64] `json:"offset,omitzero"`
+ // The attribute filters to apply to the traces.
+ AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero"`
+ // The order by of the traces to return.
+ OrderBy []string `json:"order_by,omitzero"`
+ paramObj
+}
+
+func (r TelemetryQueryTracesParams) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetryQueryTracesParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *TelemetryQueryTracesParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Response containing a list of traces.
+type TelemetryQueryTracesResponseEnvelope struct {
+ // List of traces matching the query criteria
+ Data []Trace `json:"data,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 TelemetryQueryTracesResponseEnvelope) RawJSON() string { return r.JSON.raw }
+func (r *TelemetryQueryTracesResponseEnvelope) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-type TelemetryLogEventParams struct {
- // The event to log.
- Event EventUnionParam `json:"event,omitzero,required"`
- // The time to live of the event.
- TtlSeconds int64 `json:"ttl_seconds,required"`
+type TelemetrySaveSpansToDatasetParams struct {
+ // The attribute filters to apply to the spans.
+ AttributeFilters []QueryConditionParam `json:"attribute_filters,omitzero,required"`
+ // The attributes to save to the dataset.
+ AttributesToSave []string `json:"attributes_to_save,omitzero,required"`
+ // The ID of the dataset to save the spans to.
+ DatasetID string `json:"dataset_id,required"`
+ // The maximum depth of the tree.
+ MaxDepth param.Opt[int64] `json:"max_depth,omitzero"`
paramObj
}
-func (r TelemetryLogEventParams) MarshalJSON() (data []byte, err error) {
- type shadow TelemetryLogEventParams
+func (r TelemetrySaveSpansToDatasetParams) MarshalJSON() (data []byte, err error) {
+ type shadow TelemetrySaveSpansToDatasetParams
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *TelemetryLogEventParams) UnmarshalJSON(data []byte) error {
+func (r *TelemetrySaveSpansToDatasetParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
diff --git a/telemetry_test.go b/telemetry_test.go
index de50fb3..22dd438 100644
--- a/telemetry_test.go
+++ b/telemetry_test.go
@@ -7,14 +7,13 @@ import (
"errors"
"os"
"testing"
- "time"
"github.com/llamastack/llama-stack-client-go"
"github.com/llamastack/llama-stack-client-go/internal/testutil"
"github.com/llamastack/llama-stack-client-go/option"
)
-func TestTelemetryLogEventWithOptionalParams(t *testing.T) {
+func TestTelemetryGetSpan(t *testing.T) {
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
baseURL = envURL
@@ -25,22 +24,194 @@ func TestTelemetryLogEventWithOptionalParams(t *testing.T) {
client := llamastackclient.NewClient(
option.WithBaseURL(baseURL),
)
- err := client.Telemetry.LogEvent(context.TODO(), llamastackclient.TelemetryLogEventParams{
- Event: llamastackclient.EventUnionParam{
- OfUnstructuredLog: &llamastackclient.EventUnstructuredLogParam{
- Message: "message",
- Severity: "verbose",
- SpanID: "span_id",
- Timestamp: time.Now(),
- TraceID: "trace_id",
- Attributes: map[string]llamastackclient.EventUnstructuredLogAttributeUnionParam{
- "foo": {
- OfString: llamastackclient.String("string"),
- },
- },
- },
+ _, err := client.Telemetry.GetSpan(
+ context.TODO(),
+ "span_id",
+ llamastackclient.TelemetryGetSpanParams{
+ TraceID: "trace_id",
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestTelemetryGetSpanTreeWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Telemetry.GetSpanTree(
+ context.TODO(),
+ "span_id",
+ llamastackclient.TelemetryGetSpanTreeParams{
+ AttributesToReturn: []string{"string"},
+ MaxDepth: llamastackclient.Int(0),
},
- TtlSeconds: 0,
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestTelemetryGetTrace(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Telemetry.GetTrace(context.TODO(), "trace_id")
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestTelemetryQueryMetricsWithOptionalParams(t *testing.T) {
+ t.Skip("unsupported query params in java / kotlin")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Telemetry.QueryMetrics(
+ context.TODO(),
+ "metric_name",
+ llamastackclient.TelemetryQueryMetricsParams{
+ QueryType: llamastackclient.TelemetryQueryMetricsParamsQueryTypeRange,
+ StartTime: 0,
+ EndTime: llamastackclient.Int(0),
+ Granularity: llamastackclient.String("granularity"),
+ LabelMatchers: []llamastackclient.TelemetryQueryMetricsParamsLabelMatcher{{
+ Name: "name",
+ Operator: "=",
+ Value: "value",
+ }},
+ },
+ )
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestTelemetryQuerySpansWithOptionalParams(t *testing.T) {
+ t.Skip("unsupported query params in java / kotlin")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Telemetry.QuerySpans(context.TODO(), llamastackclient.TelemetryQuerySpansParams{
+ AttributeFilters: []llamastackclient.QueryConditionParam{{
+ Key: "key",
+ Op: llamastackclient.QueryConditionOpEq,
+ Value: llamastackclient.QueryConditionValueUnionParam{
+ OfBool: llamastackclient.Bool(true),
+ },
+ }},
+ AttributesToReturn: []string{"string"},
+ MaxDepth: llamastackclient.Int(0),
+ })
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestTelemetryQueryTracesWithOptionalParams(t *testing.T) {
+ t.Skip("unsupported query params in java / kotlin")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.Telemetry.QueryTraces(context.TODO(), llamastackclient.TelemetryQueryTracesParams{
+ AttributeFilters: []llamastackclient.QueryConditionParam{{
+ Key: "key",
+ Op: llamastackclient.QueryConditionOpEq,
+ Value: llamastackclient.QueryConditionValueUnionParam{
+ OfBool: llamastackclient.Bool(true),
+ },
+ }},
+ Limit: llamastackclient.Int(0),
+ Offset: llamastackclient.Int(0),
+ OrderBy: []string{"string"},
+ })
+ if err != nil {
+ var apierr *llamastackclient.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
+
+func TestTelemetrySaveSpansToDatasetWithOptionalParams(t *testing.T) {
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := llamastackclient.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ err := client.Telemetry.SaveSpansToDataset(context.TODO(), llamastackclient.TelemetrySaveSpansToDatasetParams{
+ AttributeFilters: []llamastackclient.QueryConditionParam{{
+ Key: "key",
+ Op: llamastackclient.QueryConditionOpEq,
+ Value: llamastackclient.QueryConditionValueUnionParam{
+ OfBool: llamastackclient.Bool(true),
+ },
+ }},
+ AttributesToSave: []string{"string"},
+ DatasetID: "dataset_id",
+ MaxDepth: llamastackclient.Int(0),
})
if err != nil {
var apierr *llamastackclient.Error
From f3a9ee7303c890444802c76412d5d245a1420bdb Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 2 Oct 2025 20:08:27 +0000
Subject: [PATCH 32/33] fix(api): another fix to capture correct
responses.create() params
---
.stats.yml | 4 +-
api.md | 3 +-
response.go | 3808 ++++++++++++++--------------------
response_test.go | 33 +-
shared/constant/constants.go | 6 +
5 files changed, 1627 insertions(+), 2227 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index a88d26a..5588dfb 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 108
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f26df77f0800baeaea40407776f6c1e618756037969411e29de209ce961655dd.yml
-openapi_spec_hash: e7c2329edc0f9f5aa1c78b6afb996e1c
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-b220f9f8667d2af8007134d0403b24452c20c9c512ca87d0b69b20b761272609.yml
+openapi_spec_hash: cde1096a830f2081d68f858f020fd53f
config_hash: 8800bdff1a087b9d5211dda2a7b9f66f
diff --git a/api.md b/api.md
index 8980691..f1e12cd 100644
--- a/api.md
+++ b/api.md
@@ -79,13 +79,12 @@ Response Types:
- llamastackclient.ResponseObject
- llamastackclient.ResponseObjectStreamUnion
-- llamastackclient.ResponseNewResponse
- llamastackclient.ResponseListResponse
- llamastackclient.ResponseDeleteResponse
Methods:
-- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseNewResponse, error)
+- client.Responses.New(ctx context.Context, body llamastackclient.ResponseNewParams) (llamastackclient.ResponseObject, error)
- client.Responses.Get(ctx context.Context, responseID string) (llamastackclient.ResponseObject, error)
- client.Responses.List(ctx context.Context, query llamastackclient.ResponseListParams) (pagination.OpenAICursorPage[llamastackclient.ResponseListResponse], error)
- client.Responses.Delete(ctx context.Context, responseID string) (llamastackclient.ResponseDeleteResponse, error)
diff --git a/response.go b/response.go
index c3cf4dc..37ce156 100644
--- a/response.go
+++ b/response.go
@@ -43,13 +43,22 @@ func NewResponseService(opts ...option.RequestOption) (r ResponseService) {
return
}
-// List all OpenAI responses.
+// Create a new OpenAI response.
+func (r *ResponseService) New(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (res *ResponseObject, err error) {
+ opts = slices.Concat(r.Options, opts)
+ path := "v1/responses"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
+ return
+}
+
+// Create a new OpenAI response.
func (r *ResponseService) NewStreaming(ctx context.Context, body ResponseNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[ResponseObjectStreamUnion]) {
var (
raw *http.Response
err error
)
opts = slices.Concat(r.Options, opts)
+ opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
path := "v1/responses"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &raw, opts...)
return ssestream.NewStream[ResponseObjectStreamUnion](ssestream.NewDecoder(raw), err)
@@ -4496,58 +4505,28 @@ func (r *ResponseObjectStreamResponseCompleted) UnmarshalJSON(data []byte) error
return apijson.UnmarshalRoot(data, r)
}
-// Paginated list of OpenAI response objects with navigation metadata.
-type ResponseNewResponse struct {
- // List of response objects with their input context
- Data []ResponseNewResponseData `json:"data,required"`
- // Identifier of the first item in this page
- FirstID string `json:"first_id,required"`
- // Whether there are more results available beyond this page
- HasMore bool `json:"has_more,required"`
- // Identifier of the last item in this page
- LastID string `json:"last_id,required"`
- // Object type identifier, always "list"
- Object constant.List `json:"object,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Data respjson.Field
- FirstID respjson.Field
- HasMore respjson.Field
- LastID respjson.Field
- Object respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseNewResponse) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
// OpenAI response object extended with input context information.
-type ResponseNewResponseData struct {
+type ResponseListResponse struct {
// Unique identifier for this response
ID string `json:"id,required"`
// Unix timestamp when the response was created
CreatedAt int64 `json:"created_at,required"`
// List of input items that led to this response
- Input []ResponseNewResponseDataInputUnion `json:"input,required"`
+ Input []ResponseListResponseInputUnion `json:"input,required"`
// Model identifier used for generation
Model string `json:"model,required"`
// Object type identifier, always "response"
Object constant.Response `json:"object,required"`
// List of generated output items (messages, tool calls, etc.)
- Output []ResponseNewResponseDataOutputUnion `json:"output,required"`
+ Output []ResponseListResponseOutputUnion `json:"output,required"`
// Whether tool calls can be executed in parallel
ParallelToolCalls bool `json:"parallel_tool_calls,required"`
// Current status of the response generation
Status string `json:"status,required"`
// Text formatting configuration for the response
- Text ResponseNewResponseDataText `json:"text,required"`
+ Text ResponseListResponseText `json:"text,required"`
// (Optional) Error details if the response generation failed
- Error ResponseNewResponseDataError `json:"error"`
+ Error ResponseListResponseError `json:"error"`
// (Optional) ID of the previous response in a conversation
PreviousResponseID string `json:"previous_response_id"`
// (Optional) Sampling temperature used for generation
@@ -4578,53 +4557,53 @@ type ResponseNewResponseData struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseData) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseData) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponse) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataInputUnion contains all possible properties and values
-// from [ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall],
-// [ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall],
-// [ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall],
-// [ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput],
-// [ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest],
-// [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse],
-// [ResponseNewResponseDataInputOpenAIResponseMessage].
+// ResponseListResponseInputUnion contains all possible properties and values from
+// [ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall],
+// [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall],
+// [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall],
+// [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput],
+// [ResponseListResponseInputOpenAIResponseMcpApprovalRequest],
+// [ResponseListResponseInputOpenAIResponseMcpApprovalResponse],
+// [ResponseListResponseInputOpenAIResponseMessage].
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseNewResponseDataInputUnion struct {
+type ResponseListResponseInputUnion struct {
ID string `json:"id"`
Status string `json:"status"`
Type string `json:"type"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall].
+ // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
Queries []string `json:"queries"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall].
- Results []ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
- Arguments string `json:"arguments"`
- CallID string `json:"call_id"`
- Name string `json:"name"`
+ // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
+ Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ CallID string `json:"call_id"`
+ Name string `json:"name"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput].
+ // [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput].
Output string `json:"output"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest].
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalRequest].
ServerLabel string `json:"server_label"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse].
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
ApprovalRequestID string `json:"approval_request_id"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse].
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
Approve bool `json:"approve"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse].
+ // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
Reason string `json:"reason"`
- // This field is from variant [ResponseNewResponseDataInputOpenAIResponseMessage].
- Content ResponseNewResponseDataInputOpenAIResponseMessageContentUnion `json:"content"`
- // This field is from variant [ResponseNewResponseDataInputOpenAIResponseMessage].
- Role ResponseNewResponseDataInputOpenAIResponseMessageRole `json:"role"`
+ // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
+ Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content"`
+ // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
+ Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role"`
JSON struct {
ID respjson.Field
Status respjson.Field
@@ -4645,50 +4624,50 @@ type ResponseNewResponseDataInputUnion struct {
} `json:"-"`
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseOutputMessageWebSearchToolCall() (v ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageWebSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseOutputMessageFileSearchToolCall() (v ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFileSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseOutputMessageFunctionToolCall() (v ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFunctionToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseInputFunctionToolCallOutput() (v ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseInputFunctionToolCallOutput() (v ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseListResponseInputOpenAIResponseMcpApprovalRequest) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseListResponseInputOpenAIResponseMcpApprovalResponse) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputUnion) AsOpenAIResponseMessage() (v ResponseNewResponseDataInputOpenAIResponseMessage) {
+func (u ResponseListResponseInputUnion) AsOpenAIResponseMessage() (v ResponseListResponseInputOpenAIResponseMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataInputUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseListResponseInputUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseNewResponseDataInputUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Web search tool call output message for OpenAI responses.
-type ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// Current status of the web search operation
@@ -4706,15 +4685,15 @@ type ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall st
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File search tool call output message for OpenAI responses.
-type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// List of search queries executed
@@ -4724,7 +4703,7 @@ type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall s
// Tool call type identifier, always "file_search_call"
Type constant.FileSearchCall `json:"type,required"`
// (Optional) Search results returned by the file search operation
- Results []ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
+ Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -4738,17 +4717,17 @@ type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall s
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Search results returned by the file search operation.
-type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult struct {
// (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,required"`
+ Attributes map[string]ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,required"`
// Unique identifier of the file containing the result
FileID string `json:"file_id,required"`
// Name of the file containing the result
@@ -4770,14 +4749,14 @@ type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallRe
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion
+// ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion
// contains all possible properties and values from [bool], [float64], [string],
// [[]any].
//
@@ -4785,7 +4764,7 @@ func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCa
//
// If the underlying value is not a json object, one of the following properties
// will be valid: OfBool OfFloat OfString OfAnyArray]
-type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -4803,37 +4782,37 @@ type ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallRe
} `json:"-"`
}
-func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsString() (v string) {
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsAnyArray() (v []any) {
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) RawJSON() string {
+func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Function tool call output message for OpenAI responses.
-type ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall struct {
+type ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall struct {
// JSON string containing the function arguments
Arguments string `json:"arguments,required"`
// Unique identifier for the function call
@@ -4860,16 +4839,16 @@ type ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall str
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// This represents the output of a function call that gets passed back to the
// model.
-type ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput struct {
+type ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput struct {
CallID string `json:"call_id,required"`
Output string `json:"output,required"`
Type constant.FunctionCallOutput `json:"type,required"`
@@ -4888,15 +4867,15 @@ type ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput struc
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A request for human approval of a tool invocation.
-type ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest struct {
+type ResponseListResponseInputOpenAIResponseMcpApprovalRequest struct {
ID string `json:"id,required"`
Arguments string `json:"arguments,required"`
Name string `json:"name,required"`
@@ -4915,15 +4894,15 @@ type ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A response to an MCP approval request.
-type ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse struct {
+type ResponseListResponseInputOpenAIResponseMcpApprovalResponse struct {
ApprovalRequestID string `json:"approval_request_id,required"`
Approve bool `json:"approve,required"`
Type constant.McpApprovalResponse `json:"type,required"`
@@ -4942,23 +4921,23 @@ type ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
-type ResponseNewResponseDataInputOpenAIResponseMessage struct {
- Content ResponseNewResponseDataInputOpenAIResponseMessageContentUnion `json:"content,required"`
+type ResponseListResponseInputOpenAIResponseMessage struct {
+ Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content,required"`
// Any of "system", "developer", "user", "assistant".
- Role ResponseNewResponseDataInputOpenAIResponseMessageRole `json:"role,required"`
- Type constant.Message `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
+ Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role,required"`
+ Type constant.Message `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -4972,85 +4951,85 @@ type ResponseNewResponseDataInputOpenAIResponseMessage struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessage) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataInputOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseInputOpenAIResponseMessage) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseInputOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataInputOpenAIResponseMessageContentUnion contains all
-// possible properties and values from [string],
-// [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion],
-// [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem].
+// ResponseListResponseInputOpenAIResponseMessageContentUnion contains all possible
+// properties and values from [string],
+// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion],
+// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem].
//
// 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: OfString
-// OfResponseNewResponseDataInputOpenAIResponseMessageContentArray OfVariant2]
-type ResponseNewResponseDataInputOpenAIResponseMessageContentUnion struct {
+// OfResponseListResponseInputOpenAIResponseMessageContentArray OfVariant2]
+type ResponseListResponseInputOpenAIResponseMessageContentUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion]
- // instead of an object.
- OfResponseNewResponseDataInputOpenAIResponseMessageContentArray []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion `json:",inline"`
+ // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] instead
+ // of an object.
+ OfResponseListResponseInputOpenAIResponseMessageContentArray []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem] instead of
- // an object.
- OfVariant2 []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem `json:",inline"`
+ // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem] instead of an
+ // object.
+ OfVariant2 []ResponseListResponseInputOpenAIResponseMessageContentArrayItem `json:",inline"`
JSON struct {
- OfString respjson.Field
- OfResponseNewResponseDataInputOpenAIResponseMessageContentArray respjson.Field
- OfVariant2 respjson.Field
- raw string
+ OfString respjson.Field
+ OfResponseListResponseInputOpenAIResponseMessageContentArray respjson.Field
+ OfVariant2 respjson.Field
+ raw string
} `json:"-"`
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) AsString() (v string) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) AsResponseNewResponseDataInputOpenAIResponseMessageContentArray() (v []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsResponseListResponseInputOpenAIResponseMessageContentArray() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) AsVariant2() (v []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsVariant2() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) RawJSON() string {
+func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion contains
-// all possible properties and values from
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText],
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage].
+// ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion contains all
+// possible properties and values from
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
//
// Use the
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
// method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion struct {
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText].
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText].
Text string `json:"text"`
// Any of "input_text", "input_image".
Type string `json:"type"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage].
- Detail ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail"`
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
+ Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage].
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
ImageURL string `json:"image_url"`
JSON struct {
Text respjson.Field
@@ -5061,29 +5040,29 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion stru
} `json:"-"`
}
-// anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem is
-// implemented by each variant of
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion] to add
+// anyResponseListResponseInputOpenAIResponseMessageContentArrayItem is implemented
+// by each variant of
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] to add
// type safety for the return type of
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
-type anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem interface {
- implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion()
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
+type anyResponseListResponseInputOpenAIResponseMessageContentArrayItem interface {
+ implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion()
}
-func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion() {
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
}
-func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion() {
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion.AsAny().(type) {
-// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText:
-// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage:
+// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) AsAny() anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItem {
switch u.Type {
case "input_text":
return u.AsInputText()
@@ -5093,27 +5072,27 @@ func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion)
return nil
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) AsInputText() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) AsInputImage() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) RawJSON() string {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Text content for input messages in OpenAI response format.
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText struct {
// The text content of the input message
Text string `json:"text,required"`
// Content type identifier, always "input_text"
@@ -5128,19 +5107,19 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content for input messages in OpenAI response format.
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage struct {
// Level of detail for image processing, can be "low", "high", or "auto"
//
// Any of "low", "high", "auto".
- Detail ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,required"`
+ Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,required"`
// Content type identifier, always "input_image"
Type constant.InputImage `json:"type,required"`
// (Optional) URL of the image content
@@ -5156,35 +5135,35 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail string
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail string
const (
- ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
- ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
- ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
)
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail string
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail string
const (
- ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetailLow ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail = "low"
- ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetailHigh ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail = "high"
- ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetailAuto ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemDetail = "auto"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "low"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "high"
+ ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "auto"
)
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem struct {
- Annotations []ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
- Text string `json:"text,required"`
- Type constant.OutputText `json:"type,required"`
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItem struct {
+ Annotations []ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
+ Text string `json:"text,required"`
+ Type constant.OutputText `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Annotations respjson.Field
@@ -5196,26 +5175,26 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItem) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion
+// ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion
// contains all possible properties and values from
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation],
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation],
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation],
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath].
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation],
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath].
//
// Use the
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
// method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
FileID string `json:"file_id"`
Filename string `json:"filename"`
Index int64 `json:"index"`
@@ -5224,13 +5203,13 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
EndIndex int64 `json:"end_index"`
StartIndex int64 `json:"start_index"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
Title string `json:"title"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
URL string `json:"url"`
// This field is from variant
- // [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation].
+ // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation].
ContainerID string `json:"container_id"`
JSON struct {
FileID respjson.Field
@@ -5246,35 +5225,35 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
} `json:"-"`
}
-// anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
-// is implemented by each variant of
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion]
+// anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation is
+// implemented by each variant of
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion]
// to add type safety for the return type of
-// [ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
-type anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation interface {
- implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion()
+// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
+type anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation interface {
+ implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion()
}
-func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) implResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny().(type) {
-// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation:
-// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation:
-// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation:
-// case llamastackclient.ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath:
+// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation:
+// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsAny() anyResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation {
switch u.Type {
case "file_citation":
return u.AsFileCitation()
@@ -5288,37 +5267,37 @@ func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotat
return nil
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) RawJSON() string {
+func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File citation annotation for referencing specific files in response content.
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
// Unique identifier of the referenced file
FileID string `json:"file_id,required"`
// Name of the referenced file
@@ -5339,15 +5318,15 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// URL citation annotation for referencing external web resources.
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
// End position of the citation span in the content
EndIndex int64 `json:"end_index,required"`
// Start position of the citation span in the content
@@ -5371,14 +5350,14 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
ContainerID string `json:"container_id,required"`
EndIndex int64 `json:"end_index,required"`
FileID string `json:"file_id,required"`
@@ -5399,14 +5378,14 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
+type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
FileID string `json:"file_id,required"`
Index int64 `json:"index,required"`
Type constant.FilePath `json:"type,required"`
@@ -5421,69 +5400,66 @@ type ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotation
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) RawJSON() string {
+func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataInputOpenAIResponseMessageRole string
+type ResponseListResponseInputOpenAIResponseMessageRole string
const (
- ResponseNewResponseDataInputOpenAIResponseMessageRoleSystem ResponseNewResponseDataInputOpenAIResponseMessageRole = "system"
- ResponseNewResponseDataInputOpenAIResponseMessageRoleDeveloper ResponseNewResponseDataInputOpenAIResponseMessageRole = "developer"
- ResponseNewResponseDataInputOpenAIResponseMessageRoleUser ResponseNewResponseDataInputOpenAIResponseMessageRole = "user"
- ResponseNewResponseDataInputOpenAIResponseMessageRoleAssistant ResponseNewResponseDataInputOpenAIResponseMessageRole = "assistant"
+ ResponseListResponseInputOpenAIResponseMessageRoleSystem ResponseListResponseInputOpenAIResponseMessageRole = "system"
+ ResponseListResponseInputOpenAIResponseMessageRoleDeveloper ResponseListResponseInputOpenAIResponseMessageRole = "developer"
+ ResponseListResponseInputOpenAIResponseMessageRoleUser ResponseListResponseInputOpenAIResponseMessageRole = "user"
+ ResponseListResponseInputOpenAIResponseMessageRoleAssistant ResponseListResponseInputOpenAIResponseMessageRole = "assistant"
)
-type ResponseNewResponseDataInputRole string
+type ResponseListResponseInputRole string
const (
- ResponseNewResponseDataInputRoleSystem ResponseNewResponseDataInputRole = "system"
- ResponseNewResponseDataInputRoleDeveloper ResponseNewResponseDataInputRole = "developer"
- ResponseNewResponseDataInputRoleUser ResponseNewResponseDataInputRole = "user"
- ResponseNewResponseDataInputRoleAssistant ResponseNewResponseDataInputRole = "assistant"
+ ResponseListResponseInputRoleSystem ResponseListResponseInputRole = "system"
+ ResponseListResponseInputRoleDeveloper ResponseListResponseInputRole = "developer"
+ ResponseListResponseInputRoleUser ResponseListResponseInputRole = "user"
+ ResponseListResponseInputRoleAssistant ResponseListResponseInputRole = "assistant"
)
-// ResponseNewResponseDataOutputUnion contains all possible properties and values
-// from [ResponseNewResponseDataOutputMessage],
-// [ResponseNewResponseDataOutputWebSearchCall],
-// [ResponseNewResponseDataOutputFileSearchCall],
-// [ResponseNewResponseDataOutputFunctionCall],
-// [ResponseNewResponseDataOutputMcpCall],
-// [ResponseNewResponseDataOutputMcpListTools],
-// [ResponseNewResponseDataOutputMcpApprovalRequest].
+// ResponseListResponseOutputUnion contains all possible properties and values from
+// [ResponseListResponseOutputMessage], [ResponseListResponseOutputWebSearchCall],
+// [ResponseListResponseOutputFileSearchCall],
+// [ResponseListResponseOutputFunctionCall], [ResponseListResponseOutputMcpCall],
+// [ResponseListResponseOutputMcpListTools],
+// [ResponseListResponseOutputMcpApprovalRequest].
//
-// Use the [ResponseNewResponseDataOutputUnion.AsAny] method to switch on the
-// variant.
+// Use the [ResponseListResponseOutputUnion.AsAny] method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseNewResponseDataOutputUnion struct {
- // This field is from variant [ResponseNewResponseDataOutputMessage].
- Content ResponseNewResponseDataOutputMessageContentUnion `json:"content"`
- // This field is from variant [ResponseNewResponseDataOutputMessage].
- Role ResponseNewResponseDataOutputMessageRole `json:"role"`
+type ResponseListResponseOutputUnion struct {
+ // This field is from variant [ResponseListResponseOutputMessage].
+ Content ResponseListResponseOutputMessageContentUnion `json:"content"`
+ // This field is from variant [ResponseListResponseOutputMessage].
+ Role ResponseListResponseOutputMessageRole `json:"role"`
// Any of "message", "web_search_call", "file_search_call", "function_call",
// "mcp_call", "mcp_list_tools", "mcp_approval_request".
Type string `json:"type"`
ID string `json:"id"`
Status string `json:"status"`
- // This field is from variant [ResponseNewResponseDataOutputFileSearchCall].
+ // This field is from variant [ResponseListResponseOutputFileSearchCall].
Queries []string `json:"queries"`
- // This field is from variant [ResponseNewResponseDataOutputFileSearchCall].
- Results []ResponseNewResponseDataOutputFileSearchCallResult `json:"results"`
- Arguments string `json:"arguments"`
- // This field is from variant [ResponseNewResponseDataOutputFunctionCall].
+ // This field is from variant [ResponseListResponseOutputFileSearchCall].
+ Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
+ Arguments string `json:"arguments"`
+ // This field is from variant [ResponseListResponseOutputFunctionCall].
CallID string `json:"call_id"`
Name string `json:"name"`
ServerLabel string `json:"server_label"`
- // This field is from variant [ResponseNewResponseDataOutputMcpCall].
+ // This field is from variant [ResponseListResponseOutputMcpCall].
Error string `json:"error"`
- // This field is from variant [ResponseNewResponseDataOutputMcpCall].
+ // This field is from variant [ResponseListResponseOutputMcpCall].
Output string `json:"output"`
- // This field is from variant [ResponseNewResponseDataOutputMcpListTools].
- Tools []ResponseNewResponseDataOutputMcpListToolsTool `json:"tools"`
+ // This field is from variant [ResponseListResponseOutputMcpListTools].
+ Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools"`
JSON struct {
Content respjson.Field
Role respjson.Field
@@ -5503,35 +5479,35 @@ type ResponseNewResponseDataOutputUnion struct {
} `json:"-"`
}
-// anyResponseNewResponseDataOutput is implemented by each variant of
-// [ResponseNewResponseDataOutputUnion] to add type safety for the return type of
-// [ResponseNewResponseDataOutputUnion.AsAny]
-type anyResponseNewResponseDataOutput interface {
- implResponseNewResponseDataOutputUnion()
+// anyResponseListResponseOutput is implemented by each variant of
+// [ResponseListResponseOutputUnion] to add type safety for the return type of
+// [ResponseListResponseOutputUnion.AsAny]
+type anyResponseListResponseOutput interface {
+ implResponseListResponseOutputUnion()
}
-func (ResponseNewResponseDataOutputMessage) implResponseNewResponseDataOutputUnion() {}
-func (ResponseNewResponseDataOutputWebSearchCall) implResponseNewResponseDataOutputUnion() {}
-func (ResponseNewResponseDataOutputFileSearchCall) implResponseNewResponseDataOutputUnion() {}
-func (ResponseNewResponseDataOutputFunctionCall) implResponseNewResponseDataOutputUnion() {}
-func (ResponseNewResponseDataOutputMcpCall) implResponseNewResponseDataOutputUnion() {}
-func (ResponseNewResponseDataOutputMcpListTools) implResponseNewResponseDataOutputUnion() {}
-func (ResponseNewResponseDataOutputMcpApprovalRequest) implResponseNewResponseDataOutputUnion() {}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ResponseNewResponseDataOutputUnion.AsAny().(type) {
-// case llamastackclient.ResponseNewResponseDataOutputMessage:
-// case llamastackclient.ResponseNewResponseDataOutputWebSearchCall:
-// case llamastackclient.ResponseNewResponseDataOutputFileSearchCall:
-// case llamastackclient.ResponseNewResponseDataOutputFunctionCall:
-// case llamastackclient.ResponseNewResponseDataOutputMcpCall:
-// case llamastackclient.ResponseNewResponseDataOutputMcpListTools:
-// case llamastackclient.ResponseNewResponseDataOutputMcpApprovalRequest:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ResponseNewResponseDataOutputUnion) AsAny() anyResponseNewResponseDataOutput {
+func (ResponseListResponseOutputMessage) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputWebSearchCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputFileSearchCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputFunctionCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpCall) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnion() {}
+func (ResponseListResponseOutputMcpApprovalRequest) implResponseListResponseOutputUnion() {}
+
+// Use the following switch statement to find the correct variant
+//
+// switch variant := ResponseListResponseOutputUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseOutputMessage:
+// case llamastackclient.ResponseListResponseOutputWebSearchCall:
+// case llamastackclient.ResponseListResponseOutputFileSearchCall:
+// case llamastackclient.ResponseListResponseOutputFunctionCall:
+// case llamastackclient.ResponseListResponseOutputMcpCall:
+// case llamastackclient.ResponseListResponseOutputMcpListTools:
+// case llamastackclient.ResponseListResponseOutputMcpApprovalRequest:
+// default:
+// fmt.Errorf("no variant present")
+// }
+func (u ResponseListResponseOutputUnion) AsAny() anyResponseListResponseOutput {
switch u.Type {
case "message":
return u.AsMessage()
@@ -5551,58 +5527,58 @@ func (u ResponseNewResponseDataOutputUnion) AsAny() anyResponseNewResponseDataOu
return nil
}
-func (u ResponseNewResponseDataOutputUnion) AsMessage() (v ResponseNewResponseDataOutputMessage) {
+func (u ResponseListResponseOutputUnion) AsMessage() (v ResponseListResponseOutputMessage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputUnion) AsWebSearchCall() (v ResponseNewResponseDataOutputWebSearchCall) {
+func (u ResponseListResponseOutputUnion) AsWebSearchCall() (v ResponseListResponseOutputWebSearchCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputUnion) AsFileSearchCall() (v ResponseNewResponseDataOutputFileSearchCall) {
+func (u ResponseListResponseOutputUnion) AsFileSearchCall() (v ResponseListResponseOutputFileSearchCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputUnion) AsFunctionCall() (v ResponseNewResponseDataOutputFunctionCall) {
+func (u ResponseListResponseOutputUnion) AsFunctionCall() (v ResponseListResponseOutputFunctionCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputUnion) AsMcpCall() (v ResponseNewResponseDataOutputMcpCall) {
+func (u ResponseListResponseOutputUnion) AsMcpCall() (v ResponseListResponseOutputMcpCall) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputUnion) AsMcpListTools() (v ResponseNewResponseDataOutputMcpListTools) {
+func (u ResponseListResponseOutputUnion) AsMcpListTools() (v ResponseListResponseOutputMcpListTools) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputUnion) AsMcpApprovalRequest() (v ResponseNewResponseDataOutputMcpApprovalRequest) {
+func (u ResponseListResponseOutputUnion) AsMcpApprovalRequest() (v ResponseListResponseOutputMcpApprovalRequest) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataOutputUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseListResponseOutputUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseNewResponseDataOutputUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
-type ResponseNewResponseDataOutputMessage struct {
- Content ResponseNewResponseDataOutputMessageContentUnion `json:"content,required"`
+type ResponseListResponseOutputMessage struct {
+ Content ResponseListResponseOutputMessageContentUnion `json:"content,required"`
// Any of "system", "developer", "user", "assistant".
- Role ResponseNewResponseDataOutputMessageRole `json:"role,required"`
- Type constant.Message `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
+ Role ResponseListResponseOutputMessageRole `json:"role,required"`
+ Type constant.Message `json:"type,required"`
+ ID string `json:"id"`
+ Status string `json:"status"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Content respjson.Field
@@ -5616,81 +5592,80 @@ type ResponseNewResponseDataOutputMessage struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessage) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputMessage) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputMessage) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMessage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataOutputMessageContentUnion contains all possible
-// properties and values from [string],
-// [[]ResponseNewResponseDataOutputMessageContentArrayItemUnion],
-// [[]ResponseNewResponseDataOutputMessageContentArrayItem].
+// ResponseListResponseOutputMessageContentUnion contains all possible properties
+// and values from [string],
+// [[]ResponseListResponseOutputMessageContentArrayItemUnion],
+// [[]ResponseListResponseOutputMessageContentArrayItem].
//
// 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: OfString OfResponseNewResponseDataOutputMessageContentArray
+// will be valid: OfString OfResponseListResponseOutputMessageContentArray
// OfVariant2]
-type ResponseNewResponseDataOutputMessageContentUnion struct {
+type ResponseListResponseOutputMessageContentUnion struct {
// This field will be present if the value is a [string] instead of an object.
OfString string `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseNewResponseDataOutputMessageContentArrayItemUnion] instead of an
- // object.
- OfResponseNewResponseDataOutputMessageContentArray []ResponseNewResponseDataOutputMessageContentArrayItemUnion `json:",inline"`
+ // [[]ResponseListResponseOutputMessageContentArrayItemUnion] instead of an object.
+ OfResponseListResponseOutputMessageContentArray []ResponseListResponseOutputMessageContentArrayItemUnion `json:",inline"`
// This field will be present if the value is a
- // [[]ResponseNewResponseDataOutputMessageContentArrayItem] instead of an object.
- OfVariant2 []ResponseNewResponseDataOutputMessageContentArrayItem `json:",inline"`
+ // [[]ResponseListResponseOutputMessageContentArrayItem] instead of an object.
+ OfVariant2 []ResponseListResponseOutputMessageContentArrayItem `json:",inline"`
JSON struct {
- OfString respjson.Field
- OfResponseNewResponseDataOutputMessageContentArray respjson.Field
- OfVariant2 respjson.Field
- raw string
+ OfString respjson.Field
+ OfResponseListResponseOutputMessageContentArray respjson.Field
+ OfVariant2 respjson.Field
+ raw string
} `json:"-"`
}
-func (u ResponseNewResponseDataOutputMessageContentUnion) AsString() (v string) {
+func (u ResponseListResponseOutputMessageContentUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMessageContentUnion) AsResponseNewResponseDataOutputMessageContentArray() (v []ResponseNewResponseDataOutputMessageContentArrayItemUnion) {
+func (u ResponseListResponseOutputMessageContentUnion) AsResponseListResponseOutputMessageContentArray() (v []ResponseListResponseOutputMessageContentArrayItemUnion) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMessageContentUnion) AsVariant2() (v []ResponseNewResponseDataOutputMessageContentArrayItem) {
+func (u ResponseListResponseOutputMessageContentUnion) AsVariant2() (v []ResponseListResponseOutputMessageContentArrayItem) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseListResponseOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseNewResponseDataOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataOutputMessageContentArrayItemUnion contains all possible
+// ResponseListResponseOutputMessageContentArrayItemUnion contains all possible
// properties and values from
-// [ResponseNewResponseDataOutputMessageContentArrayItemInputText],
-// [ResponseNewResponseDataOutputMessageContentArrayItemInputImage].
+// [ResponseListResponseOutputMessageContentArrayItemInputText],
+// [ResponseListResponseOutputMessageContentArrayItemInputImage].
//
-// Use the [ResponseNewResponseDataOutputMessageContentArrayItemUnion.AsAny] method
-// to switch on the variant.
+// Use the [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny] method to
+// switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseNewResponseDataOutputMessageContentArrayItemUnion struct {
+type ResponseListResponseOutputMessageContentArrayItemUnion struct {
// This field is from variant
- // [ResponseNewResponseDataOutputMessageContentArrayItemInputText].
+ // [ResponseListResponseOutputMessageContentArrayItemInputText].
Text string `json:"text"`
// Any of "input_text", "input_image".
Type string `json:"type"`
// This field is from variant
- // [ResponseNewResponseDataOutputMessageContentArrayItemInputImage].
- Detail ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail `json:"detail"`
+ // [ResponseListResponseOutputMessageContentArrayItemInputImage].
+ Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail"`
// This field is from variant
- // [ResponseNewResponseDataOutputMessageContentArrayItemInputImage].
+ // [ResponseListResponseOutputMessageContentArrayItemInputImage].
ImageURL string `json:"image_url"`
JSON struct {
Text respjson.Field
@@ -5701,28 +5676,28 @@ type ResponseNewResponseDataOutputMessageContentArrayItemUnion struct {
} `json:"-"`
}
-// anyResponseNewResponseDataOutputMessageContentArrayItem is implemented by each
-// variant of [ResponseNewResponseDataOutputMessageContentArrayItemUnion] to add
-// type safety for the return type of
-// [ResponseNewResponseDataOutputMessageContentArrayItemUnion.AsAny]
-type anyResponseNewResponseDataOutputMessageContentArrayItem interface {
- implResponseNewResponseDataOutputMessageContentArrayItemUnion()
+// anyResponseListResponseOutputMessageContentArrayItem is implemented by each
+// variant of [ResponseListResponseOutputMessageContentArrayItemUnion] to add type
+// safety for the return type of
+// [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny]
+type anyResponseListResponseOutputMessageContentArrayItem interface {
+ implResponseListResponseOutputMessageContentArrayItemUnion()
}
-func (ResponseNewResponseDataOutputMessageContentArrayItemInputText) implResponseNewResponseDataOutputMessageContentArrayItemUnion() {
+func (ResponseListResponseOutputMessageContentArrayItemInputText) implResponseListResponseOutputMessageContentArrayItemUnion() {
}
-func (ResponseNewResponseDataOutputMessageContentArrayItemInputImage) implResponseNewResponseDataOutputMessageContentArrayItemUnion() {
+func (ResponseListResponseOutputMessageContentArrayItemInputImage) implResponseListResponseOutputMessageContentArrayItemUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseNewResponseDataOutputMessageContentArrayItemUnion.AsAny().(type) {
-// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemInputText:
-// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemInputImage:
+// switch variant := ResponseListResponseOutputMessageContentArrayItemUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputText:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputImage:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsAny() anyResponseNewResponseDataOutputMessageContentArrayItem {
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItem {
switch u.Type {
case "input_text":
return u.AsInputText()
@@ -5732,27 +5707,25 @@ func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsAny() anyRe
return nil
}
-func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsInputText() (v ResponseNewResponseDataOutputMessageContentArrayItemInputText) {
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseOutputMessageContentArrayItemInputText) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) AsInputImage() (v ResponseNewResponseDataOutputMessageContentArrayItemInputImage) {
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseOutputMessageContentArrayItemInputImage) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataOutputMessageContentArrayItemUnion) RawJSON() string {
- return u.JSON.raw
-}
+func (u ResponseListResponseOutputMessageContentArrayItemUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Text content for input messages in OpenAI response format.
-type ResponseNewResponseDataOutputMessageContentArrayItemInputText struct {
+type ResponseListResponseOutputMessageContentArrayItemInputText struct {
// The text content of the input message
Text string `json:"text,required"`
// Content type identifier, always "input_text"
@@ -5767,19 +5740,19 @@ type ResponseNewResponseDataOutputMessageContentArrayItemInputText struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItemInputText) RawJSON() string {
+func (r ResponseListResponseOutputMessageContentArrayItemInputText) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content for input messages in OpenAI response format.
-type ResponseNewResponseDataOutputMessageContentArrayItemInputImage struct {
+type ResponseListResponseOutputMessageContentArrayItemInputImage struct {
// Level of detail for image processing, can be "low", "high", or "auto"
//
// Any of "low", "high", "auto".
- Detail ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail `json:"detail,required"`
+ Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail,required"`
// Content type identifier, always "input_image"
Type constant.InputImage `json:"type,required"`
// (Optional) URL of the image content
@@ -5795,35 +5768,35 @@ type ResponseNewResponseDataOutputMessageContentArrayItemInputImage struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItemInputImage) RawJSON() string {
+func (r ResponseListResponseOutputMessageContentArrayItemInputImage) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail string
+type ResponseListResponseOutputMessageContentArrayItemInputImageDetail string
const (
- ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetailLow ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail = "low"
- ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetailHigh ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail = "high"
- ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetailAuto ResponseNewResponseDataOutputMessageContentArrayItemInputImageDetail = "auto"
+ ResponseListResponseOutputMessageContentArrayItemInputImageDetailLow ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "low"
+ ResponseListResponseOutputMessageContentArrayItemInputImageDetailHigh ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "high"
+ ResponseListResponseOutputMessageContentArrayItemInputImageDetailAuto ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "auto"
)
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseNewResponseDataOutputMessageContentArrayItemDetail string
+type ResponseListResponseOutputMessageContentArrayItemDetail string
const (
- ResponseNewResponseDataOutputMessageContentArrayItemDetailLow ResponseNewResponseDataOutputMessageContentArrayItemDetail = "low"
- ResponseNewResponseDataOutputMessageContentArrayItemDetailHigh ResponseNewResponseDataOutputMessageContentArrayItemDetail = "high"
- ResponseNewResponseDataOutputMessageContentArrayItemDetailAuto ResponseNewResponseDataOutputMessageContentArrayItemDetail = "auto"
+ ResponseListResponseOutputMessageContentArrayItemDetailLow ResponseListResponseOutputMessageContentArrayItemDetail = "low"
+ ResponseListResponseOutputMessageContentArrayItemDetailHigh ResponseListResponseOutputMessageContentArrayItemDetail = "high"
+ ResponseListResponseOutputMessageContentArrayItemDetailAuto ResponseListResponseOutputMessageContentArrayItemDetail = "auto"
)
-type ResponseNewResponseDataOutputMessageContentArrayItem struct {
- Annotations []ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
- Text string `json:"text,required"`
- Type constant.OutputText `json:"type,required"`
+type ResponseListResponseOutputMessageContentArrayItem struct {
+ Annotations []ResponseListResponseOutputMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
+ Text string `json:"text,required"`
+ Type constant.OutputText `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Annotations respjson.Field
@@ -5835,24 +5808,23 @@ type ResponseNewResponseDataOutputMessageContentArrayItem struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItem) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputMessageContentArrayItem) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMessageContentArrayItem) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion contains all
+// ResponseListResponseOutputMessageContentArrayItemAnnotationUnion contains all
// possible properties and values from
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation],
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation],
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation],
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath].
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation],
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation],
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation],
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath].
//
-// Use the
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion.AsAny]
+// Use the [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
// method to switch on the variant.
//
// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion struct {
+type ResponseListResponseOutputMessageContentArrayItemAnnotationUnion struct {
FileID string `json:"file_id"`
Filename string `json:"filename"`
Index int64 `json:"index"`
@@ -5861,13 +5833,13 @@ type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion struct
EndIndex int64 `json:"end_index"`
StartIndex int64 `json:"start_index"`
// This field is from variant
- // [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
Title string `json:"title"`
// This field is from variant
- // [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation].
+ // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
URL string `json:"url"`
// This field is from variant
- // [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation].
+ // [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation].
ContainerID string `json:"container_id"`
JSON struct {
FileID respjson.Field
@@ -5883,35 +5855,35 @@ type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion struct
} `json:"-"`
}
-// anyResponseNewResponseDataOutputMessageContentArrayItemAnnotation is implemented
-// by each variant of
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion] to add
-// type safety for the return type of
-// [ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion.AsAny]
-type anyResponseNewResponseDataOutputMessageContentArrayItemAnnotation interface {
- implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion()
+// anyResponseListResponseOutputMessageContentArrayItemAnnotation is implemented by
+// each variant of
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion] to add type
+// safety for the return type of
+// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
+type anyResponseListResponseOutputMessageContentArrayItemAnnotation interface {
+ implResponseListResponseOutputMessageContentArrayItemAnnotationUnion()
}
-func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
}
-func (ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) implResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion() {
+func (ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
}
// Use the following switch statement to find the correct variant
//
-// switch variant := ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion.AsAny().(type) {
-// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation:
-// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation:
-// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation:
-// case llamastackclient.ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath:
+// switch variant := ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny().(type) {
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation:
+// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath:
// default:
// fmt.Errorf("no variant present")
// }
-func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsAny() anyResponseNewResponseDataOutputMessageContentArrayItemAnnotation {
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItemAnnotation {
switch u.Type {
case "file_citation":
return u.AsFileCitation()
@@ -5925,37 +5897,37 @@ func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsA
return nil
}
-func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) {
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) {
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) {
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) {
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) RawJSON() string {
+func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File citation annotation for referencing specific files in response content.
-type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation struct {
+type ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation struct {
// Unique identifier of the referenced file
FileID string `json:"file_id,required"`
// Name of the referenced file
@@ -5976,15 +5948,15 @@ type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// URL citation annotation for referencing external web resources.
-type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation struct {
+type ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation struct {
// End position of the citation span in the content
EndIndex int64 `json:"end_index,required"`
// Start position of the citation span in the content
@@ -6008,14 +5980,14 @@ type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation s
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation struct {
+type ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation struct {
ContainerID string `json:"container_id,required"`
EndIndex int64 `json:"end_index,required"`
FileID string `json:"file_id,required"`
@@ -6036,14 +6008,14 @@ type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFile
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath struct {
+type ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath struct {
FileID string `json:"file_id,required"`
Index int64 `json:"index,required"`
Type constant.FilePath `json:"type,required"`
@@ -6058,24 +6030,24 @@ type ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath stru
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) RawJSON() string {
+func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) RawJSON() string {
return r.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataOutputMessageRole string
+type ResponseListResponseOutputMessageRole string
const (
- ResponseNewResponseDataOutputMessageRoleSystem ResponseNewResponseDataOutputMessageRole = "system"
- ResponseNewResponseDataOutputMessageRoleDeveloper ResponseNewResponseDataOutputMessageRole = "developer"
- ResponseNewResponseDataOutputMessageRoleUser ResponseNewResponseDataOutputMessageRole = "user"
- ResponseNewResponseDataOutputMessageRoleAssistant ResponseNewResponseDataOutputMessageRole = "assistant"
+ ResponseListResponseOutputMessageRoleSystem ResponseListResponseOutputMessageRole = "system"
+ ResponseListResponseOutputMessageRoleDeveloper ResponseListResponseOutputMessageRole = "developer"
+ ResponseListResponseOutputMessageRoleUser ResponseListResponseOutputMessageRole = "user"
+ ResponseListResponseOutputMessageRoleAssistant ResponseListResponseOutputMessageRole = "assistant"
)
// Web search tool call output message for OpenAI responses.
-type ResponseNewResponseDataOutputWebSearchCall struct {
+type ResponseListResponseOutputWebSearchCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// Current status of the web search operation
@@ -6093,13 +6065,13 @@ type ResponseNewResponseDataOutputWebSearchCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputWebSearchCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputWebSearchCall) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputWebSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputWebSearchCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File search tool call output message for OpenAI responses.
-type ResponseNewResponseDataOutputFileSearchCall struct {
+type ResponseListResponseOutputFileSearchCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// List of search queries executed
@@ -6109,7 +6081,7 @@ type ResponseNewResponseDataOutputFileSearchCall struct {
// Tool call type identifier, always "file_search_call"
Type constant.FileSearchCall `json:"type,required"`
// (Optional) Search results returned by the file search operation
- Results []ResponseNewResponseDataOutputFileSearchCallResult `json:"results"`
+ Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
@@ -6123,15 +6095,15 @@ type ResponseNewResponseDataOutputFileSearchCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputFileSearchCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputFileSearchCall) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputFileSearchCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputFileSearchCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Search results returned by the file search operation.
-type ResponseNewResponseDataOutputFileSearchCallResult struct {
+type ResponseListResponseOutputFileSearchCallResult struct {
// (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion `json:"attributes,required"`
+ Attributes map[string]ResponseListResponseOutputFileSearchCallResultAttributeUnion `json:"attributes,required"`
// Unique identifier of the file containing the result
FileID string `json:"file_id,required"`
// Name of the file containing the result
@@ -6153,19 +6125,19 @@ type ResponseNewResponseDataOutputFileSearchCallResult struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputFileSearchCallResult) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputFileSearchCallResult) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputFileSearchCallResult) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputFileSearchCallResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion contains all
+// ResponseListResponseOutputFileSearchCallResultAttributeUnion contains all
// possible properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion struct {
+type ResponseListResponseOutputFileSearchCallResultAttributeUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -6183,37 +6155,37 @@ type ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion struct {
} `json:"-"`
}
-func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsBool() (v bool) {
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsFloat() (v float64) {
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsString() (v string) {
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) AsAnyArray() (v []any) {
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) RawJSON() string {
+func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataOutputFileSearchCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputFileSearchCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Function tool call output message for OpenAI responses.
-type ResponseNewResponseDataOutputFunctionCall struct {
+type ResponseListResponseOutputFunctionCall struct {
// JSON string containing the function arguments
Arguments string `json:"arguments,required"`
// Unique identifier for the function call
@@ -6240,13 +6212,13 @@ type ResponseNewResponseDataOutputFunctionCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputFunctionCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputFunctionCall) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputFunctionCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputFunctionCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Model Context Protocol (MCP) call output message for OpenAI responses.
-type ResponseNewResponseDataOutputMcpCall struct {
+type ResponseListResponseOutputMcpCall struct {
// Unique identifier for this MCP call
ID string `json:"id,required"`
// JSON string containing the MCP call arguments
@@ -6276,19 +6248,19 @@ type ResponseNewResponseDataOutputMcpCall struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMcpCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputMcpCall) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputMcpCall) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// MCP list tools output message containing available tools from an MCP server.
-type ResponseNewResponseDataOutputMcpListTools struct {
+type ResponseListResponseOutputMcpListTools struct {
// Unique identifier for this MCP list tools operation
ID string `json:"id,required"`
// Label identifying the MCP server providing the tools
ServerLabel string `json:"server_label,required"`
// List of available tools provided by the MCP server
- Tools []ResponseNewResponseDataOutputMcpListToolsTool `json:"tools,required"`
+ Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools,required"`
// Tool call type identifier, always "mcp_list_tools"
Type constant.McpListTools `json:"type,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -6303,15 +6275,15 @@ type ResponseNewResponseDataOutputMcpListTools struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMcpListTools) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputMcpListTools) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputMcpListTools) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpListTools) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Tool definition returned by MCP list tools operation.
-type ResponseNewResponseDataOutputMcpListToolsTool struct {
+type ResponseListResponseOutputMcpListToolsTool struct {
// JSON schema defining the tool's input parameters
- InputSchema map[string]ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion `json:"input_schema,required"`
+ InputSchema map[string]ResponseListResponseOutputMcpListToolsToolInputSchemaUnion `json:"input_schema,required"`
// Name of the tool
Name string `json:"name,required"`
// (Optional) Description of what the tool does
@@ -6327,19 +6299,19 @@ type ResponseNewResponseDataOutputMcpListToolsTool struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMcpListToolsTool) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputMcpListToolsTool) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputMcpListToolsTool) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpListToolsTool) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion contains all
-// possible properties and values from [bool], [float64], [string], [[]any].
+// ResponseListResponseOutputMcpListToolsToolInputSchemaUnion contains all possible
+// properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion struct {
+type ResponseListResponseOutputMcpListToolsToolInputSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -6357,37 +6329,37 @@ type ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion struct {
} `json:"-"`
}
-func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsBool() (v bool) {
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsFloat() (v float64) {
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsString() (v string) {
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) AsAnyArray() (v []any) {
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) RawJSON() string {
+func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) RawJSON() string {
return u.JSON.raw
}
-func (r *ResponseNewResponseDataOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A request for human approval of a tool invocation.
-type ResponseNewResponseDataOutputMcpApprovalRequest struct {
+type ResponseListResponseOutputMcpApprovalRequest struct {
ID string `json:"id,required"`
Arguments string `json:"arguments,required"`
Name string `json:"name,required"`
@@ -6406,24 +6378,24 @@ type ResponseNewResponseDataOutputMcpApprovalRequest struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseNewResponseDataOutputRole string
+type ResponseListResponseOutputRole string
const (
- ResponseNewResponseDataOutputRoleSystem ResponseNewResponseDataOutputRole = "system"
- ResponseNewResponseDataOutputRoleDeveloper ResponseNewResponseDataOutputRole = "developer"
- ResponseNewResponseDataOutputRoleUser ResponseNewResponseDataOutputRole = "user"
- ResponseNewResponseDataOutputRoleAssistant ResponseNewResponseDataOutputRole = "assistant"
+ ResponseListResponseOutputRoleSystem ResponseListResponseOutputRole = "system"
+ ResponseListResponseOutputRoleDeveloper ResponseListResponseOutputRole = "developer"
+ ResponseListResponseOutputRoleUser ResponseListResponseOutputRole = "user"
+ ResponseListResponseOutputRoleAssistant ResponseListResponseOutputRole = "assistant"
)
// Text formatting configuration for the response
-type ResponseNewResponseDataText struct {
+type ResponseListResponseText struct {
// (Optional) Text format configuration specifying output format requirements
- Format ResponseNewResponseDataTextFormat `json:"format"`
+ Format ResponseListResponseTextFormat `json:"format"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Format respjson.Field
@@ -6433,24 +6405,24 @@ type ResponseNewResponseDataText struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataText) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataText) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseText) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Text format configuration specifying output format requirements
-type ResponseNewResponseDataTextFormat struct {
+type ResponseListResponseTextFormat struct {
// Must be "text", "json_schema", or "json_object" to identify the format type
//
// Any of "text", "json_schema", "json_object".
- Type ResponseNewResponseDataTextFormatType `json:"type,required"`
+ Type ResponseListResponseTextFormatType `json:"type,required"`
// (Optional) A description of the response format. Only used for json_schema.
Description string `json:"description"`
// The name of the response format. Only used for json_schema.
Name string `json:"name"`
// The JSON schema the response should conform to. In a Python SDK, this is often a
// `pydantic` model. Only used for json_schema.
- Schema map[string]ResponseNewResponseDataTextFormatSchemaUnion `json:"schema"`
+ Schema map[string]ResponseListResponseTextFormatSchemaUnion `json:"schema"`
// (Optional) Whether to strictly enforce the JSON schema. If true, the response
// must match the schema exactly. Only used for json_schema.
Strict bool `json:"strict"`
@@ -6467,28 +6439,28 @@ type ResponseNewResponseDataTextFormat struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataTextFormat) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataTextFormat) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseTextFormat) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseTextFormat) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Must be "text", "json_schema", or "json_object" to identify the format type
-type ResponseNewResponseDataTextFormatType string
+type ResponseListResponseTextFormatType string
const (
- ResponseNewResponseDataTextFormatTypeText ResponseNewResponseDataTextFormatType = "text"
- ResponseNewResponseDataTextFormatTypeJsonSchema ResponseNewResponseDataTextFormatType = "json_schema"
- ResponseNewResponseDataTextFormatTypeJsonObject ResponseNewResponseDataTextFormatType = "json_object"
+ ResponseListResponseTextFormatTypeText ResponseListResponseTextFormatType = "text"
+ ResponseListResponseTextFormatTypeJsonSchema ResponseListResponseTextFormatType = "json_schema"
+ ResponseListResponseTextFormatTypeJsonObject ResponseListResponseTextFormatType = "json_object"
)
-// ResponseNewResponseDataTextFormatSchemaUnion contains all possible properties
-// and values from [bool], [float64], [string], [[]any].
+// ResponseListResponseTextFormatSchemaUnion contains all possible properties and
+// values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseNewResponseDataTextFormatSchemaUnion struct {
+type ResponseListResponseTextFormatSchemaUnion struct {
// This field will be present if the value is a [bool] instead of an object.
OfBool bool `json:",inline"`
// This field will be present if the value is a [float64] instead of an object.
@@ -6506,35 +6478,35 @@ type ResponseNewResponseDataTextFormatSchemaUnion struct {
} `json:"-"`
}
-func (u ResponseNewResponseDataTextFormatSchemaUnion) AsBool() (v bool) {
+func (u ResponseListResponseTextFormatSchemaUnion) AsBool() (v bool) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataTextFormatSchemaUnion) AsFloat() (v float64) {
+func (u ResponseListResponseTextFormatSchemaUnion) AsFloat() (v float64) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataTextFormatSchemaUnion) AsString() (v string) {
+func (u ResponseListResponseTextFormatSchemaUnion) AsString() (v string) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
-func (u ResponseNewResponseDataTextFormatSchemaUnion) AsAnyArray() (v []any) {
+func (u ResponseListResponseTextFormatSchemaUnion) AsAnyArray() (v []any) {
apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
return
}
// Returns the unmodified JSON received from the API
-func (u ResponseNewResponseDataTextFormatSchemaUnion) RawJSON() string { return u.JSON.raw }
+func (u ResponseListResponseTextFormatSchemaUnion) RawJSON() string { return u.JSON.raw }
-func (r *ResponseNewResponseDataTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
+func (r *ResponseListResponseTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// (Optional) Error details if the response generation failed
-type ResponseNewResponseDataError struct {
+type ResponseListResponseError struct {
// Error code identifying the type of failure
Code string `json:"code,required"`
// Human-readable error message describing the failure
@@ -6549,234 +6521,349 @@ type ResponseNewResponseDataError struct {
}
// Returns the unmodified JSON received from the API
-func (r ResponseNewResponseDataError) RawJSON() string { return r.JSON.raw }
-func (r *ResponseNewResponseDataError) UnmarshalJSON(data []byte) error {
+func (r ResponseListResponseError) RawJSON() string { return r.JSON.raw }
+func (r *ResponseListResponseError) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// OpenAI response object extended with input context information.
-type ResponseListResponse struct {
- // Unique identifier for this response
+// Response object confirming deletion of an OpenAI response.
+type ResponseDeleteResponse struct {
+ // Unique identifier of the deleted response
ID string `json:"id,required"`
- // Unix timestamp when the response was created
- CreatedAt int64 `json:"created_at,required"`
- // List of input items that led to this response
- Input []ResponseListResponseInputUnion `json:"input,required"`
- // Model identifier used for generation
- Model string `json:"model,required"`
+ // Deletion confirmation flag, always True
+ Deleted bool `json:"deleted,required"`
// Object type identifier, always "response"
Object constant.Response `json:"object,required"`
- // List of generated output items (messages, tool calls, etc.)
- Output []ResponseListResponseOutputUnion `json:"output,required"`
- // Whether tool calls can be executed in parallel
- ParallelToolCalls bool `json:"parallel_tool_calls,required"`
- // Current status of the response generation
- Status string `json:"status,required"`
- // Text formatting configuration for the response
- Text ResponseListResponseText `json:"text,required"`
- // (Optional) Error details if the response generation failed
- Error ResponseListResponseError `json:"error"`
- // (Optional) ID of the previous response in a conversation
- PreviousResponseID string `json:"previous_response_id"`
- // (Optional) Sampling temperature used for generation
- Temperature float64 `json:"temperature"`
- // (Optional) Nucleus sampling parameter used for generation
- TopP float64 `json:"top_p"`
- // (Optional) Truncation strategy applied to the response
- Truncation string `json:"truncation"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ID respjson.Field
- CreatedAt respjson.Field
- Input respjson.Field
- Model respjson.Field
- Object respjson.Field
- Output respjson.Field
- ParallelToolCalls respjson.Field
- Status respjson.Field
- Text respjson.Field
- Error respjson.Field
- PreviousResponseID respjson.Field
- Temperature respjson.Field
- TopP respjson.Field
- Truncation respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ ID respjson.Field
+ Deleted respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r ResponseListResponse) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponse) UnmarshalJSON(data []byte) error {
+func (r ResponseDeleteResponse) RawJSON() string { return r.JSON.raw }
+func (r *ResponseDeleteResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputUnion contains all possible properties and values from
-// [ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall],
-// [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall],
-// [ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall],
-// [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput],
-// [ResponseListResponseInputOpenAIResponseMcpApprovalRequest],
-// [ResponseListResponseInputOpenAIResponseMcpApprovalResponse],
-// [ResponseListResponseInputOpenAIResponseMessage].
+type ResponseNewParams struct {
+ // Input message(s) to create the response.
+ Input ResponseNewParamsInputUnion `json:"input,omitzero,required"`
+ // The underlying LLM used for completions.
+ Model string `json:"model,required"`
+ Instructions param.Opt[string] `json:"instructions,omitzero"`
+ MaxInferIters param.Opt[int64] `json:"max_infer_iters,omitzero"`
+ // (Optional) if specified, the new response will be a continuation of the previous
+ // response. This can be used to easily fork-off new responses from existing
+ // responses.
+ PreviousResponseID param.Opt[string] `json:"previous_response_id,omitzero"`
+ Store param.Opt[bool] `json:"store,omitzero"`
+ Temperature param.Opt[float64] `json:"temperature,omitzero"`
+ // (Optional) Additional fields to include in the response.
+ Include []string `json:"include,omitzero"`
+ // Text response configuration for OpenAI responses.
+ Text ResponseNewParamsText `json:"text,omitzero"`
+ Tools []ResponseNewParamsToolUnion `json:"tools,omitzero"`
+ paramObj
+}
+
+func (r ResponseNewParams) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParams
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParams) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+// Only one field can be non-zero.
//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseInputUnion struct {
- ID string `json:"id"`
- Status string `json:"status"`
- Type string `json:"type"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
- Queries []string `json:"queries"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall].
- Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
- Arguments string `json:"arguments"`
- CallID string `json:"call_id"`
- Name string `json:"name"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput].
- Output string `json:"output"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalRequest].
- ServerLabel string `json:"server_label"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
- ApprovalRequestID string `json:"approval_request_id"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
- Approve bool `json:"approve"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMcpApprovalResponse].
- Reason string `json:"reason"`
- // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
- Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content"`
- // This field is from variant [ResponseListResponseInputOpenAIResponseMessage].
- Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role"`
- JSON struct {
- ID respjson.Field
- Status respjson.Field
- Type respjson.Field
- Queries respjson.Field
- Results respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- Output respjson.Field
- ServerLabel respjson.Field
- ApprovalRequestID respjson.Field
- Approve respjson.Field
- Reason respjson.Field
- Content respjson.Field
- Role respjson.Field
- raw string
- } `json:"-"`
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsInputUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfResponseNewsInputArray []ResponseNewParamsInputArrayItemUnion `json:",omitzero,inline"`
+ paramUnion
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageWebSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u ResponseNewParamsInputUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfResponseNewsInputArray)
+}
+func (u *ResponseNewParamsInputUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFileSearchToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u *ResponseNewParamsInputUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfResponseNewsInputArray) {
+ return &u.OfResponseNewsInputArray
+ }
+ return nil
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseOutputMessageFunctionToolCall() (v ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsInputArrayItemUnion struct {
+ OfOpenAIResponseOutputMessageWebSearchToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall `json:",omitzero,inline"`
+ OfOpenAIResponseOutputMessageFileSearchToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall `json:",omitzero,inline"`
+ OfOpenAIResponseOutputMessageFunctionToolCall *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall `json:",omitzero,inline"`
+ OfOpenAIResponseInputFunctionToolCallOutput *ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput `json:",omitzero,inline"`
+ OfOpenAIResponseMcpApprovalRequest *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest `json:",omitzero,inline"`
+ OfOpenAIResponseMcpApprovalResponse *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse `json:",omitzero,inline"`
+ OfOpenAIResponseMessage *ResponseNewParamsInputArrayItemOpenAIResponseMessage `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsInputArrayItemUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfOpenAIResponseOutputMessageWebSearchToolCall,
+ u.OfOpenAIResponseOutputMessageFileSearchToolCall,
+ u.OfOpenAIResponseOutputMessageFunctionToolCall,
+ u.OfOpenAIResponseInputFunctionToolCallOutput,
+ u.OfOpenAIResponseMcpApprovalRequest,
+ u.OfOpenAIResponseMcpApprovalResponse,
+ u.OfOpenAIResponseMessage)
+}
+func (u *ResponseNewParamsInputArrayItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsInputArrayItemUnion) asAny() any {
+ if !param.IsOmitted(u.OfOpenAIResponseOutputMessageWebSearchToolCall) {
+ return u.OfOpenAIResponseOutputMessageWebSearchToolCall
+ } else if !param.IsOmitted(u.OfOpenAIResponseOutputMessageFileSearchToolCall) {
+ return u.OfOpenAIResponseOutputMessageFileSearchToolCall
+ } else if !param.IsOmitted(u.OfOpenAIResponseOutputMessageFunctionToolCall) {
+ return u.OfOpenAIResponseOutputMessageFunctionToolCall
+ } else if !param.IsOmitted(u.OfOpenAIResponseInputFunctionToolCallOutput) {
+ return u.OfOpenAIResponseInputFunctionToolCallOutput
+ } else if !param.IsOmitted(u.OfOpenAIResponseMcpApprovalRequest) {
+ return u.OfOpenAIResponseMcpApprovalRequest
+ } else if !param.IsOmitted(u.OfOpenAIResponseMcpApprovalResponse) {
+ return u.OfOpenAIResponseMcpApprovalResponse
+ } else if !param.IsOmitted(u.OfOpenAIResponseMessage) {
+ return u.OfOpenAIResponseMessage
+ }
+ return nil
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseInputFunctionToolCallOutput() (v ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetQueries() []string {
+ if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
+ return vt.Queries
+ }
+ return nil
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalRequest() (v ResponseListResponseInputOpenAIResponseMcpApprovalRequest) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetResults() []ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult {
+ if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
+ return vt.Results
+ }
+ return nil
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseMcpApprovalResponse() (v ResponseListResponseInputOpenAIResponseMcpApprovalResponse) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetOutput() *string {
+ if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
+ return &vt.Output
+ }
+ return nil
}
-func (u ResponseListResponseInputUnion) AsOpenAIResponseMessage() (v ResponseListResponseInputOpenAIResponseMessage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetServerLabel() *string {
+ if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return &vt.ServerLabel
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputUnion) RawJSON() string { return u.JSON.raw }
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetApprovalRequestID() *string {
+ if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
+ return &vt.ApprovalRequestID
+ }
+ return nil
+}
-func (r *ResponseListResponseInputUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetApprove() *bool {
+ if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
+ return &vt.Approve
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetReason() *string {
+ if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil && vt.Reason.Valid() {
+ return &vt.Reason.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetContent() *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion {
+ if vt := u.OfOpenAIResponseMessage; vt != nil {
+ return &vt.Content
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetRole() *string {
+ if vt := u.OfOpenAIResponseMessage; vt != nil {
+ return (*string)(&vt.Role)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetID() *string {
+ if vt := u.OfOpenAIResponseOutputMessageWebSearchToolCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.ID)
+ } else if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ } else if vt := u.OfOpenAIResponseMessage; vt != nil && vt.ID.Valid() {
+ return &vt.ID.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetStatus() *string {
+ if vt := u.OfOpenAIResponseOutputMessageWebSearchToolCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
+ return (*string)(&vt.Status)
+ } else if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil && vt.Status.Valid() {
+ return &vt.Status.Value
+ } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil && vt.Status.Valid() {
+ return &vt.Status.Value
+ } else if vt := u.OfOpenAIResponseMessage; vt != nil && vt.Status.Valid() {
+ return &vt.Status.Value
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetType() *string {
+ if vt := u.OfOpenAIResponseOutputMessageWebSearchToolCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseOutputMessageFileSearchToolCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseMcpApprovalResponse; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfOpenAIResponseMessage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetArguments() *string {
+ if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
+ return (*string)(&vt.Arguments)
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Arguments)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetCallID() *string {
+ if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
+ return (*string)(&vt.CallID)
+ } else if vt := u.OfOpenAIResponseInputFunctionToolCallOutput; vt != nil {
+ return (*string)(&vt.CallID)
+ }
+ return nil
+}
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemUnion) GetName() *string {
+ if vt := u.OfOpenAIResponseOutputMessageFunctionToolCall; vt != nil {
+ return (*string)(&vt.Name)
+ } else if vt := u.OfOpenAIResponseMcpApprovalRequest; vt != nil {
+ return (*string)(&vt.Name)
+ }
+ return nil
}
// Web search tool call output message for OpenAI responses.
-type ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall struct {
+//
+// The properties ID, Status, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// Current status of the web search operation
Status string `json:"status,required"`
// Tool call type identifier, always "web_search_call"
+ //
+ // This field can be elided, and will marshal its zero value as "web_search_call".
Type constant.WebSearchCall `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Status respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageWebSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// File search tool call output message for OpenAI responses.
-type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall struct {
+//
+// The properties ID, Queries, Status, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall struct {
// Unique identifier for this tool call
ID string `json:"id,required"`
// List of search queries executed
- Queries []string `json:"queries,required"`
+ Queries []string `json:"queries,omitzero,required"`
// Current status of the file search operation
Status string `json:"status,required"`
+ // (Optional) Search results returned by the file search operation
+ Results []ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results,omitzero"`
// Tool call type identifier, always "file_search_call"
+ //
+ // This field can be elided, and will marshal its zero value as "file_search_call".
Type constant.FileSearchCall `json:"type,required"`
- // (Optional) Search results returned by the file search operation
- Results []ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult `json:"results"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Queries respjson.Field
- Status respjson.Field
- Type respjson.Field
- Results respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Search results returned by the file search operation.
-type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult struct {
+//
+// The properties Attributes, FileID, Filename, Score, Text are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult struct {
// (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,required"`
+ Attributes map[string]ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion `json:"attributes,omitzero,required"`
// Unique identifier of the file containing the result
FileID string `json:"file_id,required"`
// Name of the file containing the result
@@ -6785,568 +6872,470 @@ type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResul
Score float64 `json:"score,required"`
// Text content of the search result
Text string `json:"text,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Attributes respjson.Field
- FileID respjson.Field
- Filename respjson.Field
- Score respjson.Field
- Text respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResult) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion
-// contains all possible properties and values from [bool], [float64], [string],
-// [[]any].
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
+// Only one field can be non-zero.
//
-// If the underlying value is not a json object, one of the following properties
-// will be valid: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) RawJSON() string {
- return u.JSON.raw
-}
-
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFileSearchToolCallResultAttributeUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
}
// Function tool call output message for OpenAI responses.
-type ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall struct {
+//
+// The properties Arguments, CallID, Name, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall struct {
// JSON string containing the function arguments
Arguments string `json:"arguments,required"`
// Unique identifier for the function call
CallID string `json:"call_id,required"`
// Name of the function being called
Name string `json:"name,required"`
- // Tool call type identifier, always "function_call"
- Type constant.FunctionCall `json:"type,required"`
// (Optional) Additional identifier for the tool call
- ID string `json:"id"`
+ ID param.Opt[string] `json:"id,omitzero"`
// (Optional) Current status of the function call execution
- Status string `json:"status"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ Status param.Opt[string] `json:"status,omitzero"`
+ // Tool call type identifier, always "function_call"
+ //
+ // This field can be elided, and will marshal its zero value as "function_call".
+ Type constant.FunctionCall `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseOutputMessageFunctionToolCall) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// This represents the output of a function call that gets passed back to the
// model.
-type ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput struct {
- CallID string `json:"call_id,required"`
- Output string `json:"output,required"`
- Type constant.FunctionCallOutput `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- CallID respjson.Field
- Output respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+//
+// The properties CallID, Output, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput struct {
+ CallID string `json:"call_id,required"`
+ Output string `json:"output,required"`
+ ID param.Opt[string] `json:"id,omitzero"`
+ Status param.Opt[string] `json:"status,omitzero"`
+ // This field can be elided, and will marshal its zero value as
+ // "function_call_output".
+ Type constant.FunctionCallOutput `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseInputFunctionToolCallOutput) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A request for human approval of a tool invocation.
-type ResponseListResponseInputOpenAIResponseMcpApprovalRequest struct {
- ID string `json:"id,required"`
- Arguments string `json:"arguments,required"`
- Name string `json:"name,required"`
- ServerLabel string `json:"server_label,required"`
- Type constant.McpApprovalRequest `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Arguments respjson.Field
- Name respjson.Field
- ServerLabel respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+//
+// The properties ID, Arguments, Name, ServerLabel, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest struct {
+ ID string `json:"id,required"`
+ Arguments string `json:"arguments,required"`
+ Name string `json:"name,required"`
+ ServerLabel string `json:"server_label,required"`
+ // This field can be elided, and will marshal its zero value as
+ // "mcp_approval_request".
+ Type constant.McpApprovalRequest `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMcpApprovalRequest) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalRequest) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// A response to an MCP approval request.
-type ResponseListResponseInputOpenAIResponseMcpApprovalResponse struct {
- ApprovalRequestID string `json:"approval_request_id,required"`
- Approve bool `json:"approve,required"`
- Type constant.McpApprovalResponse `json:"type,required"`
- ID string `json:"id"`
- Reason string `json:"reason"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ApprovalRequestID respjson.Field
- Approve respjson.Field
- Type respjson.Field
- ID respjson.Field
- Reason respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+//
+// The properties ApprovalRequestID, Approve, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse struct {
+ ApprovalRequestID string `json:"approval_request_id,required"`
+ Approve bool `json:"approve,required"`
+ ID param.Opt[string] `json:"id,omitzero"`
+ Reason param.Opt[string] `json:"reason,omitzero"`
+ // This field can be elided, and will marshal its zero value as
+ // "mcp_approval_response".
+ Type constant.McpApprovalResponse `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMcpApprovalResponse) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMcpApprovalResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Corresponds to the various Message types in the Responses API. They are all
// under one type because the Responses API gives them all the same "type" value,
// and there is no way to tell them apart in certain scenarios.
-type ResponseListResponseInputOpenAIResponseMessage struct {
- Content ResponseListResponseInputOpenAIResponseMessageContentUnion `json:"content,required"`
+//
+// The properties Content, Role, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessage struct {
+ Content ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion `json:"content,omitzero,required"`
// Any of "system", "developer", "user", "assistant".
- Role ResponseListResponseInputOpenAIResponseMessageRole `json:"role,required"`
- Type constant.Message `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Content respjson.Field
- Role respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ Role ResponseNewParamsInputArrayItemOpenAIResponseMessageRole `json:"role,omitzero,required"`
+ ID param.Opt[string] `json:"id,omitzero"`
+ Status param.Opt[string] `json:"status,omitzero"`
+ // This field can be elided, and will marshal its zero value as "message".
+ Type constant.Message `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessage) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseInputOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessage) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessage
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseMessageContentUnion contains all possible
-// properties and values from [string],
-// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion],
-// [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem].
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
+// Only one field can be non-zero.
//
-// If the underlying value is not a json object, one of the following properties
-// will be valid: OfString
-// OfResponseListResponseInputOpenAIResponseMessageContentArray OfVariant2]
-type ResponseListResponseInputOpenAIResponseMessageContentUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a
- // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] instead
- // of an object.
- OfResponseListResponseInputOpenAIResponseMessageContentArray []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion `json:",inline"`
- // This field will be present if the value is a
- // [[]ResponseListResponseInputOpenAIResponseMessageContentArrayItem] instead of an
- // object.
- OfVariant2 []ResponseListResponseInputOpenAIResponseMessageContentArrayItem `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfResponseListResponseInputOpenAIResponseMessageContentArray respjson.Field
- OfVariant2 respjson.Field
- raw string
- } `json:"-"`
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion struct {
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray []ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion `json:",omitzero,inline"`
+ OfVariant2 []ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem `json:",omitzero,inline"`
+ paramUnion
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfString, u.OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray, u.OfVariant2)
}
-
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsResponseListResponseInputOpenAIResponseMessageContentArray() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) AsVariant2() (v []ResponseListResponseInputOpenAIResponseMessageContentArrayItem) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentUnion) asAny() any {
+ if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray) {
+ return &u.OfResponseNewsInputArrayItemOpenAIResponseMessageContentArray
+ } else if !param.IsOmitted(u.OfVariant2) {
+ return &u.OfVariant2
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseMessageContentUnion) RawJSON() string {
- return u.JSON.raw
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion struct {
+ OfInputText *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText `json:",omitzero,inline"`
+ OfInputImage *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage `json:",omitzero,inline"`
+ paramUnion
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfInputText, u.OfInputImage)
}
-
-// ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion contains all
-// possible properties and values from
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
-//
-// Use the
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
-// method to switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion struct {
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText].
- Text string `json:"text"`
- // Any of "input_text", "input_image".
- Type string `json:"type"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
- Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage].
- ImageURL string `json:"image_url"`
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- ImageURL respjson.Field
- raw string
- } `json:"-"`
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
}
-// anyResponseListResponseInputOpenAIResponseMessageContentArrayItem is implemented
-// by each variant of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion] to add
-// type safety for the return type of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny]
-type anyResponseListResponseInputOpenAIResponseMessageContentArrayItem interface {
- implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion()
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) asAny() any {
+ if !param.IsOmitted(u.OfInputText) {
+ return u.OfInputText
+ } else if !param.IsOmitted(u.OfInputImage) {
+ return u.OfInputImage
+ }
+ return nil
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
-}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) implResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion() {
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetText() *string {
+ if vt := u.OfInputText; vt != nil {
+ return &vt.Text
+ }
+ return nil
}
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItem {
- switch u.Type {
- case "input_text":
- return u.AsInputText()
- case "input_image":
- return u.AsInputImage()
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetDetail() *string {
+ if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Detail)
}
return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetImageURL() *string {
+ if vt := u.OfInputImage; vt != nil && vt.ImageURL.Valid() {
+ return &vt.ImageURL.Value
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) RawJSON() string {
- return u.JSON.raw
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion) GetType() *string {
+ if vt := u.OfInputText; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfInputImage; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func init() {
+ apijson.RegisterUnion[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemUnion](
+ "type",
+ apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText]("input_text"),
+ apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage]("input_image"),
+ )
}
// Text content for input messages in OpenAI response format.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText struct {
+//
+// The properties Text, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText struct {
// The text content of the input message
Text string `json:"text,required"`
// Content type identifier, always "input_text"
+ //
+ // This field can be elided, and will marshal its zero value as "input_text".
Type constant.InputText `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Image content for input messages in OpenAI response format.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage struct {
+//
+// The properties Detail, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage struct {
// Level of detail for image processing, can be "low", "high", or "auto"
//
// Any of "low", "high", "auto".
- Detail ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,required"`
+ Detail ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail `json:"detail,omitzero,required"`
+ // (Optional) URL of the image content
+ ImageURL param.Opt[string] `json:"image_url,omitzero"`
// Content type identifier, always "input_image"
+ //
+ // This field can be elided, and will marshal its zero value as "input_image".
Type constant.InputImage `json:"type,required"`
- // (Optional) URL of the image content
- ImageURL string `json:"image_url"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Detail respjson.Field
- Type respjson.Field
- ImageURL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail string
-
-const (
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
-)
-
-// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail string
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail string
const (
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailLow ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "low"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailHigh ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "high"
- ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetailAuto ResponseListResponseInputOpenAIResponseMessageContentArrayItemDetail = "auto"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetailLow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail = "low"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetailHigh ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail = "high"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetailAuto ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemInputImageDetail = "auto"
)
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItem struct {
- Annotations []ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
- Text string `json:"text,required"`
- Type constant.OutputText `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Annotations respjson.Field
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// The properties Annotations, Text, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem struct {
+ Annotations []ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion `json:"annotations,omitzero,required"`
+ Text string `json:"text,required"`
+ // This field can be elided, and will marshal its zero value as "output_text".
+ Type constant.OutputText `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItem) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItem) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion
-// contains all possible properties and values from
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation],
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath].
-//
-// Use the
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
-// method to switch on the variant.
+// Only one field can be non-zero.
//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
- FileID string `json:"file_id"`
- Filename string `json:"filename"`
- Index int64 `json:"index"`
- // Any of "file_citation", "url_citation", "container_file_citation", "file_path".
- Type string `json:"type"`
- EndIndex int64 `json:"end_index"`
- StartIndex int64 `json:"start_index"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
- Title string `json:"title"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation].
- URL string `json:"url"`
- // This field is from variant
- // [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation].
- ContainerID string `json:"container_id"`
- JSON struct {
- FileID respjson.Field
- Filename respjson.Field
- Index respjson.Field
- Type respjson.Field
- EndIndex respjson.Field
- StartIndex respjson.Field
- Title respjson.Field
- URL respjson.Field
- ContainerID respjson.Field
- raw string
- } `json:"-"`
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion struct {
+ OfFileCitation *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation `json:",omitzero,inline"`
+ OfURLCitation *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation `json:",omitzero,inline"`
+ OfContainerFileCitation *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation `json:",omitzero,inline"`
+ OfFilePath *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfFileCitation, u.OfURLCitation, u.OfContainerFileCitation, u.OfFilePath)
+}
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) asAny() any {
+ if !param.IsOmitted(u.OfFileCitation) {
+ return u.OfFileCitation
+ } else if !param.IsOmitted(u.OfURLCitation) {
+ return u.OfURLCitation
+ } else if !param.IsOmitted(u.OfContainerFileCitation) {
+ return u.OfContainerFileCitation
+ } else if !param.IsOmitted(u.OfFilePath) {
+ return u.OfFilePath
+ }
+ return nil
}
-// anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation is
-// implemented by each variant of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion]
-// to add type safety for the return type of
-// [ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny]
-type anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation interface {
- implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion()
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetTitle() *string {
+ if vt := u.OfURLCitation; vt != nil {
+ return &vt.Title
+ }
+ return nil
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
-}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
-}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetURL() *string {
+ if vt := u.OfURLCitation; vt != nil {
+ return &vt.URL
+ }
+ return nil
}
-func (ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) implResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion() {
+
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetContainerID() *string {
+ if vt := u.OfContainerFileCitation; vt != nil {
+ return &vt.ContainerID
+ }
+ return nil
}
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation:
-// case llamastackclient.ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotation {
- switch u.Type {
- case "file_citation":
- return u.AsFileCitation()
- case "url_citation":
- return u.AsURLCitation()
- case "container_file_citation":
- return u.AsContainerFileCitation()
- case "file_path":
- return u.AsFilePath()
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetFileID() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.FileID)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.FileID)
+ } else if vt := u.OfFilePath; vt != nil {
+ return (*string)(&vt.FileID)
}
return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetFilename() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.Filename)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.Filename)
+ }
+ return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetIndex() *int64 {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*int64)(&vt.Index)
+ } else if vt := u.OfFilePath; vt != nil {
+ return (*int64)(&vt.Index)
+ }
+ return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetType() *string {
+ if vt := u.OfFileCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfURLCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFilePath; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
}
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetEndIndex() *int64 {
+ if vt := u.OfURLCitation; vt != nil {
+ return (*int64)(&vt.EndIndex)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*int64)(&vt.EndIndex)
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) RawJSON() string {
- return u.JSON.raw
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion) GetStartIndex() *int64 {
+ if vt := u.OfURLCitation; vt != nil {
+ return (*int64)(&vt.StartIndex)
+ } else if vt := u.OfContainerFileCitation; vt != nil {
+ return (*int64)(&vt.StartIndex)
+ }
+ return nil
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func init() {
+ apijson.RegisterUnion[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationUnion](
+ "type",
+ apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation]("file_citation"),
+ apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation]("url_citation"),
+ apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation]("container_file_citation"),
+ apijson.Discriminator[ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath]("file_path"),
+ )
}
// File citation annotation for referencing specific files in response content.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
+//
+// The properties FileID, Filename, Index, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation struct {
// Unique identifier of the referenced file
FileID string `json:"file_id,required"`
// Name of the referenced file
@@ -7354,1280 +7343,661 @@ type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFil
// Position index of the citation within the content
Index int64 `json:"index,required"`
// Annotation type identifier, always "file_citation"
+ //
+ // This field can be elided, and will marshal its zero value as "file_citation".
Type constant.FileCitation `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- FileID respjson.Field
- Filename respjson.Field
- Index respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
// URL citation annotation for referencing external web resources.
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
+//
+// The properties EndIndex, StartIndex, Title, Type, URL are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation struct {
// End position of the citation span in the content
EndIndex int64 `json:"end_index,required"`
// Start position of the citation span in the content
StartIndex int64 `json:"start_index,required"`
// Title of the referenced web resource
Title string `json:"title,required"`
- // Annotation type identifier, always "url_citation"
- Type constant.URLCitation `json:"type,required"`
// URL of the referenced web resource
URL string `json:"url,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EndIndex respjson.Field
- StartIndex respjson.Field
- Title respjson.Field
- Type respjson.Field
- URL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+ // Annotation type identifier, always "url_citation"
+ //
+ // This field can be elided, and will marshal its zero value as "url_citation".
+ Type constant.URLCitation `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
- ContainerID string `json:"container_id,required"`
- EndIndex int64 `json:"end_index,required"`
- FileID string `json:"file_id,required"`
- Filename string `json:"filename,required"`
- StartIndex int64 `json:"start_index,required"`
- Type constant.ContainerFileCitation `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ContainerID respjson.Field
- EndIndex respjson.Field
- FileID respjson.Field
- Filename respjson.Field
- StartIndex respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// The properties ContainerID, EndIndex, FileID, Filename, StartIndex, Type are
+// required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation struct {
+ ContainerID string `json:"container_id,required"`
+ EndIndex int64 `json:"end_index,required"`
+ FileID string `json:"file_id,required"`
+ Filename string `json:"filename,required"`
+ StartIndex int64 `json:"start_index,required"`
+ // This field can be elided, and will marshal its zero value as
+ // "container_file_citation".
+ Type constant.ContainerFileCitation `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
- FileID string `json:"file_id,required"`
- Index int64 `json:"index,required"`
- Type constant.FilePath `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- FileID respjson.Field
- Index respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// The properties FileID, Index, Type are required.
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath struct {
+ FileID string `json:"file_id,required"`
+ Index int64 `json:"index,required"`
+ // This field can be elided, and will marshal its zero value as "file_path".
+ Type constant.FilePath `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) RawJSON() string {
- return r.JSON.raw
+func (r ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath
+ return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseListResponseInputOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsInputArrayItemOpenAIResponseMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseInputOpenAIResponseMessageRole string
+type ResponseNewParamsInputArrayItemOpenAIResponseMessageRole string
const (
- ResponseListResponseInputOpenAIResponseMessageRoleSystem ResponseListResponseInputOpenAIResponseMessageRole = "system"
- ResponseListResponseInputOpenAIResponseMessageRoleDeveloper ResponseListResponseInputOpenAIResponseMessageRole = "developer"
- ResponseListResponseInputOpenAIResponseMessageRoleUser ResponseListResponseInputOpenAIResponseMessageRole = "user"
- ResponseListResponseInputOpenAIResponseMessageRoleAssistant ResponseListResponseInputOpenAIResponseMessageRole = "assistant"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleSystem ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "system"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleDeveloper ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "developer"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleUser ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "user"
+ ResponseNewParamsInputArrayItemOpenAIResponseMessageRoleAssistant ResponseNewParamsInputArrayItemOpenAIResponseMessageRole = "assistant"
)
-type ResponseListResponseInputRole string
+// Text response configuration for OpenAI responses.
+type ResponseNewParamsText struct {
+ // (Optional) Text format configuration specifying output format requirements
+ Format ResponseNewParamsTextFormat `json:"format,omitzero"`
+ paramObj
+}
-const (
- ResponseListResponseInputRoleSystem ResponseListResponseInputRole = "system"
- ResponseListResponseInputRoleDeveloper ResponseListResponseInputRole = "developer"
- ResponseListResponseInputRoleUser ResponseListResponseInputRole = "user"
- ResponseListResponseInputRoleAssistant ResponseListResponseInputRole = "assistant"
-)
+func (r ResponseNewParamsText) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsText
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsText) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
-// ResponseListResponseOutputUnion contains all possible properties and values from
-// [ResponseListResponseOutputMessage], [ResponseListResponseOutputWebSearchCall],
-// [ResponseListResponseOutputFileSearchCall],
-// [ResponseListResponseOutputFunctionCall], [ResponseListResponseOutputMcpCall],
-// [ResponseListResponseOutputMcpListTools],
-// [ResponseListResponseOutputMcpApprovalRequest].
-//
-// Use the [ResponseListResponseOutputUnion.AsAny] method to switch on the variant.
+// (Optional) Text format configuration specifying output format requirements
//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseOutputUnion struct {
- // This field is from variant [ResponseListResponseOutputMessage].
- Content ResponseListResponseOutputMessageContentUnion `json:"content"`
- // This field is from variant [ResponseListResponseOutputMessage].
- Role ResponseListResponseOutputMessageRole `json:"role"`
- // Any of "message", "web_search_call", "file_search_call", "function_call",
- // "mcp_call", "mcp_list_tools", "mcp_approval_request".
- Type string `json:"type"`
- ID string `json:"id"`
- Status string `json:"status"`
- // This field is from variant [ResponseListResponseOutputFileSearchCall].
- Queries []string `json:"queries"`
- // This field is from variant [ResponseListResponseOutputFileSearchCall].
- Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
- Arguments string `json:"arguments"`
- // This field is from variant [ResponseListResponseOutputFunctionCall].
- CallID string `json:"call_id"`
- Name string `json:"name"`
- ServerLabel string `json:"server_label"`
- // This field is from variant [ResponseListResponseOutputMcpCall].
- Error string `json:"error"`
- // This field is from variant [ResponseListResponseOutputMcpCall].
- Output string `json:"output"`
- // This field is from variant [ResponseListResponseOutputMcpListTools].
- Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools"`
- JSON struct {
- Content respjson.Field
- Role respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
- Queries respjson.Field
- Results respjson.Field
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- ServerLabel respjson.Field
- Error respjson.Field
- Output respjson.Field
- Tools respjson.Field
- raw string
- } `json:"-"`
+// The property Type is required.
+type ResponseNewParamsTextFormat struct {
+ // Must be "text", "json_schema", or "json_object" to identify the format type
+ //
+ // Any of "text", "json_schema", "json_object".
+ Type ResponseNewParamsTextFormatType `json:"type,omitzero,required"`
+ // (Optional) A description of the response format. Only used for json_schema.
+ Description param.Opt[string] `json:"description,omitzero"`
+ // The name of the response format. Only used for json_schema.
+ Name param.Opt[string] `json:"name,omitzero"`
+ // (Optional) Whether to strictly enforce the JSON schema. If true, the response
+ // must match the schema exactly. Only used for json_schema.
+ Strict param.Opt[bool] `json:"strict,omitzero"`
+ // The JSON schema the response should conform to. In a Python SDK, this is often a
+ // `pydantic` model. Only used for json_schema.
+ Schema map[string]ResponseNewParamsTextFormatSchemaUnion `json:"schema,omitzero"`
+ paramObj
}
-// anyResponseListResponseOutput is implemented by each variant of
-// [ResponseListResponseOutputUnion] to add type safety for the return type of
-// [ResponseListResponseOutputUnion.AsAny]
-type anyResponseListResponseOutput interface {
- implResponseListResponseOutputUnion()
+func (r ResponseNewParamsTextFormat) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsTextFormat
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsTextFormat) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func (ResponseListResponseOutputMessage) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputWebSearchCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputFileSearchCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputFunctionCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpCall) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpListTools) implResponseListResponseOutputUnion() {}
-func (ResponseListResponseOutputMcpApprovalRequest) implResponseListResponseOutputUnion() {}
+// Must be "text", "json_schema", or "json_object" to identify the format type
+type ResponseNewParamsTextFormatType string
-// Use the following switch statement to find the correct variant
+const (
+ ResponseNewParamsTextFormatTypeText ResponseNewParamsTextFormatType = "text"
+ ResponseNewParamsTextFormatTypeJsonSchema ResponseNewParamsTextFormatType = "json_schema"
+ ResponseNewParamsTextFormatTypeJsonObject ResponseNewParamsTextFormatType = "json_object"
+)
+
+// Only one field can be non-zero.
//
-// switch variant := ResponseListResponseOutputUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseOutputMessage:
-// case llamastackclient.ResponseListResponseOutputWebSearchCall:
-// case llamastackclient.ResponseListResponseOutputFileSearchCall:
-// case llamastackclient.ResponseListResponseOutputFunctionCall:
-// case llamastackclient.ResponseListResponseOutputMcpCall:
-// case llamastackclient.ResponseListResponseOutputMcpListTools:
-// case llamastackclient.ResponseListResponseOutputMcpApprovalRequest:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ResponseListResponseOutputUnion) AsAny() anyResponseListResponseOutput {
- switch u.Type {
- case "message":
- return u.AsMessage()
- case "web_search_call":
- return u.AsWebSearchCall()
- case "file_search_call":
- return u.AsFileSearchCall()
- case "function_call":
- return u.AsFunctionCall()
- case "mcp_call":
- return u.AsMcpCall()
- case "mcp_list_tools":
- return u.AsMcpListTools()
- case "mcp_approval_request":
- return u.AsMcpApprovalRequest()
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsTextFormatSchemaUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsTextFormatSchemaUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ResponseNewParamsTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsTextFormatSchemaUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
}
return nil
}
-func (u ResponseListResponseOutputUnion) AsMessage() (v ResponseListResponseOutputMessage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputUnion) AsWebSearchCall() (v ResponseListResponseOutputWebSearchCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputUnion) AsFileSearchCall() (v ResponseListResponseOutputFileSearchCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsToolUnion struct {
+ OfOpenAIResponseInputToolWebSearch *ResponseNewParamsToolOpenAIResponseInputToolWebSearch `json:",omitzero,inline"`
+ OfFileSearch *ResponseNewParamsToolFileSearch `json:",omitzero,inline"`
+ OfFunction *ResponseNewParamsToolFunction `json:",omitzero,inline"`
+ OfMcp *ResponseNewParamsToolMcp `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsToolUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfOpenAIResponseInputToolWebSearch, u.OfFileSearch, u.OfFunction, u.OfMcp)
+}
+func (u *ResponseNewParamsToolUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsToolUnion) asAny() any {
+ if !param.IsOmitted(u.OfOpenAIResponseInputToolWebSearch) {
+ return u.OfOpenAIResponseInputToolWebSearch
+ } else if !param.IsOmitted(u.OfFileSearch) {
+ return u.OfFileSearch
+ } else if !param.IsOmitted(u.OfFunction) {
+ return u.OfFunction
+ } else if !param.IsOmitted(u.OfMcp) {
+ return u.OfMcp
+ }
+ return nil
}
-func (u ResponseListResponseOutputUnion) AsFunctionCall() (v ResponseListResponseOutputFunctionCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetSearchContextSize() *string {
+ if vt := u.OfOpenAIResponseInputToolWebSearch; vt != nil && vt.SearchContextSize.Valid() {
+ return &vt.SearchContextSize.Value
+ }
+ return nil
}
-func (u ResponseListResponseOutputUnion) AsMcpCall() (v ResponseListResponseOutputMcpCall) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetVectorStoreIDs() []string {
+ if vt := u.OfFileSearch; vt != nil {
+ return vt.VectorStoreIDs
+ }
+ return nil
}
-func (u ResponseListResponseOutputUnion) AsMcpListTools() (v ResponseListResponseOutputMcpListTools) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetFilters() map[string]ResponseNewParamsToolFileSearchFilterUnion {
+ if vt := u.OfFileSearch; vt != nil {
+ return vt.Filters
+ }
+ return nil
}
-func (u ResponseListResponseOutputUnion) AsMcpApprovalRequest() (v ResponseListResponseOutputMcpApprovalRequest) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetMaxNumResults() *int64 {
+ if vt := u.OfFileSearch; vt != nil && vt.MaxNumResults.Valid() {
+ return &vt.MaxNumResults.Value
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ResponseListResponseOutputUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetRankingOptions() *ResponseNewParamsToolFileSearchRankingOptions {
+ if vt := u.OfFileSearch; vt != nil {
+ return &vt.RankingOptions
+ }
+ return nil
}
-// Corresponds to the various Message types in the Responses API. They are all
-// under one type because the Responses API gives them all the same "type" value,
-// and there is no way to tell them apart in certain scenarios.
-type ResponseListResponseOutputMessage struct {
- Content ResponseListResponseOutputMessageContentUnion `json:"content,required"`
- // Any of "system", "developer", "user", "assistant".
- Role ResponseListResponseOutputMessageRole `json:"role,required"`
- Type constant.Message `json:"type,required"`
- ID string `json:"id"`
- Status string `json:"status"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Content respjson.Field
- Role respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetName() *string {
+ if vt := u.OfFunction; vt != nil {
+ return &vt.Name
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessage) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMessage) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetDescription() *string {
+ if vt := u.OfFunction; vt != nil && vt.Description.Valid() {
+ return &vt.Description.Value
+ }
+ return nil
}
-// ResponseListResponseOutputMessageContentUnion contains all possible properties
-// and values from [string],
-// [[]ResponseListResponseOutputMessageContentArrayItemUnion],
-// [[]ResponseListResponseOutputMessageContentArrayItem].
-//
-// 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: OfString OfResponseListResponseOutputMessageContentArray
-// OfVariant2]
-type ResponseListResponseOutputMessageContentUnion struct {
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a
- // [[]ResponseListResponseOutputMessageContentArrayItemUnion] instead of an object.
- OfResponseListResponseOutputMessageContentArray []ResponseListResponseOutputMessageContentArrayItemUnion `json:",inline"`
- // This field will be present if the value is a
- // [[]ResponseListResponseOutputMessageContentArrayItem] instead of an object.
- OfVariant2 []ResponseListResponseOutputMessageContentArrayItem `json:",inline"`
- JSON struct {
- OfString respjson.Field
- OfResponseListResponseOutputMessageContentArray respjson.Field
- OfVariant2 respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ResponseListResponseOutputMessageContentUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputMessageContentUnion) AsResponseListResponseOutputMessageContentArray() (v []ResponseListResponseOutputMessageContentArrayItemUnion) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputMessageContentUnion) AsVariant2() (v []ResponseListResponseOutputMessageContentArrayItem) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMessageContentUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ResponseListResponseOutputMessageContentUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ResponseListResponseOutputMessageContentArrayItemUnion contains all possible
-// properties and values from
-// [ResponseListResponseOutputMessageContentArrayItemInputText],
-// [ResponseListResponseOutputMessageContentArrayItemInputImage].
-//
-// Use the [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny] method to
-// switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseOutputMessageContentArrayItemUnion struct {
- // This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemInputText].
- Text string `json:"text"`
- // Any of "input_text", "input_image".
- Type string `json:"type"`
- // This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemInputImage].
- Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail"`
- // This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemInputImage].
- ImageURL string `json:"image_url"`
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- Detail respjson.Field
- ImageURL respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyResponseListResponseOutputMessageContentArrayItem is implemented by each
-// variant of [ResponseListResponseOutputMessageContentArrayItemUnion] to add type
-// safety for the return type of
-// [ResponseListResponseOutputMessageContentArrayItemUnion.AsAny]
-type anyResponseListResponseOutputMessageContentArrayItem interface {
- implResponseListResponseOutputMessageContentArrayItemUnion()
-}
-
-func (ResponseListResponseOutputMessageContentArrayItemInputText) implResponseListResponseOutputMessageContentArrayItemUnion() {
-}
-func (ResponseListResponseOutputMessageContentArrayItemInputImage) implResponseListResponseOutputMessageContentArrayItemUnion() {
-}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ResponseListResponseOutputMessageContentArrayItemUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputText:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemInputImage:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItem {
- switch u.Type {
- case "input_text":
- return u.AsInputText()
- case "input_image":
- return u.AsInputImage()
- }
- return nil
-}
-
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputText() (v ResponseListResponseOutputMessageContentArrayItemInputText) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) AsInputImage() (v ResponseListResponseOutputMessageContentArrayItemInputImage) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMessageContentArrayItemUnion) RawJSON() string { return u.JSON.raw }
-
-func (r *ResponseListResponseOutputMessageContentArrayItemUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Text content for input messages in OpenAI response format.
-type ResponseListResponseOutputMessageContentArrayItemInputText struct {
- // The text content of the input message
- Text string `json:"text,required"`
- // Content type identifier, always "input_text"
- Type constant.InputText `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemInputText) RawJSON() string {
- return r.JSON.raw
-}
-func (r *ResponseListResponseOutputMessageContentArrayItemInputText) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Image content for input messages in OpenAI response format.
-type ResponseListResponseOutputMessageContentArrayItemInputImage struct {
- // Level of detail for image processing, can be "low", "high", or "auto"
- //
- // Any of "low", "high", "auto".
- Detail ResponseListResponseOutputMessageContentArrayItemInputImageDetail `json:"detail,required"`
- // Content type identifier, always "input_image"
- Type constant.InputImage `json:"type,required"`
- // (Optional) URL of the image content
- ImageURL string `json:"image_url"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Detail respjson.Field
- Type respjson.Field
- ImageURL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemInputImage) RawJSON() string {
- return r.JSON.raw
-}
-func (r *ResponseListResponseOutputMessageContentArrayItemInputImage) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseOutputMessageContentArrayItemInputImageDetail string
-
-const (
- ResponseListResponseOutputMessageContentArrayItemInputImageDetailLow ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "low"
- ResponseListResponseOutputMessageContentArrayItemInputImageDetailHigh ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "high"
- ResponseListResponseOutputMessageContentArrayItemInputImageDetailAuto ResponseListResponseOutputMessageContentArrayItemInputImageDetail = "auto"
-)
-
-// Level of detail for image processing, can be "low", "high", or "auto"
-type ResponseListResponseOutputMessageContentArrayItemDetail string
-
-const (
- ResponseListResponseOutputMessageContentArrayItemDetailLow ResponseListResponseOutputMessageContentArrayItemDetail = "low"
- ResponseListResponseOutputMessageContentArrayItemDetailHigh ResponseListResponseOutputMessageContentArrayItemDetail = "high"
- ResponseListResponseOutputMessageContentArrayItemDetailAuto ResponseListResponseOutputMessageContentArrayItemDetail = "auto"
-)
-
-type ResponseListResponseOutputMessageContentArrayItem struct {
- Annotations []ResponseListResponseOutputMessageContentArrayItemAnnotationUnion `json:"annotations,required"`
- Text string `json:"text,required"`
- Type constant.OutputText `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Annotations respjson.Field
- Text respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItem) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMessageContentArrayItem) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ResponseListResponseOutputMessageContentArrayItemAnnotationUnion contains all
-// possible properties and values from
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation],
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation],
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation],
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath].
-//
-// Use the [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
-// method to switch on the variant.
-//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
-type ResponseListResponseOutputMessageContentArrayItemAnnotationUnion struct {
- FileID string `json:"file_id"`
- Filename string `json:"filename"`
- Index int64 `json:"index"`
- // Any of "file_citation", "url_citation", "container_file_citation", "file_path".
- Type string `json:"type"`
- EndIndex int64 `json:"end_index"`
- StartIndex int64 `json:"start_index"`
- // This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
- Title string `json:"title"`
- // This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation].
- URL string `json:"url"`
- // This field is from variant
- // [ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation].
- ContainerID string `json:"container_id"`
- JSON struct {
- FileID respjson.Field
- Filename respjson.Field
- Index respjson.Field
- Type respjson.Field
- EndIndex respjson.Field
- StartIndex respjson.Field
- Title respjson.Field
- URL respjson.Field
- ContainerID respjson.Field
- raw string
- } `json:"-"`
-}
-
-// anyResponseListResponseOutputMessageContentArrayItemAnnotation is implemented by
-// each variant of
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion] to add type
-// safety for the return type of
-// [ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny]
-type anyResponseListResponseOutputMessageContentArrayItemAnnotation interface {
- implResponseListResponseOutputMessageContentArrayItemAnnotationUnion()
-}
-
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
-}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
-}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
-}
-func (ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) implResponseListResponseOutputMessageContentArrayItemAnnotationUnion() {
-}
-
-// Use the following switch statement to find the correct variant
-//
-// switch variant := ResponseListResponseOutputMessageContentArrayItemAnnotationUnion.AsAny().(type) {
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation:
-// case llamastackclient.ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath:
-// default:
-// fmt.Errorf("no variant present")
-// }
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsAny() anyResponseListResponseOutputMessageContentArrayItemAnnotation {
- switch u.Type {
- case "file_citation":
- return u.AsFileCitation()
- case "url_citation":
- return u.AsURLCitation()
- case "container_file_citation":
- return u.AsContainerFileCitation()
- case "file_path":
- return u.AsFilePath()
- }
- return nil
-}
-
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsURLCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsContainerFileCitation() (v ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) AsFilePath() (v ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) RawJSON() string {
- return u.JSON.raw
-}
-
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// File citation annotation for referencing specific files in response content.
-type ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation struct {
- // Unique identifier of the referenced file
- FileID string `json:"file_id,required"`
- // Name of the referenced file
- Filename string `json:"filename,required"`
- // Position index of the citation within the content
- Index int64 `json:"index,required"`
- // Annotation type identifier, always "file_citation"
- Type constant.FileCitation `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- FileID respjson.Field
- Filename respjson.Field
- Index respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) RawJSON() string {
- return r.JSON.raw
-}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFileCitation) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// URL citation annotation for referencing external web resources.
-type ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation struct {
- // End position of the citation span in the content
- EndIndex int64 `json:"end_index,required"`
- // Start position of the citation span in the content
- StartIndex int64 `json:"start_index,required"`
- // Title of the referenced web resource
- Title string `json:"title,required"`
- // Annotation type identifier, always "url_citation"
- Type constant.URLCitation `json:"type,required"`
- // URL of the referenced web resource
- URL string `json:"url,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- EndIndex respjson.Field
- StartIndex respjson.Field
- Title respjson.Field
- Type respjson.Field
- URL respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) RawJSON() string {
- return r.JSON.raw
-}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationURLCitation) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation struct {
- ContainerID string `json:"container_id,required"`
- EndIndex int64 `json:"end_index,required"`
- FileID string `json:"file_id,required"`
- Filename string `json:"filename,required"`
- StartIndex int64 `json:"start_index,required"`
- Type constant.ContainerFileCitation `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ContainerID respjson.Field
- EndIndex respjson.Field
- FileID respjson.Field
- Filename respjson.Field
- StartIndex respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) RawJSON() string {
- return r.JSON.raw
-}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationContainerFileCitation) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath struct {
- FileID string `json:"file_id,required"`
- Index int64 `json:"index,required"`
- Type constant.FilePath `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- FileID respjson.Field
- Index respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) RawJSON() string {
- return r.JSON.raw
-}
-func (r *ResponseListResponseOutputMessageContentArrayItemAnnotationFilePath) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type ResponseListResponseOutputMessageRole string
-
-const (
- ResponseListResponseOutputMessageRoleSystem ResponseListResponseOutputMessageRole = "system"
- ResponseListResponseOutputMessageRoleDeveloper ResponseListResponseOutputMessageRole = "developer"
- ResponseListResponseOutputMessageRoleUser ResponseListResponseOutputMessageRole = "user"
- ResponseListResponseOutputMessageRoleAssistant ResponseListResponseOutputMessageRole = "assistant"
-)
-
-// Web search tool call output message for OpenAI responses.
-type ResponseListResponseOutputWebSearchCall struct {
- // Unique identifier for this tool call
- ID string `json:"id,required"`
- // Current status of the web search operation
- Status string `json:"status,required"`
- // Tool call type identifier, always "web_search_call"
- Type constant.WebSearchCall `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Status respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputWebSearchCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputWebSearchCall) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// File search tool call output message for OpenAI responses.
-type ResponseListResponseOutputFileSearchCall struct {
- // Unique identifier for this tool call
- ID string `json:"id,required"`
- // List of search queries executed
- Queries []string `json:"queries,required"`
- // Current status of the file search operation
- Status string `json:"status,required"`
- // Tool call type identifier, always "file_search_call"
- Type constant.FileSearchCall `json:"type,required"`
- // (Optional) Search results returned by the file search operation
- Results []ResponseListResponseOutputFileSearchCallResult `json:"results"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Queries respjson.Field
- Status respjson.Field
- Type respjson.Field
- Results respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputFileSearchCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputFileSearchCall) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Search results returned by the file search operation.
-type ResponseListResponseOutputFileSearchCallResult struct {
- // (Optional) Key-value attributes associated with the file
- Attributes map[string]ResponseListResponseOutputFileSearchCallResultAttributeUnion `json:"attributes,required"`
- // Unique identifier of the file containing the result
- FileID string `json:"file_id,required"`
- // Name of the file containing the result
- Filename string `json:"filename,required"`
- // Relevance score for this search result (between 0 and 1)
- Score float64 `json:"score,required"`
- // Text content of the search result
- Text string `json:"text,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Attributes respjson.Field
- FileID respjson.Field
- Filename respjson.Field
- Score respjson.Field
- Text respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputFileSearchCallResult) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputFileSearchCallResult) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ResponseListResponseOutputFileSearchCallResultAttributeUnion contains all
-// possible properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseOutputFileSearchCallResultAttributeUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
-}
-
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
-}
-
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputFileSearchCallResultAttributeUnion) RawJSON() string {
- return u.JSON.raw
-}
-
-func (r *ResponseListResponseOutputFileSearchCallResultAttributeUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Function tool call output message for OpenAI responses.
-type ResponseListResponseOutputFunctionCall struct {
- // JSON string containing the function arguments
- Arguments string `json:"arguments,required"`
- // Unique identifier for the function call
- CallID string `json:"call_id,required"`
- // Name of the function being called
- Name string `json:"name,required"`
- // Tool call type identifier, always "function_call"
- Type constant.FunctionCall `json:"type,required"`
- // (Optional) Additional identifier for the tool call
- ID string `json:"id"`
- // (Optional) Current status of the function call execution
- Status string `json:"status"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Arguments respjson.Field
- CallID respjson.Field
- Name respjson.Field
- Type respjson.Field
- ID respjson.Field
- Status respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputFunctionCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputFunctionCall) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Model Context Protocol (MCP) call output message for OpenAI responses.
-type ResponseListResponseOutputMcpCall struct {
- // Unique identifier for this MCP call
- ID string `json:"id,required"`
- // JSON string containing the MCP call arguments
- Arguments string `json:"arguments,required"`
- // Name of the MCP method being called
- Name string `json:"name,required"`
- // Label identifying the MCP server handling the call
- ServerLabel string `json:"server_label,required"`
- // Tool call type identifier, always "mcp_call"
- Type constant.McpCall `json:"type,required"`
- // (Optional) Error message if the MCP call failed
- Error string `json:"error"`
- // (Optional) Output result from the successful MCP call
- Output string `json:"output"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Arguments respjson.Field
- Name respjson.Field
- ServerLabel respjson.Field
- Type respjson.Field
- Error respjson.Field
- Output respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpCall) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpCall) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// MCP list tools output message containing available tools from an MCP server.
-type ResponseListResponseOutputMcpListTools struct {
- // Unique identifier for this MCP list tools operation
- ID string `json:"id,required"`
- // Label identifying the MCP server providing the tools
- ServerLabel string `json:"server_label,required"`
- // List of available tools provided by the MCP server
- Tools []ResponseListResponseOutputMcpListToolsTool `json:"tools,required"`
- // Tool call type identifier, always "mcp_list_tools"
- Type constant.McpListTools `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- ServerLabel respjson.Field
- Tools respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpListTools) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpListTools) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// Tool definition returned by MCP list tools operation.
-type ResponseListResponseOutputMcpListToolsTool struct {
- // JSON schema defining the tool's input parameters
- InputSchema map[string]ResponseListResponseOutputMcpListToolsToolInputSchemaUnion `json:"input_schema,required"`
- // Name of the tool
- Name string `json:"name,required"`
- // (Optional) Description of what the tool does
- Description string `json:"description"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- InputSchema respjson.Field
- Name respjson.Field
- Description respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpListToolsTool) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpListToolsTool) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-// ResponseListResponseOutputMcpListToolsToolInputSchemaUnion contains all possible
-// properties and values from [bool], [float64], [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: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseOutputMcpListToolsToolInputSchemaUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetParameters() map[string]ResponseNewParamsToolFunctionParameterUnion {
+ if vt := u.OfFunction; vt != nil {
+ return vt.Parameters
+ }
+ return nil
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetStrict() *bool {
+ if vt := u.OfFunction; vt != nil && vt.Strict.Valid() {
+ return &vt.Strict.Value
+ }
+ return nil
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetRequireApproval() *ResponseNewParamsToolMcpRequireApprovalUnion {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.RequireApproval
+ }
+ return nil
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetServerLabel() *string {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.ServerLabel
+ }
+ return nil
}
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetServerURL() *string {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.ServerURL
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) RawJSON() string {
- return u.JSON.raw
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetAllowedTools() *ResponseNewParamsToolMcpAllowedToolsUnion {
+ if vt := u.OfMcp; vt != nil {
+ return &vt.AllowedTools
+ }
+ return nil
}
-func (r *ResponseListResponseOutputMcpListToolsToolInputSchemaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetHeaders() map[string]ResponseNewParamsToolMcpHeaderUnion {
+ if vt := u.OfMcp; vt != nil {
+ return vt.Headers
+ }
+ return nil
}
-// A request for human approval of a tool invocation.
-type ResponseListResponseOutputMcpApprovalRequest struct {
- ID string `json:"id,required"`
- Arguments string `json:"arguments,required"`
- Name string `json:"name,required"`
- ServerLabel string `json:"server_label,required"`
- Type constant.McpApprovalRequest `json:"type,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Arguments respjson.Field
- Name respjson.Field
- ServerLabel respjson.Field
- Type respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// Returns a pointer to the underlying variant's property, if present.
+func (u ResponseNewParamsToolUnion) GetType() *string {
+ if vt := u.OfOpenAIResponseInputToolWebSearch; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFileSearch; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfFunction; vt != nil {
+ return (*string)(&vt.Type)
+ } else if vt := u.OfMcp; vt != nil {
+ return (*string)(&vt.Type)
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseOutputMcpApprovalRequest) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseOutputMcpApprovalRequest) UnmarshalJSON(data []byte) error {
+func init() {
+ apijson.RegisterUnion[ResponseNewParamsToolUnion](
+ "type",
+ apijson.Discriminator[ResponseNewParamsToolOpenAIResponseInputToolWebSearch]("web_search"),
+ apijson.Discriminator[ResponseNewParamsToolOpenAIResponseInputToolWebSearch]("web_search_preview"),
+ apijson.Discriminator[ResponseNewParamsToolOpenAIResponseInputToolWebSearch]("web_search_preview_2025_03_11"),
+ apijson.Discriminator[ResponseNewParamsToolFileSearch]("file_search"),
+ apijson.Discriminator[ResponseNewParamsToolFunction]("function"),
+ apijson.Discriminator[ResponseNewParamsToolMcp]("mcp"),
+ )
+}
+
+// Web search tool configuration for OpenAI response inputs.
+//
+// The property Type is required.
+type ResponseNewParamsToolOpenAIResponseInputToolWebSearch struct {
+ // Web search tool type variant to use
+ //
+ // Any of "web_search", "web_search_preview", "web_search_preview_2025_03_11".
+ Type ResponseNewParamsToolOpenAIResponseInputToolWebSearchType `json:"type,omitzero,required"`
+ // (Optional) Size of search context, must be "low", "medium", or "high"
+ SearchContextSize param.Opt[string] `json:"search_context_size,omitzero"`
+ paramObj
+}
+
+func (r ResponseNewParamsToolOpenAIResponseInputToolWebSearch) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolOpenAIResponseInputToolWebSearch
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolOpenAIResponseInputToolWebSearch) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type ResponseListResponseOutputRole string
+// Web search tool type variant to use
+type ResponseNewParamsToolOpenAIResponseInputToolWebSearchType string
const (
- ResponseListResponseOutputRoleSystem ResponseListResponseOutputRole = "system"
- ResponseListResponseOutputRoleDeveloper ResponseListResponseOutputRole = "developer"
- ResponseListResponseOutputRoleUser ResponseListResponseOutputRole = "user"
- ResponseListResponseOutputRoleAssistant ResponseListResponseOutputRole = "assistant"
+ ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearch ResponseNewParamsToolOpenAIResponseInputToolWebSearchType = "web_search"
+ ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearchPreview ResponseNewParamsToolOpenAIResponseInputToolWebSearchType = "web_search_preview"
+ ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearchPreview2025_03_11 ResponseNewParamsToolOpenAIResponseInputToolWebSearchType = "web_search_preview_2025_03_11"
)
-// Text formatting configuration for the response
-type ResponseListResponseText struct {
- // (Optional) Text format configuration specifying output format requirements
- Format ResponseListResponseTextFormat `json:"format"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Format respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// File search tool configuration for OpenAI response inputs.
+//
+// The properties Type, VectorStoreIDs are required.
+type ResponseNewParamsToolFileSearch struct {
+ // List of vector store identifiers to search within
+ VectorStoreIDs []string `json:"vector_store_ids,omitzero,required"`
+ // (Optional) Maximum number of search results to return (1-50)
+ MaxNumResults param.Opt[int64] `json:"max_num_results,omitzero"`
+ // (Optional) Additional filters to apply to the search
+ Filters map[string]ResponseNewParamsToolFileSearchFilterUnion `json:"filters,omitzero"`
+ // (Optional) Options for ranking and scoring search results
+ RankingOptions ResponseNewParamsToolFileSearchRankingOptions `json:"ranking_options,omitzero"`
+ // Tool type identifier, always "file_search"
+ //
+ // This field can be elided, and will marshal its zero value as "file_search".
+ Type constant.FileSearch `json:"type,required"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseText) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseText) UnmarshalJSON(data []byte) error {
+func (r ResponseNewParamsToolFileSearch) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolFileSearch
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolFileSearch) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// (Optional) Text format configuration specifying output format requirements
-type ResponseListResponseTextFormat struct {
- // Must be "text", "json_schema", or "json_object" to identify the format type
- //
- // Any of "text", "json_schema", "json_object".
- Type ResponseListResponseTextFormatType `json:"type,required"`
- // (Optional) A description of the response format. Only used for json_schema.
- Description string `json:"description"`
- // The name of the response format. Only used for json_schema.
- Name string `json:"name"`
- // The JSON schema the response should conform to. In a Python SDK, this is often a
- // `pydantic` model. Only used for json_schema.
- Schema map[string]ResponseListResponseTextFormatSchemaUnion `json:"schema"`
- // (Optional) Whether to strictly enforce the JSON schema. If true, the response
- // must match the schema exactly. Only used for json_schema.
- Strict bool `json:"strict"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Type respjson.Field
- Description respjson.Field
- Name respjson.Field
- Schema respjson.Field
- Strict respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsToolFileSearchFilterUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsToolFileSearchFilterUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ResponseNewParamsToolFileSearchFilterUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsToolFileSearchFilterUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseTextFormat) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseTextFormat) UnmarshalJSON(data []byte) error {
+// (Optional) Options for ranking and scoring search results
+type ResponseNewParamsToolFileSearchRankingOptions struct {
+ // (Optional) Name of the ranking algorithm to use
+ Ranker param.Opt[string] `json:"ranker,omitzero"`
+ // (Optional) Minimum relevance score threshold for results
+ ScoreThreshold param.Opt[float64] `json:"score_threshold,omitzero"`
+ paramObj
+}
+
+func (r ResponseNewParamsToolFileSearchRankingOptions) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolFileSearchRankingOptions
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolFileSearchRankingOptions) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Must be "text", "json_schema", or "json_object" to identify the format type
-type ResponseListResponseTextFormatType string
+// Function tool configuration for OpenAI response inputs.
+//
+// The properties Name, Type are required.
+type ResponseNewParamsToolFunction struct {
+ // Name of the function that can be called
+ Name string `json:"name,required"`
+ // (Optional) Description of what the function does
+ Description param.Opt[string] `json:"description,omitzero"`
+ // (Optional) Whether to enforce strict parameter validation
+ Strict param.Opt[bool] `json:"strict,omitzero"`
+ // (Optional) JSON schema defining the function's parameters
+ Parameters map[string]ResponseNewParamsToolFunctionParameterUnion `json:"parameters,omitzero"`
+ // Tool type identifier, always "function"
+ //
+ // This field can be elided, and will marshal its zero value as "function".
+ Type constant.Function `json:"type,required"`
+ paramObj
+}
-const (
- ResponseListResponseTextFormatTypeText ResponseListResponseTextFormatType = "text"
- ResponseListResponseTextFormatTypeJsonSchema ResponseListResponseTextFormatType = "json_schema"
- ResponseListResponseTextFormatTypeJsonObject ResponseListResponseTextFormatType = "json_object"
-)
+func (r ResponseNewParamsToolFunction) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolFunction
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolFunction) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
-// ResponseListResponseTextFormatSchemaUnion contains all possible properties and
-// values from [bool], [float64], [string], [[]any].
+// Only one field can be non-zero.
//
-// Use the methods beginning with 'As' to cast the union to one of its variants.
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsToolFunctionParameterUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsToolFunctionParameterUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ResponseNewParamsToolFunctionParameterUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsToolFunctionParameterUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
+
+// Model Context Protocol (MCP) tool configuration for OpenAI response inputs.
//
-// If the underlying value is not a json object, one of the following properties
-// will be valid: OfBool OfFloat OfString OfAnyArray]
-type ResponseListResponseTextFormatSchemaUnion struct {
- // This field will be present if the value is a [bool] instead of an object.
- OfBool bool `json:",inline"`
- // This field will be present if the value is a [float64] instead of an object.
- OfFloat float64 `json:",inline"`
- // This field will be present if the value is a [string] instead of an object.
- OfString string `json:",inline"`
- // This field will be present if the value is a [[]any] instead of an object.
- OfAnyArray []any `json:",inline"`
- JSON struct {
- OfBool respjson.Field
- OfFloat respjson.Field
- OfString respjson.Field
- OfAnyArray respjson.Field
- raw string
- } `json:"-"`
+// The properties RequireApproval, ServerLabel, ServerURL, Type are required.
+type ResponseNewParamsToolMcp struct {
+ // Approval requirement for tool calls ("always", "never", or filter)
+ RequireApproval ResponseNewParamsToolMcpRequireApprovalUnion `json:"require_approval,omitzero,required"`
+ // Label to identify this MCP server
+ ServerLabel string `json:"server_label,required"`
+ // URL endpoint of the MCP server
+ ServerURL string `json:"server_url,required"`
+ // (Optional) Restriction on which tools can be used from this server
+ AllowedTools ResponseNewParamsToolMcpAllowedToolsUnion `json:"allowed_tools,omitzero"`
+ // (Optional) HTTP headers to include when connecting to the server
+ Headers map[string]ResponseNewParamsToolMcpHeaderUnion `json:"headers,omitzero"`
+ // Tool type identifier, always "mcp"
+ //
+ // This field can be elided, and will marshal its zero value as "mcp".
+ Type constant.Mcp `json:"type,required"`
+ paramObj
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsBool() (v bool) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (r ResponseNewParamsToolMcp) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolMcp
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolMcp) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsFloat() (v float64) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsToolMcpRequireApprovalUnion struct {
+ // Check if union is this variant with
+ // !param.IsOmitted(union.OfResponseNewsToolMcpRequireApprovalString)
+ OfResponseNewsToolMcpRequireApprovalString param.Opt[ResponseNewParamsToolMcpRequireApprovalString] `json:",omitzero,inline"`
+ OfApprovalFilter *ResponseNewParamsToolMcpRequireApprovalApprovalFilter `json:",omitzero,inline"`
+ paramUnion
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsString() (v string) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u ResponseNewParamsToolMcpRequireApprovalUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfResponseNewsToolMcpRequireApprovalString, u.OfApprovalFilter)
+}
+func (u *ResponseNewParamsToolMcpRequireApprovalUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
}
-func (u ResponseListResponseTextFormatSchemaUnion) AsAnyArray() (v []any) {
- apijson.UnmarshalRoot(json.RawMessage(u.JSON.raw), &v)
- return
+func (u *ResponseNewParamsToolMcpRequireApprovalUnion) asAny() any {
+ if !param.IsOmitted(u.OfResponseNewsToolMcpRequireApprovalString) {
+ return &u.OfResponseNewsToolMcpRequireApprovalString
+ } else if !param.IsOmitted(u.OfApprovalFilter) {
+ return u.OfApprovalFilter
+ }
+ return nil
}
-// Returns the unmodified JSON received from the API
-func (u ResponseListResponseTextFormatSchemaUnion) RawJSON() string { return u.JSON.raw }
+type ResponseNewParamsToolMcpRequireApprovalString string
-func (r *ResponseListResponseTextFormatSchemaUnion) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
+const (
+ ResponseNewParamsToolMcpRequireApprovalStringAlways ResponseNewParamsToolMcpRequireApprovalString = "always"
+ ResponseNewParamsToolMcpRequireApprovalStringNever ResponseNewParamsToolMcpRequireApprovalString = "never"
+)
-// (Optional) Error details if the response generation failed
-type ResponseListResponseError struct {
- // Error code identifying the type of failure
- Code string `json:"code,required"`
- // Human-readable error message describing the failure
- Message string `json:"message,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Code respjson.Field
- Message respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// Filter configuration for MCP tool approval requirements.
+type ResponseNewParamsToolMcpRequireApprovalApprovalFilter struct {
+ // (Optional) List of tool names that always require approval
+ Always []string `json:"always,omitzero"`
+ // (Optional) List of tool names that never require approval
+ Never []string `json:"never,omitzero"`
+ paramObj
}
-// Returns the unmodified JSON received from the API
-func (r ResponseListResponseError) RawJSON() string { return r.JSON.raw }
-func (r *ResponseListResponseError) UnmarshalJSON(data []byte) error {
+func (r ResponseNewParamsToolMcpRequireApprovalApprovalFilter) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolMcpRequireApprovalApprovalFilter
+ return param.MarshalObject(r, (*shadow)(&r))
+}
+func (r *ResponseNewParamsToolMcpRequireApprovalApprovalFilter) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// Response object confirming deletion of an OpenAI response.
-type ResponseDeleteResponse struct {
- // Unique identifier of the deleted response
- ID string `json:"id,required"`
- // Deletion confirmation flag, always True
- Deleted bool `json:"deleted,required"`
- // Object type identifier, always "response"
- Object constant.Response `json:"object,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- Deleted respjson.Field
- Object respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsToolMcpAllowedToolsUnion struct {
+ OfStringArray []string `json:",omitzero,inline"`
+ OfAllowedToolsFilter *ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter `json:",omitzero,inline"`
+ paramUnion
}
-// Returns the unmodified JSON received from the API
-func (r ResponseDeleteResponse) RawJSON() string { return r.JSON.raw }
-func (r *ResponseDeleteResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
+func (u ResponseNewParamsToolMcpAllowedToolsUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfStringArray, u.OfAllowedToolsFilter)
+}
+func (u *ResponseNewParamsToolMcpAllowedToolsUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
}
-type ResponseNewParams struct {
- // The ID of the last response to return.
- After param.Opt[string] `json:"after,omitzero"`
- // The number of responses to return.
- Limit param.Opt[int64] `json:"limit,omitzero"`
- // The model to filter responses by.
- Model param.Opt[string] `json:"model,omitzero"`
- // The order to sort responses by when sorted by created_at ('asc' or 'desc').
- //
- // Any of "asc", "desc".
- Order ResponseNewParamsOrder `json:"order,omitzero"`
+func (u *ResponseNewParamsToolMcpAllowedToolsUnion) asAny() any {
+ if !param.IsOmitted(u.OfStringArray) {
+ return &u.OfStringArray
+ } else if !param.IsOmitted(u.OfAllowedToolsFilter) {
+ return u.OfAllowedToolsFilter
+ }
+ return nil
+}
+
+// Filter configuration for restricting which MCP tools can be used.
+type ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter struct {
+ // (Optional) List of specific tool names that are allowed
+ ToolNames []string `json:"tool_names,omitzero"`
paramObj
}
-func (r ResponseNewParams) MarshalJSON() (data []byte, err error) {
- type shadow ResponseNewParams
+func (r ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter) MarshalJSON() (data []byte, err error) {
+ type shadow ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter
return param.MarshalObject(r, (*shadow)(&r))
}
-func (r *ResponseNewParams) UnmarshalJSON(data []byte) error {
+func (r *ResponseNewParamsToolMcpAllowedToolsAllowedToolsFilter) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-// The order to sort responses by when sorted by created_at ('asc' or 'desc').
-type ResponseNewParamsOrder string
-
-const (
- ResponseNewParamsOrderAsc ResponseNewParamsOrder = "asc"
- ResponseNewParamsOrderDesc ResponseNewParamsOrder = "desc"
-)
+// Only one field can be non-zero.
+//
+// Use [param.IsOmitted] to confirm if a field is set.
+type ResponseNewParamsToolMcpHeaderUnion struct {
+ OfBool param.Opt[bool] `json:",omitzero,inline"`
+ OfFloat param.Opt[float64] `json:",omitzero,inline"`
+ OfString param.Opt[string] `json:",omitzero,inline"`
+ OfAnyArray []any `json:",omitzero,inline"`
+ paramUnion
+}
+
+func (u ResponseNewParamsToolMcpHeaderUnion) MarshalJSON() ([]byte, error) {
+ return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
+}
+func (u *ResponseNewParamsToolMcpHeaderUnion) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, u)
+}
+
+func (u *ResponseNewParamsToolMcpHeaderUnion) asAny() any {
+ if !param.IsOmitted(u.OfBool) {
+ return &u.OfBool.Value
+ } else if !param.IsOmitted(u.OfFloat) {
+ return &u.OfFloat.Value
+ } else if !param.IsOmitted(u.OfString) {
+ return &u.OfString.Value
+ } else if !param.IsOmitted(u.OfAnyArray) {
+ return &u.OfAnyArray
+ }
+ return nil
+}
type ResponseListParams struct {
// The ID of the last response to return.
diff --git a/response_test.go b/response_test.go
index bb41ff3..829b38b 100644
--- a/response_test.go
+++ b/response_test.go
@@ -25,10 +25,35 @@ func TestResponseNewWithOptionalParams(t *testing.T) {
option.WithBaseURL(baseURL),
)
_, err := client.Responses.New(context.TODO(), llamastackclient.ResponseNewParams{
- After: llamastackclient.String("after"),
- Limit: llamastackclient.Int(0),
- Model: llamastackclient.String("model"),
- Order: llamastackclient.ResponseNewParamsOrderAsc,
+ Input: llamastackclient.ResponseNewParamsInputUnion{
+ OfString: llamastackclient.String("string"),
+ },
+ Model: "model",
+ Include: []string{"string"},
+ Instructions: llamastackclient.String("instructions"),
+ MaxInferIters: llamastackclient.Int(0),
+ PreviousResponseID: llamastackclient.String("previous_response_id"),
+ Store: llamastackclient.Bool(true),
+ Temperature: llamastackclient.Float(0),
+ Text: llamastackclient.ResponseNewParamsText{
+ Format: llamastackclient.ResponseNewParamsTextFormat{
+ Type: llamastackclient.ResponseNewParamsTextFormatTypeText,
+ Description: llamastackclient.String("description"),
+ Name: llamastackclient.String("name"),
+ Schema: map[string]llamastackclient.ResponseNewParamsTextFormatSchemaUnion{
+ "foo": {
+ OfBool: llamastackclient.Bool(true),
+ },
+ },
+ Strict: llamastackclient.Bool(true),
+ },
+ },
+ Tools: []llamastackclient.ResponseNewParamsToolUnion{{
+ OfOpenAIResponseInputToolWebSearch: &llamastackclient.ResponseNewParamsToolOpenAIResponseInputToolWebSearch{
+ Type: llamastackclient.ResponseNewParamsToolOpenAIResponseInputToolWebSearchTypeWebSearch,
+ SearchContextSize: llamastackclient.String("search_context_size"),
+ },
+ }},
})
if err != nil {
var apierr *llamastackclient.Error
diff --git a/shared/constant/constants.go b/shared/constant/constants.go
index a3fd044..8666cd4 100644
--- a/shared/constant/constants.go
+++ b/shared/constant/constants.go
@@ -39,6 +39,7 @@ type Embedding string // Always "embedding"
type File string // Always "file"
type FileCitation string // Always "file_citation"
type FilePath string // Always "file_path"
+type FileSearch string // Always "file_search"
type FileSearchCall string // Always "file_search_call"
type Function string // Always "function"
type FunctionCall string // Always "function_call"
@@ -57,6 +58,7 @@ type List string // Always "list"
type Llm string // Always "llm"
type LlmAsJudge string // Always "llm_as_judge"
type LoRa string // Always "LoRA"
+type Mcp string // Always "mcp"
type McpApprovalRequest string // Always "mcp_approval_request"
type McpApprovalResponse string // Always "mcp_approval_response"
type McpCall string // Always "mcp_call"
@@ -148,6 +150,7 @@ func (c Embedding) Default() Embedding { return "embeddi
func (c File) Default() File { return "file" }
func (c FileCitation) Default() FileCitation { return "file_citation" }
func (c FilePath) Default() FilePath { return "file_path" }
+func (c FileSearch) Default() FileSearch { return "file_search" }
func (c FileSearchCall) Default() FileSearchCall { return "file_search_call" }
func (c Function) Default() Function { return "function" }
func (c FunctionCall) Default() FunctionCall { return "function_call" }
@@ -166,6 +169,7 @@ func (c List) Default() List { return "list" }
func (c Llm) Default() Llm { return "llm" }
func (c LlmAsJudge) Default() LlmAsJudge { return "llm_as_judge" }
func (c LoRa) Default() LoRa { return "LoRA" }
+func (c Mcp) Default() Mcp { return "mcp" }
func (c McpApprovalRequest) Default() McpApprovalRequest { return "mcp_approval_request" }
func (c McpApprovalResponse) Default() McpApprovalResponse { return "mcp_approval_response" }
func (c McpCall) Default() McpCall { return "mcp_call" }
@@ -289,6 +293,7 @@ func (c Embedding) MarshalJSON() ([]byte, error) { retu
func (c File) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FileCitation) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FilePath) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c FileSearch) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FileSearchCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c Function) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c FunctionCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
@@ -307,6 +312,7 @@ func (c List) MarshalJSON() ([]byte, error) { retu
func (c Llm) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c LlmAsJudge) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c LoRa) MarshalJSON() ([]byte, error) { return marshalString(c) }
+func (c Mcp) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpApprovalRequest) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpApprovalResponse) MarshalJSON() ([]byte, error) { return marshalString(c) }
func (c McpCall) MarshalJSON() ([]byte, error) { return marshalString(c) }
From 16f4c17bb6666c2d7fc9207e886a66a6442cd8c8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 2 Oct 2025 20:08:56 +0000
Subject: [PATCH 33/33] release: 0.1.0-alpha.2
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 54 +++++++++++++++++++++++++++++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ba6c348..f14b480 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.1"
+ ".": "0.1.0-alpha.2"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 80af85e..78e75bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,59 @@
# Changelog
+## 0.1.0-alpha.2 (2025-10-02)
+
+Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/llamastack/llama-stack-client-go/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
+
+### ⚠ BREAKING CHANGES
+
+* **api:** use input_schema instead of parameters for tools
+* **api:** fixes to remove deprecated inference resources
+
+### Features
+
+* **api:** expires_after changes for /files ([222bb4e](https://github.com/llamastack/llama-stack-client-go/commit/222bb4ed27e9a4afd247aacea50d1645326a6b54))
+* **api:** fix completion response breakage perhaps? ([3e9c39f](https://github.com/llamastack/llama-stack-client-go/commit/3e9c39f1bf837daf2487ec2c465a9522e6b5befe))
+* **api:** fix file batches SDK to list_files ([c9da417](https://github.com/llamastack/llama-stack-client-go/commit/c9da41734d782e758971ca2f5b9821669dbd7331))
+* **api:** fixes to remove deprecated inference resources ([9f926b2](https://github.com/llamastack/llama-stack-client-go/commit/9f926b25335010398c825844a60927709ccfc07f))
+* **api:** fixes to URLs ([6c9752f](https://github.com/llamastack/llama-stack-client-go/commit/6c9752f49b98e57c4ce06c6310f33d19207b3ae1))
+* **api:** manual updates ([eb137af](https://github.com/llamastack/llama-stack-client-go/commit/eb137afa61bf5621159b871561e3a11ca3589b00))
+* **api:** manual updates ([9de5708](https://github.com/llamastack/llama-stack-client-go/commit/9de5708ab28e06c58731c3ac57c3e4c4fbc12aca))
+* **api:** move post_training and eval under alpha namespace ([42bdca7](https://github.com/llamastack/llama-stack-client-go/commit/42bdca705b93c1c8c3330a4075bd8f5bde977f65))
+* **api:** moving { rerank, agents } to `client.alpha.` ([f12fecf](https://github.com/llamastack/llama-stack-client-go/commit/f12fecf6d892348ebee06652255f6ac66f38e0bb))
+* **api:** query_metrics, batches, changes ([06e03be](https://github.com/llamastack/llama-stack-client-go/commit/06e03be805d93736fcf4f848c5f9888e2871c911))
+* **api:** removing openai/v1 ([b8635d7](https://github.com/llamastack/llama-stack-client-go/commit/b8635d7781c593fc1fb4bda7311189428f5bc128))
+* **api:** SDKs for vector store file batches ([2060878](https://github.com/llamastack/llama-stack-client-go/commit/2060878c2b6b81c76b65f56dab6d699df12fb7d0))
+* **api:** SDKs for vector store file batches apis ([e5f679f](https://github.com/llamastack/llama-stack-client-go/commit/e5f679f8f193fcdf76aba82288130854e9b86819))
+* **api:** some updates to query metrics ([8243d43](https://github.com/llamastack/llama-stack-client-go/commit/8243d43dfa43bb9ec92d1edbed36f114240a265e))
+* **api:** tool api (input_schema, etc.) changes ([837277d](https://github.com/llamastack/llama-stack-client-go/commit/837277d4e6b4ffb57ce0136072b80400011da79a))
+* **api:** updating post /v1/files to have correct multipart/form-data ([a3d6051](https://github.com/llamastack/llama-stack-client-go/commit/a3d6051547ce2b9cbd5af96b6b802515b737e7fb))
+* **api:** use input_schema instead of parameters for tools ([a16eaef](https://github.com/llamastack/llama-stack-client-go/commit/a16eaef870f6ec94ae6adf36eed0d65bfa9fd3b8))
+
+
+### Bug Fixes
+
+* **api:** another fix to capture correct responses.create() params ([f3a9ee7](https://github.com/llamastack/llama-stack-client-go/commit/f3a9ee7303c890444802c76412d5d245a1420bdb))
+* **api:** fix the ToolDefParam updates ([65cef22](https://github.com/llamastack/llama-stack-client-go/commit/65cef2268480297f4233dd1c4c817aa03943f18e))
+* bugfix for setting JSON keys with special characters ([ceb15f3](https://github.com/llamastack/llama-stack-client-go/commit/ceb15f300fdf9b7e1b2615c14c352878bcfc082b))
+* **client:** fix circular dependencies and offset pagination ([0b95836](https://github.com/llamastack/llama-stack-client-go/commit/0b95836016ca0d089d3f7c07456ff5f55989011f))
+* close body before retrying ([66adbea](https://github.com/llamastack/llama-stack-client-go/commit/66adbea266032b1198c76c8f590808d61a3d145a))
+* fix stream event model reference ([d8b42f6](https://github.com/llamastack/llama-stack-client-go/commit/d8b42f67eefb216968989a10d68b2ff0e3e65a62))
+* **internal:** unmarshal correctly when there are multiple discriminators ([d76c69c](https://github.com/llamastack/llama-stack-client-go/commit/d76c69c30d1402e13178448691d8202e6f2b5d82))
+* use slices.Concat instead of sometimes modifying r.Options ([15dfa47](https://github.com/llamastack/llama-stack-client-go/commit/15dfa47636cc1cd0ccb6b089ae363a7e70a5f56c))
+
+
+### Chores
+
+* bump minimum go version to 1.22 ([7b5d227](https://github.com/llamastack/llama-stack-client-go/commit/7b5d227df87389479dc2f6954ba59147b5d1a0fc))
+* do not install brew dependencies in ./scripts/bootstrap by default ([062a46b](https://github.com/llamastack/llama-stack-client-go/commit/062a46b117baaf537ef9a0edef4222d7a1b3a839))
+* **internal:** codegen related update ([a3cccf1](https://github.com/llamastack/llama-stack-client-go/commit/a3cccf10d30121514bb6b07a6416c589a1881763))
+* update more docs for 1.22 ([67c0b00](https://github.com/llamastack/llama-stack-client-go/commit/67c0b0067523c93560b6d6467b81e3e8c2ecb61e))
+
+
+### Documentation
+
+* update examples ([245c643](https://github.com/llamastack/llama-stack-client-go/commit/245c643bb01b573243c31bea5f66761ef7e3fba1))
+
## 0.1.0-alpha.1 (2025-08-21)
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/llamastack/llama-stack-client-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
diff --git a/README.md b/README.md
index fdf215f..b43b1bb 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/llamastack/llama-stack-client-go@v0.1.0-alpha.1'
+go get -u 'github.com/llamastack/llama-stack-client-go@v0.1.0-alpha.2'
```
diff --git a/internal/version.go b/internal/version.go
index 5ed22d7..d6f40b3 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.1.0-alpha.1" // x-release-please-version
+const PackageVersion = "0.1.0-alpha.2" // x-release-please-version