Skip to content

Commit 3e9c39f

Browse files
feat(api): fix completion response breakage perhaps?
1 parent 8243d43 commit 3e9c39f

File tree

8 files changed

+131
-189
lines changed

8 files changed

+131
-189
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 107
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
33
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
4-
config_hash: 17fe64b23723fc54f2ee61c80223c3e3
4+
config_hash: 4138b0fa1be4c2807ad4ec538b8b38f4

aliases.go

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ type ContentDeltaImage = shared.ContentDeltaImage
148148
// This is an alias to an internal type.
149149
type ContentDeltaToolCall = shared.ContentDeltaToolCall
150150

151+
// Either an in-progress tool call string or the final parsed tool call
152+
//
153+
// This is an alias to an internal type.
154+
type ContentDeltaToolCallToolCallUnion = shared.ContentDeltaToolCallToolCallUnion
155+
151156
// A document to be used for document ingestion in the RAG Tool.
152157
//
153158
// This is an alias to an internal type.
@@ -296,6 +301,11 @@ type InterleavedContentItemTextParam = shared.InterleavedContentItemTextParam
296301
// This is an alias to an internal type.
297302
type MessageUnionParam = shared.MessageUnionParam
298303

304+
// A metric value included in API responses.
305+
//
306+
// This is an alias to an internal type.
307+
type Metric = shared.Metric
308+
299309
// Configuration for the RAG query generation.
300310
//
301311
// This is an alias to an internal type.
@@ -396,45 +406,6 @@ type ResponseFormatGrammarParam = shared.ResponseFormatGrammarParam
396406
// This is an alias to an internal type.
397407
type ResponseFormatGrammarBnfUnionParam = shared.ResponseFormatGrammarBnfUnionParam
398408

399-
// This is an alias to an internal type.
400-
type ReturnType = shared.ReturnType
401-
402-
// This is an alias to an internal type.
403-
type ReturnTypeType = shared.ReturnTypeType
404-
405-
// Equals "string"
406-
const ReturnTypeTypeString = shared.ReturnTypeTypeString
407-
408-
// Equals "number"
409-
const ReturnTypeTypeNumber = shared.ReturnTypeTypeNumber
410-
411-
// Equals "boolean"
412-
const ReturnTypeTypeBoolean = shared.ReturnTypeTypeBoolean
413-
414-
// Equals "array"
415-
const ReturnTypeTypeArray = shared.ReturnTypeTypeArray
416-
417-
// Equals "object"
418-
const ReturnTypeTypeObject = shared.ReturnTypeTypeObject
419-
420-
// Equals "json"
421-
const ReturnTypeTypeJson = shared.ReturnTypeTypeJson
422-
423-
// Equals "union"
424-
const ReturnTypeTypeUnion = shared.ReturnTypeTypeUnion
425-
426-
// Equals "chat_completion_input"
427-
const ReturnTypeTypeChatCompletionInput = shared.ReturnTypeTypeChatCompletionInput
428-
429-
// Equals "completion_input"
430-
const ReturnTypeTypeCompletionInput = shared.ReturnTypeTypeCompletionInput
431-
432-
// Equals "agent_turn_input"
433-
const ReturnTypeTypeAgentTurnInput = shared.ReturnTypeTypeAgentTurnInput
434-
435-
// This is an alias to an internal type.
436-
type ReturnTypeParam = shared.ReturnTypeParam
437-
438409
// Details of a safety violation detected by content moderation.
439410
//
440411
// This is an alias to an internal type.
@@ -632,11 +603,6 @@ type ToolCallArgumentsMapItemArrayItemUnionParam = shared.ToolCallArgumentsMapIt
632603
// This is an alias to an internal type.
633604
type ToolCallArgumentsMapItemMapItemUnionParam = shared.ToolCallArgumentsMapItemMapItemUnionParam
634605

