Skip to content

Commit d3f850b

Browse files
feat(api): sync
1 parent 5444c7c commit d3f850b

14 files changed

+232
-73
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 104
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-2acd62f8d5c4523bad4ddb2cc50608135249858b7047a71b48e25befa1e1f43f.yml
3-
openapi_spec_hash: 1ad726ff81dc21720c8c3443d33c0562
4-
config_hash: 734f75f2a6b46155e1852d378118b5e8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-fcaa960dc2de2029f4f67f13ff1d0fc1ff70e683810ed9739be805debef1673d.yml
3+
openapi_spec_hash: a25e7616ad6230f872b46c2cb6fa0a96
4+
config_hash: ff421daf28f90ad4bd4e13f374b18a00

README.md

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ import (
5353

5454
func main() {
5555
client := llamastackclient.NewClient()
56-
healthInfo, err := client.Inspect.Health(context.TODO())
56+
model, err := client.Models.Register(context.TODO(), llamastackclient.ModelRegisterParams{
57+
ModelID: "model_id",
58+
})
5759
if err != nil {
5860
panic(err.Error())
5961
}
60-
fmt.Printf("%+v\n", healthInfo.Status)
62+
fmt.Printf("%+v\n", model.Identifier)
6163
}
6264

6365
```
@@ -263,7 +265,7 @@ client := llamastackclient.NewClient(
263265
option.WithHeader("X-Some-Header", "custom_header_info"),
264266
)
265267

266-
client.Inspect.Health(context.TODO(), ...,
268+
client.Chat.Completions.New(context.TODO(), ...,
267269
// Override the header
268270
option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
269271
// Add an undocumented field to the request body, using sjson syntax
@@ -294,14 +296,23 @@ When the API returns a non-success status code, we return an error with type
294296
To handle errors, we recommend that you use the `errors.As` pattern:
295297

296298
```go
297-
_, err := client.Inspect.Health(context.TODO())
299+
_, err := client.Chat.Completions.New(context.TODO(), llamastackclient.ChatCompletionNewParams{
300+
Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
301+
OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
302+
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
303+
OfString: llamastackclient.String("string"),
304+
},
305+
},
306+
}},
307+
Model: "model",
308+
})
298309
if err != nil {
299310
var apierr *llamastackclient.Error
300311
if errors.As(err, &apierr) {
301312
println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request
302313
println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
303314
}
304-
panic(err.Error()) // GET "/v1/health": 400 Bad Request { ... }
315+
panic(err.Error()) // GET "/v1/chat/completions": 400 Bad Request { ... }
305316
}
306317
```
307318

@@ -319,8 +330,18 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
319330
// This sets the timeout for the request, including all the retries.
320331
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
321332
defer cancel()
322-
client.Inspect.Health(
333+
client.Chat.Completions.New(
323334
ctx,
335+
llamastackclient.ChatCompletionNewParams{
336+
Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
337+
OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
338+
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
339+
OfString: llamastackclient.String("string"),
340+
},
341+
},
342+
}},
343+
Model: "model",
344+
},
324345
// This sets the per-retry timeout
325346
option.WithRequestTimeout(20*time.Second),
326347
)
@@ -375,7 +396,20 @@ client := llamastackclient.NewClient(
375396
)
376397

377398
// Override per-request:
378-
client.Inspect.Health(context.TODO(), option.WithMaxRetries(5))
399+
client.Chat.Completions.New(
400+
context.TODO(),
401+
llamastackclient.ChatCompletionNewParams{
402+
Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
403+
OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
404+
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
405+
OfString: llamastackclient.String("string"),
406+
},
407+
},
408+
}},
409+
Model: "model",
410+
},
411+
option.WithMaxRetries(5),
412+
)
379413
```
380414

