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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.4.0-alpha.1"
".": "0.4.0-alpha.2"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 96
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-602ce64aa309cc15fa09388d99c9f298795686fc37605237cbc03c39d29aabf6.yml
openapi_spec_hash: fc6995247b2555e8660bc9291eb10415
config_hash: e8a35d9d37cb4774b4b0fe1b167dc156
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-185ec058880381a5526ac91a488af1833f55656e36cd10b3795eb8fd4d75026f.yml
openapi_spec_hash: fa935c08e25d23cff624e5e150f8e6ca
config_hash: 39578cfdeb4a10121f2cb3fa3e4d5e20
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.4.0-alpha.2 (2025-11-19)

Full Changelog: [v0.4.0-alpha.1...v0.4.0-alpha.2](https://github.com/llamastack/llama-stack-client-go/compare/v0.4.0-alpha.1...v0.4.0-alpha.2)

### Features

* Wire through parallel_tool_calls to Responses API ([1090be9](https://github.com/llamastack/llama-stack-client-go/commit/1090be93ae142c74365868350c435380a63679ba))


### Bug Fixes

* **client:** correctly specify Accept header with */* instead of empty ([3037900](https://github.com/llamastack/llama-stack-client-go/commit/303790079c138c442eb492fd9457b60dade84198))
* **openapi:** restore embedded request wrappers ([7da5f07](https://github.com/llamastack/llama-stack-client-go/commit/7da5f07a1b07166105173d8263b95b59e06735fd))


### Chores

* use Pydantic to generate OpenAPI schema ([c7fafed](https://github.com/llamastack/llama-stack-client-go/commit/c7fafed933890ba05c37e6ab54cd5163d00801fc))

## 0.4.0-alpha.1 (2025-11-14)

Full Changelog: [v0.1.0-alpha.1...v0.4.0-alpha.1](https://github.com/llamastack/llama-stack-client-go/compare/v0.1.0-alpha.1...v0.4.0-alpha.1)
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/llamastack/llama-stack-client-go@v0.4.0-alpha.1'
go get -u 'github.com/llamastack/llama-stack-client-go@v0.4.0-alpha.2'
```

<!-- x-release-please-end -->
Expand All @@ -53,13 +53,11 @@ import (

func main() {
client := llamastackclient.NewClient()
response, err := client.Models.Register(context.TODO(), llamastackclient.ModelRegisterParams{
ModelID: "model_id",
})
models, err := client.Models.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Identifier)
fmt.Printf("%+v\n", models)
}

```
Expand Down Expand Up @@ -302,6 +300,7 @@ _, err := client.Chat.Completions.New(context.TODO(), llamastackclient.ChatCompl
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
OfString: llamastackclient.String("string"),
},
Role: "user",
},
}},
Model: "model",
Expand Down Expand Up @@ -338,6 +337,7 @@ client.Chat.Completions.New(
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
OfString: llamastackclient.String("string"),
},
Role: "user",
},
}},
Model: "model",
Expand Down Expand Up @@ -404,6 +404,7 @@ client.Chat.Completions.New(
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
OfString: llamastackclient.String("string"),
},
Role: "user",
},
}},
Model: "model",
Expand All @@ -428,6 +429,7 @@ completion, err := client.Chat.Completions.New(
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
OfString: llamastackclient.String("string"),
},
Role: "user",
},
}},
Model: "model",
Expand Down
143 changes: 37 additions & 106 deletions alphabenchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package llamastackclient

import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
Expand All @@ -21,7 +20,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"
)

// AlphaBenchmarkService contains methods and other services that help with
Expand Down Expand Up @@ -73,34 +71,50 @@ func (r *AlphaBenchmarkService) List(ctx context.Context, opts ...option.Request
// Deprecated: deprecated
func (r *AlphaBenchmarkService) Register(ctx context.Context, body AlphaBenchmarkRegisterParams, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "")}, opts...)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...)
path := "v1alpha/eval/benchmarks"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, nil, opts...)
return
}

// Unregister a benchmark.
//
// Deprecated: deprecated
func (r *AlphaBenchmarkService) Unregister(ctx context.Context, benchmarkID string, opts ...option.RequestOption) (err error) {
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, 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.MethodDelete, path, nil, 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"`
DatasetID string `json:"dataset_id,required"`
// Unique identifier for this resource in llama stack
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
// ID of the provider that owns this resource
ProviderID string `json:"provider_id,required"`
ScoringFunctions []string `json:"scoring_functions,required"`
// The resource type, always benchmark
Type constant.Benchmark `json:"type,required"`
ProviderResourceID string `json:"provider_resource_id"`
// Metadata for this evaluation task
Metadata map[string]any `json:"metadata"`
// Unique identifier for this resource in the provider
ProviderResourceID string `json:"provider_resource_id,nullable"`
// Any of "benchmark".
Type BenchmarkType `json:"type"`
// 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
Metadata respjson.Field
ProviderResourceID respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
Expand All @@ -112,57 +126,11 @@ 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
}
type BenchmarkType string

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)
}
const (
BenchmarkTypeBenchmark BenchmarkType = "benchmark"
)

type ListBenchmarksResponse struct {
Data []Benchmark `json:"data,required"`
Expand All @@ -181,18 +149,12 @@ func (r *ListBenchmarksResponse) UnmarshalJSON(data []byte) error {
}

type AlphaBenchmarkRegisterParams 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.
BenchmarkID string `json:"benchmark_id,required"`
DatasetID string `json:"dataset_id,required"`
ScoringFunctions []string `json:"scoring_functions,omitzero,required"`
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]AlphaBenchmarkRegisterParamsMetadataUnion `json:"metadata,omitzero"`
ProviderID param.Opt[string] `json:"provider_id,omitzero"`
Metadata map[string]any `json:"metadata,omitzero"`
paramObj
}

Expand All @@ -203,34 +165,3 @@ func (r AlphaBenchmarkRegisterParams) MarshalJSON() (data []byte, err error) {
func (r *AlphaBenchmarkRegisterParams) 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 AlphaBenchmarkRegisterParamsMetadataUnion 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 AlphaBenchmarkRegisterParamsMetadataUnion) MarshalJSON() ([]byte, error) {
return param.MarshalUnion(u, u.OfBool, u.OfFloat, u.OfString, u.OfAnyArray)
}
func (u *AlphaBenchmarkRegisterParamsMetadataUnion) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, u)
}

func (u *AlphaBenchmarkRegisterParamsMetadataUnion) 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
}
27 changes: 23 additions & 4 deletions alphabenchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ func TestAlphaBenchmarkRegisterWithOptionalParams(t *testing.T) {
BenchmarkID: "benchmark_id",
DatasetID: "dataset_id",
ScoringFunctions: []string{"string"},
Metadata: map[string]llamastackclient.AlphaBenchmarkRegisterParamsMetadataUnion{
"foo": {
OfBool: llamastackclient.Bool(true),
},
Metadata: map[string]any{
"foo": "bar",
},
ProviderBenchmarkID: llamastackclient.String("provider_benchmark_id"),
ProviderID: llamastackclient.String("provider_id"),
Expand All @@ -92,3 +90,24 @@ func TestAlphaBenchmarkRegisterWithOptionalParams(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}

func TestAlphaBenchmarkUnregister(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.Alpha.Benchmarks.Unregister(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())
}
}
Loading
Loading