635-
// Either an in-progress tool call string or the final parsed tool call
636-
//
637-
// This is an alias to an internal type.
638-
type ToolCallOrStringUnion = shared.ToolCallOrStringUnion
639-
640606
// This is an alias to an internal type.
641607
type ToolParamDefinition = shared.ToolParamDefinition
642608

api.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#QueryConfigParam">QueryConfigParam</a>
1010
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#QueryGeneratorConfigUnionParam">QueryGeneratorConfigUnionParam</a>
1111
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ResponseFormatUnionParam">ResponseFormatUnionParam</a>
12-
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ReturnTypeParam">ReturnTypeParam</a>
1312
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SamplingParams">SamplingParams</a>
1413
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SharedToolDefParam">SharedToolDefParam</a>
1514
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SystemMessageParam">SystemMessageParam</a>
@@ -27,16 +26,15 @@
2726
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ContentDeltaUnion">ContentDeltaUnion</a>
2827
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#InterleavedContentUnion">InterleavedContentUnion</a>
2928
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#InterleavedContentItemUnion">InterleavedContentItemUnion</a>
29+
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#Metric">Metric</a>
3030
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#QueryResult">QueryResult</a>
3131
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ResponseFormatUnion">ResponseFormatUnion</a>
32-
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ReturnType">ReturnType</a>
3332
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SafetyViolation">SafetyViolation</a>
3433
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SamplingParamsResp">SamplingParamsResp</a>
3534
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ScoringResult">ScoringResult</a>
3635
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SharedCompletionResponse">SharedCompletionResponse</a>
3736
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#SharedToolDef">SharedToolDef</a>
3837
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ToolCall">ToolCall</a>
39-
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ToolCallOrStringUnion">ToolCallOrStringUnion</a>
4038
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#ToolResponseMessage">ToolResponseMessage</a>
4139
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared">shared</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go/shared#UserMessage">UserMessage</a>
4240

@@ -465,7 +463,6 @@ Params Types:
465463

466464
Response Types:
467465

468-
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#Metric">Metric</a>
469466
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#QuerySpansResponse">QuerySpansResponse</a>
470467
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#SpanWithStatus">SpanWithStatus</a>
471468
- <a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go">llamastackclient</a>.<a href="https://pkg.go.dev/github.com/llamastack/llama-stack-client-go#Trace">Trace</a>