381415
### Accessing raw response data (e.g. response headers)
@@ -386,11 +420,24 @@ you need to examine response headers, status codes, or other details.
386420
```go
387421
// Create a variable to store the HTTP response
388422
var response *http.Response
389-
healthInfo, err := client.Inspect.Health(context.TODO(), option.WithResponseInto(&response))
423+
completion, err := client.Chat.Completions.New(
424+
context.TODO(),
425+
llamastackclient.ChatCompletionNewParams{
426+
Messages: []llamastackclient.ChatCompletionNewParamsMessageUnion{{
427+
OfUser: &llamastackclient.ChatCompletionNewParamsMessageUser{
428+
Content: llamastackclient.ChatCompletionNewParamsMessageUserContentUnion{
429+
OfString: llamastackclient.String("string"),
430+
},
431+
},
432+
}},
433+
Model: "model",
434+
},
435+
option.WithResponseInto(&response),
436+
)
390437
if err != nil {
391438
// handle error
392439
}
393-
fmt.Printf("%+v\n", healthInfo)
440+
fmt.Printf("%+v\n", completion)
394441

395442
fmt.Printf("Status Code: %d\n", response.StatusCode)
396443
fmt.Printf("Headers: %+#v\n", response.Header)

alphaagent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type MemoryRetrievalStep struct {
131131
// The ID of the turn.
132132
TurnID string `json:"turn_id,required"`
133133
// The IDs of the vector databases to retrieve context from.
134-
VectorStoreIDs string `json:"vector_store_ids,required"`
134+
VectorDBIDs string `json:"vector_db_ids,required"`
135135
// The time the step completed.
136136
CompletedAt time.Time `json:"completed_at" format:"date-time"`
137137
// The time the step started.
@@ -142,7 +142,7 @@ type MemoryRetrievalStep struct {
142142
StepID respjson.Field
143143
StepType respjson.Field
144144
TurnID respjson.Field
145-
VectorStoreIDs respjson.Field
145+
VectorDBIDs respjson.Field
146146
CompletedAt respjson.Field
147147
StartedAt respjson.Field
148148
ExtraFields map[string]respjson.Field

alphaagentstep.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ type AlphaAgentStepGetResponseStepUnion struct {
104104
// This field is from variant [MemoryRetrievalStep].
105105
InsertedContext InterleavedContentUnion `json:"inserted_context"`
106106
// This field is from variant [MemoryRetrievalStep].
107-
VectorStoreIDs string `json:"vector_store_ids"`
108-
JSON struct {
107+
VectorDBIDs string `json:"vector_db_ids"`
108+
JSON struct {
109109
ModelResponse respjson.Field
110110
StepID respjson.Field
111111
StepType respjson.Field
@@ -116,7 +116,7 @@ type AlphaAgentStepGetResponseStepUnion struct {
116116
ToolResponses respjson.Field
117117
Violation respjson.Field
118118
InsertedContext respjson.Field
119-
VectorStoreIDs respjson.Field
119+
VectorDBIDs respjson.Field
120120
raw string
121121
} `json:"-"`
122122
}

alphaagentturn.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ type TurnStepUnion struct {
266266
// This field is from variant [MemoryRetrievalStep].
267267
InsertedContext InterleavedContentUnion `json:"inserted_context"`
268268
// This field is from variant [MemoryRetrievalStep].
269-
VectorStoreIDs string `json:"vector_store_ids"`
270-
JSON struct {
269+
VectorDBIDs string `json:"vector_db_ids"`
270+
JSON struct {
271271
ModelResponse respjson.Field
272272
StepID respjson.Field
273273
StepType respjson.Field
@@ -278,7 +278,7 @@ type TurnStepUnion struct {
278278
ToolResponses respjson.Field
279279
Violation respjson.Field
280280
InsertedContext respjson.Field
281-
VectorStoreIDs respjson.Field
281+
VectorDBIDs respjson.Field
282282
raw string
283283
} `json:"-"`
284284
}
@@ -1033,8 +1033,8 @@ type TurnResponseEventPayloadStepCompleteStepDetailsUnion struct {
10331033
// This field is from variant [MemoryRetrievalStep].
10341034
InsertedContext InterleavedContentUnion `json:"inserted_context"`
10351035
// This field is from variant [MemoryRetrievalStep].
1036-
VectorStoreIDs string `json:"vector_store_ids"`
1037-
JSON struct {
1036+
VectorDBIDs string `json:"vector_db_ids"`
1037+
JSON struct {
10381038
ModelResponse respjson.Field
10391039
StepID respjson.Field
10401040
StepType respjson.Field
@@ -1045,7 +1045,7 @@ type TurnResponseEventPayloadStepCompleteStepDetailsUnion struct {
10451045
ToolResponses respjson.Field
10461046
Violation respjson.Field
10471047
InsertedContext respjson.Field
1048-
VectorStoreIDs respjson.Field
1048+
VectorDBIDs respjson.Field
10491049
raw string
10501050
} `json:"-"`
10511051
}

0 commit comments

Comments
 (0)