Skip to content

Commit 0b95836

Browse files
fix(client): fix circular dependencies and offset pagination
1 parent a3cccf1 commit 0b95836

26 files changed

+294
-866
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: 40b8d777e1eb8b6ab05759b663edd2fb
4+
config_hash: 374d9711288576877a9fabb34e4da7b9

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ To handle errors, we recommend that you use the `errors.As` pattern:
297297

298298
```go
299299
_, err := client.Inference.ChatCompletion(context.TODO(), llamastackclient.InferenceChatCompletionParams{
300-
Messages: []shared.MessageUnionParam{{
301-
OfUser: &shared.UserMessageParam{
302-
Content: shared.InterleavedContentUnionParam{
300+
Messages: []llamastackclient.MessageUnionParam{{
301+
OfUser: &llamastackclient.UserMessageParam{
302+
Content: llamastackclient.InterleavedContentUnionParam{
303303
OfString: llamastackclient.String("string"),
304304
},
305305
},
@@ -333,9 +333,9 @@ defer cancel()
333333
client.Inference.ChatCompletion(
334334
ctx,
335335
llamastackclient.InferenceChatCompletionParams{
336-
Messages: []shared.MessageUnionParam{{
337-
OfUser: &shared.UserMessageParam{
338-
Content: shared.InterleavedContentUnionParam{
336+
Messages: []llamastackclient.MessageUnionParam{{
337+
OfUser: &llamastackclient.UserMessageParam{
338+
Content: llamastackclient.InterleavedContentUnionParam{
339339
OfString: llamastackclient.String("string"),
340340
},
341341
},
@@ -399,9 +399,9 @@ client := llamastackclient.NewClient(
399399
client.Inference.ChatCompletion(
400400
context.TODO(),
401401
llamastackclient.InferenceChatCompletionParams{
402-
Messages: []shared.MessageUnionParam{{
403-
OfUser: &shared.UserMessageParam{
404-
Content: shared.InterleavedContentUnionParam{
402+
Messages: []llamastackclient.MessageUnionParam{{
403+
OfUser: &llamastackclient.UserMessageParam{
404+
Content: llamastackclient.InterleavedContentUnionParam{
405405
OfString: llamastackclient.String("string"),
406406
},
407407
},
@@ -423,9 +423,9 @@ var response *http.Response
423423
chatCompletionResponse, err := client.Inference.ChatCompletion(
424424
context.TODO(),
425425
llamastackclient.InferenceChatCompletionParams{
426-
Messages: []shared.MessageUnionParam{{
427-
OfUser: &shared.UserMessageParam{
428-
Content: shared.InterleavedContentUnionParam{
426+
Messages: []llamastackclient.MessageUnionParam{{
427+
OfUser: &llamastackclient.UserMessageParam{
428+
Content: llamastackclient.InterleavedContentUnionParam{
429429
OfString: llamastackclient.String("string"),
430430
},
431431
},

agent.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/llamastack/llama-stack-client-go/option"
1818
"github.com/llamastack/llama-stack-client-go/packages/param"
1919
"github.com/llamastack/llama-stack-client-go/packages/respjson"
20-
"github.com/llamastack/llama-stack-client-go/shared"
2120
"github.com/llamastack/llama-stack-client-go/shared/constant"
2221
)
2322

@@ -90,7 +89,7 @@ func (r *AgentService) Delete(ctx context.Context, agentID string, opts ...optio
9089
// An inference step in an agent turn.
9190
type InferenceStep struct {
9291
// The response from the LLM.
93-
ModelResponse shared.CompletionMessage `json:"model_response,required"`
92+
ModelResponse CompletionMessage `json:"model_response,required"`
9493
// The ID of the step.
9594
StepID string `json:"step_id,required"`
9695
// Type of the step in an agent turn.
@@ -123,7 +122,7 @@ func (r *InferenceStep) UnmarshalJSON(data []byte) error {
123122
// A memory retrieval step in an agent turn.
124123
type MemoryRetrievalStep struct {
125124
// The context retrieved from the vector databases.
126-
InsertedContext shared.InterleavedContentUnion `json:"inserted_context,required"`
125+
InsertedContext InterleavedContentUnion `json:"inserted_context,required"`
127126
// The ID of the step.
128127
StepID string `json:"step_id,required"`
129128
// Type of the step in an agent turn.
@@ -169,7 +168,7 @@ type ShieldCallStep struct {
169168
// The time the step started.
170169
StartedAt time.Time `json:"started_at" format:"date-time"`
171170
// The violation from the shield call.
172-
Violation shared.SafetyViolation `json:"violation"`
171+
Violation SafetyViolation `json:"violation"`
173172
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
174173
JSON struct {
175174
StepID respjson.Field
@@ -196,7 +195,7 @@ type ToolExecutionStep struct {
196195
// Type of the step in an agent turn.
197196
StepType constant.ToolExecution `json:"step_type,required"`
198197
// The tool calls to execute.
199-
ToolCalls []shared.ToolCall `json:"tool_calls,required"`
198+
ToolCalls []ToolCall `json:"tool_calls,required"`
200199
// The tool responses from the tool calls.
201200
ToolResponses []ToolResponse `json:"tool_responses,required"`
202201
// The ID of the turn.
@@ -230,7 +229,7 @@ type ToolResponse struct {
230229
// Unique identifier for the tool call this response is for
231230
CallID string `json:"call_id,required"`
232231
// The response content from the tool
233-
Content shared.InterleavedContentUnion `json:"content,required"`
232+
Content InterleavedContentUnion `json:"content,required"`
234233
// Name of the tool that was invoked
235234
ToolName ToolResponseToolName `json:"tool_name,required"`
236235
// (Optional) Additional metadata about the tool response
@@ -330,7 +329,7 @@ type ToolResponseParam struct {
330329
// Unique identifier for the tool call this response is for
331330
CallID string `json:"call_id,required"`
332331
// The response content from the tool
333-
Content shared.InterleavedContentUnionParam `json:"content,omitzero,required"`
332+
Content InterleavedContentUnionParam `json:"content,omitzero,required"`
334333
// Name of the tool that was invoked
335334
ToolName ToolResponseToolName `json:"tool_name,omitzero,required"`
336335
// (Optional) Additional metadata about the tool response
@@ -398,7 +397,7 @@ func (r *AgentNewResponse) UnmarshalJSON(data []byte) error {
398397
// An agent instance with configuration and metadata.
399398
type AgentGetResponse struct {
400399
// Configuration settings for the agent
401-
AgentConfig shared.AgentConfig `json:"agent_config,required"`
400+
AgentConfig AgentConfig `json:"agent_config,required"`
402401
// Unique identifier for the agent
403402
AgentID string `json:"agent_id,required"`
404403
// Timestamp when the agent was created
@@ -497,7 +496,7 @@ func (r *AgentListResponseDataUnion) UnmarshalJSON(data []byte) error {
497496

498497
type AgentNewParams struct {
499498
// The configuration for the agent.
500-
AgentConfig shared.AgentConfigParam `json:"agent_config,omitzero,required"`
499+
AgentConfig AgentConfigParam `json:"agent_config,omitzero,required"`
501500
paramObj
502501
}
503502

agent_test.go

Lines changed: 11 additions & 12 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 TestAgentNewWithOptionalParams(t *testing.T) {
@@ -26,7 +25,7 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
2625
option.WithBaseURL(baseURL),
2726
)
2827
_, err := client.Agents.New(context.TODO(), llamastackclient.AgentNewParams{
29-
AgentConfig: shared.AgentConfigParam{
28+
AgentConfig: llamastackclient.AgentConfigParam{
3029
Instructions: "instructions",
3130
Model: "model",
3231
ClientTools: []llamastackclient.ToolDefParam{{
@@ -52,31 +51,31 @@ func TestAgentNewWithOptionalParams(t *testing.T) {
5251
MaxInferIters: llamastackclient.Int(0),
5352
Name: llamastackclient.String("name"),
5453
OutputShields: []string{"string"},
55-
ResponseFormat: shared.ResponseFormatUnionParam{
56-
OfJsonSchema: &shared.ResponseFormatJsonSchemaParam{
57-
JsonSchema: map[string]shared.ResponseFormatJsonSchemaJsonSchemaUnionParam{
54+
ResponseFormat: llamastackclient.ResponseFormatUnionParam{
55+
OfJsonSchema: &llamastackclient.ResponseFormatJsonSchemaParam{
56+
JsonSchema: map[string]llamastackclient.ResponseFormatJsonSchemaJsonSchemaUnionParam{
5857
"foo": {
5958
OfBool: llamastackclient.Bool(true),
6059
},
6160
},
6261
},
6362
},
64-
SamplingParams: shared.SamplingParams{
65-
Strategy: shared.SamplingParamsStrategyUnion{
66-
OfGreedy: &shared.SamplingParamsStrategyGreedy{},
63+
SamplingParams: llamastackclient.SamplingParams{
64+
Strategy: llamastackclient.SamplingParamsStrategyUnion{
65+
OfGreedy: &llamastackclient.SamplingParamsStrategyGreedy{},
6766
},
6867
MaxTokens: llamastackclient.Int(0),
6968
RepetitionPenalty: llamastackclient.Float(0),
7069
Stop: []string{"string"},
7170
},
72-
ToolChoice: shared.AgentConfigToolChoiceAuto,
73-
ToolConfig: shared.AgentConfigToolConfigParam{
71+
ToolChoice: llamastackclient.AgentConfigToolChoiceAuto,
72+
ToolConfig: llamastackclient.AgentConfigToolConfigParam{
7473
SystemMessageBehavior: "append",
7574
ToolChoice: "auto",
7675
ToolPromptFormat: "json",
7776
},
78-
ToolPromptFormat: shared.AgentConfigToolPromptFormatJson,
79-
Toolgroups: []shared.AgentConfigToolgroupUnionParam{{
77+
ToolPromptFormat: llamastackclient.AgentConfigToolPromptFormatJson,
78+
Toolgroups: []llamastackclient.AgentConfigToolgroupUnionParam{{
8079
OfString: llamastackclient.String("string"),
8180
}},
8281
},

agentstep.go

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

2019
// AgentStepService contains methods and other services that help with interacting
@@ -86,21 +85,21 @@ func (r *AgentStepGetResponse) UnmarshalJSON(data []byte) error {
8685
// Use the methods beginning with 'As' to cast the union to one of its variants.
8786
type AgentStepGetResponseStepUnion struct {
8887
// This field is from variant [InferenceStep].
89-
ModelResponse shared.CompletionMessage `json:"model_response"`
90-
StepID string `json:"step_id"`
88+
ModelResponse CompletionMessage `json:"model_response"`
89+
StepID string `json:"step_id"`
9190
// Any of "inference", "tool_execution", "shield_call", "memory_retrieval".
9291
StepType string `json:"step_type"`
9392
TurnID string `json:"turn_id"`
9493
CompletedAt time.Time `json:"completed_at"`
9594
StartedAt time.Time `json:"started_at"`
9695
// This field is from variant [ToolExecutionStep].
97-
ToolCalls []shared.ToolCall `json:"tool_calls"`
96+
ToolCalls []ToolCall `json:"tool_calls"`
9897
// This field is from variant [ToolExecutionStep].
9998
ToolResponses []ToolResponse `json:"tool_responses"`
10099
// This field is from variant [ShieldCallStep].
101-
Violation shared.SafetyViolation `json:"violation"`
100+
Violation SafetyViolation `json:"violation"`
102101
// This field is from variant [MemoryRetrievalStep].
103-
InsertedContext shared.InterleavedContentUnion `json:"inserted_context"`
102+
InsertedContext InterleavedContentUnion `json:"inserted_context"`
104103
// This field is from variant [MemoryRetrievalStep].
105104
VectorDBIDs string `json:"vector_db_ids"`
106105
JSON struct {

0 commit comments

Comments
 (0)