inference.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ type ChatCompletionResponseStreamChunk struct {
120120
// The event containing the new content
121121
Event ChatCompletionResponseStreamChunkEvent `json:"event,required"`
122122
// (Optional) List of metrics associated with the API response
123-
Metrics []Metric `json:"metrics"`
123+
Metrics []shared.Metric `json:"metrics"`
124124
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
125125
JSON struct {
126126
Event respjson.Field

scoringfunction.go

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/llamastack/llama-stack-client-go/option"
1515
"github.com/llamastack/llama-stack-client-go/packages/param"
1616
"github.com/llamastack/llama-stack-client-go/packages/respjson"
17-
"github.com/llamastack/llama-stack-client-go/shared"
1817
"github.com/llamastack/llama-stack-client-go/shared/constant"
1918
)
2019

@@ -92,7 +91,7 @@ type ScoringFn struct {
9291
Identifier string `json:"identifier,required"`
9392
Metadata map[string]ScoringFnMetadataUnion `json:"metadata,required"`
9493
ProviderID string `json:"provider_id,required"`
95-
ReturnType shared.ReturnType `json:"return_type,required"`
94+
ReturnType ScoringFnReturnType `json:"return_type,required"`
9695
// The resource type, always scoring_function
9796
Type constant.ScoringFunction `json:"type,required"`
9897
Description string `json:"description"`
@@ -172,6 +171,24 @@ func (r *ScoringFnMetadataUnion) UnmarshalJSON(data []byte) error {
172171
return apijson.UnmarshalRoot(data, r)
173172
}
174173

174+
type ScoringFnReturnType struct {
175+
// Any of "string", "number", "boolean", "array", "object", "json", "union",
176+
// "chat_completion_input", "completion_input", "agent_turn_input".
177+
Type string `json:"type,required"`
178+
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
179+
JSON struct {
180+
Type respjson.Field
181+
ExtraFields map[string]respjson.Field
182+
raw string
183+
} `json:"-"`
184+
}
185+
186+
// Returns the unmodified JSON received from the API
187+
func (r ScoringFnReturnType) RawJSON() string { return r.JSON.raw }
188+
func (r *ScoringFnReturnType) UnmarshalJSON(data []byte) error {
189+
return apijson.UnmarshalRoot(data, r)
190+
}
191+
175192
// ScoringFnParamsUnionResp contains all possible properties and values from
176193
// [ScoringFnParamsLlmAsJudgeResp], [ScoringFnParamsRegexParserResp],
177194
// [ScoringFnParamsBasicResp].
@@ -541,8 +558,8 @@ func (r *ScoringFnParamsBasic) UnmarshalJSON(data []byte) error {
541558

542559
type ScoringFunctionRegisterParams struct {
543560
// The description of the scoring function.
544-
Description string `json:"description,required"`
545-
ReturnType shared.ReturnTypeParam `json:"return_type,omitzero,required"`
561+
Description string `json:"description,required"`
562+
ReturnType ScoringFunctionRegisterParamsReturnType `json:"return_type,omitzero,required"`
546563
// The ID of the scoring function to register.
547564
ScoringFnID string `json:"scoring_fn_id,required"`
548565
// The ID of the provider to use for the scoring function.
@@ -562,3 +579,25 @@ func (r ScoringFunctionRegisterParams) MarshalJSON() (data []byte, err error) {
562579
func (r *ScoringFunctionRegisterParams) UnmarshalJSON(data []byte) error {
563580
return apijson.UnmarshalRoot(data, r)
564581
}
582+
583+
// The property Type is required.
584+
type ScoringFunctionRegisterParamsReturnType struct {
585+
// Any of "string", "number", "boolean", "array", "object", "json", "union",
586+
// "chat_completion_input", "completion_input", "agent_turn_input".
587+
Type string `json:"type,omitzero,required"`
588+
paramObj
589+
}
590+
591+
func (r ScoringFunctionRegisterParamsReturnType) MarshalJSON() (data []byte, err error) {
592+
type shadow ScoringFunctionRegisterParamsReturnType
593+
return param.MarshalObject(r, (*shadow)(&r))
594+
}
595+
func (r *ScoringFunctionRegisterParamsReturnType) UnmarshalJSON(data []byte) error {
596+
return apijson.UnmarshalRoot(data, r)
597+
}
598+
599+
func init() {
600+
apijson.RegisterFieldValidator[ScoringFunctionRegisterParamsReturnType](
601+
"type", "string", "number", "boolean", "array", "object", "json", "union", "chat_completion_input", "completion_input", "agent_turn_input",
602+
)
603+
}

scoringfunction_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/llamastack/llama-stack-client-go"
1212
"github.com/llamastack/llama-stack-client-go/internal/testutil"
1313
"github.com/llamastack/llama-stack-client-go/option"
14-
"github.com/llamastack/llama-stack-client-go/shared"
1514
)
1615

1716
func TestScoringFunctionGet(t *testing.T) {
@@ -69,8 +68,8 @@ func TestScoringFunctionRegisterWithOptionalParams(t *testing.T) {
6968
)
7069
err := client.ScoringFunctions.Register(context.TODO(), llamastackclient.ScoringFunctionRegisterParams{
7170
Description: "description",
72-
ReturnType: shared.ReturnTypeParam{
73-
Type: shared.ReturnTypeTypeString,
71+
ReturnType: llamastackclient.ScoringFunctionRegisterParamsReturnType{
72+
Type: "string",
7473
},
7574
ScoringFnID: "scoring_fn_id",
7675
Params: llamastackclient.ScoringFnParamsUnion{

0 commit comments

Comments
 (0)