From 027470e066ea6bbca1aeeb4fb9a8a3430babb84c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 19:35:50 +0000 Subject: [PATCH] chore: deprecate Assistants API --- .stats.yml | 2 +- beta.go | 3 ++- betathread.go | 20 ++++++++++++++++++-- betathreadmessage.go | 14 ++++++++++++++ betathreadrun.go | 23 ++++++++++++++++++++++- betathreadrunstep.go | 8 ++++++++ 6 files changed, 65 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 891ca72..5c38095 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 535b6e5f26a295d609b259c8cb8f656c +config_hash: 3b590818075ca4b54949578b97494525 diff --git a/beta.go b/beta.go index c426f35..79fb960 100644 --- a/beta.go +++ b/beta.go @@ -15,7 +15,8 @@ import ( type BetaService struct { Options []option.RequestOption Assistants BetaAssistantService - Threads BetaThreadService + // Deprecated: The Assistants API is deprecated in favor of the Responses API + Threads BetaThreadService } // NewBetaService generates a new service that applies the given options to each diff --git a/betathread.go b/betathread.go index 783c7e9..df8da48 100644 --- a/betathread.go +++ b/betathread.go @@ -25,9 +25,13 @@ import ( // Note, unlike clients, this service does not read variables from the environment // automatically. You should not instantiate this service directly, and instead use // the [NewBetaThreadService] method instead. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API type BetaThreadService struct { - Options []option.RequestOption - Runs BetaThreadRunService + Options []option.RequestOption + // Deprecated: The Assistants API is deprecated in favor of the Responses API + Runs BetaThreadRunService + // Deprecated: The Assistants API is deprecated in favor of the Responses API Messages BetaThreadMessageService } @@ -43,6 +47,8 @@ func NewBetaThreadService(opts ...option.RequestOption) (r BetaThreadService) { } // Create a thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadService) New(ctx context.Context, body BetaThreadNewParams, opts ...option.RequestOption) (res *Thread, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -52,6 +58,8 @@ func (r *BetaThreadService) New(ctx context.Context, body BetaThreadNewParams, o } // Retrieves a thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadService) Get(ctx context.Context, threadID string, opts ...option.RequestOption) (res *Thread, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -65,6 +73,8 @@ func (r *BetaThreadService) Get(ctx context.Context, threadID string, opts ...op } // Modifies a thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadService) Update(ctx context.Context, threadID string, body BetaThreadUpdateParams, opts ...option.RequestOption) (res *Thread, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -78,6 +88,8 @@ func (r *BetaThreadService) Update(ctx context.Context, threadID string, body Be } // Delete a thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadService) Delete(ctx context.Context, threadID string, opts ...option.RequestOption) (res *ThreadDeleted, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -91,6 +103,8 @@ func (r *BetaThreadService) Delete(ctx context.Context, threadID string, opts .. } // Create a thread and run it in one request. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadService) NewAndRun(ctx context.Context, body BetaThreadNewAndRunParams, opts ...option.RequestOption) (res *Run, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -100,6 +114,8 @@ func (r *BetaThreadService) NewAndRun(ctx context.Context, body BetaThreadNewAnd } // Create a thread and run it in one request. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadService) NewAndRunStreaming(ctx context.Context, body BetaThreadNewAndRunParams, opts ...option.RequestOption) (stream *ssestream.Stream[AssistantStreamEventUnion]) { var ( raw *http.Response diff --git a/betathreadmessage.go b/betathreadmessage.go index 69d2fe9..f02b393 100644 --- a/betathreadmessage.go +++ b/betathreadmessage.go @@ -27,6 +27,8 @@ import ( // Note, unlike clients, this service does not read variables from the environment // automatically. You should not instantiate this service directly, and instead use // the [NewBetaThreadMessageService] method instead. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API type BetaThreadMessageService struct { Options []option.RequestOption } @@ -41,6 +43,8 @@ func NewBetaThreadMessageService(opts ...option.RequestOption) (r BetaThreadMess } // Create a message. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadMessageService) New(ctx context.Context, threadID string, body BetaThreadMessageNewParams, opts ...option.RequestOption) (res *Message, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -54,6 +58,8 @@ func (r *BetaThreadMessageService) New(ctx context.Context, threadID string, bod } // Retrieve a message. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, messageID string, opts ...option.RequestOption) (res *Message, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -71,6 +77,8 @@ func (r *BetaThreadMessageService) Get(ctx context.Context, threadID string, mes } // Modifies a message. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string, messageID string, body BetaThreadMessageUpdateParams, opts ...option.RequestOption) (res *Message, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -88,6 +96,8 @@ func (r *BetaThreadMessageService) Update(ctx context.Context, threadID string, } // Returns a list of messages for a given thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadMessageService) List(ctx context.Context, threadID string, query BetaThreadMessageListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Message], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -110,11 +120,15 @@ func (r *BetaThreadMessageService) List(ctx context.Context, threadID string, qu } // Returns a list of messages for a given thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadMessageService) ListAutoPaging(ctx context.Context, threadID string, query BetaThreadMessageListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Message] { return pagination.NewCursorPageAutoPager(r.List(ctx, threadID, query, opts...)) } // Deletes a message. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadMessageService) Delete(ctx context.Context, threadID string, messageID string, opts ...option.RequestOption) (res *MessageDeleted, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) diff --git a/betathreadrun.go b/betathreadrun.go index 1841973..32c235a 100644 --- a/betathreadrun.go +++ b/betathreadrun.go @@ -27,9 +27,12 @@ import ( // Note, unlike clients, this service does not read variables from the environment // automatically. You should not instantiate this service directly, and instead use // the [NewBetaThreadRunService] method instead. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API type BetaThreadRunService struct { Options []option.RequestOption - Steps BetaThreadRunStepService + // Deprecated: The Assistants API is deprecated in favor of the Responses API + Steps BetaThreadRunStepService } // NewBetaThreadRunService generates a new service that applies the given options @@ -43,6 +46,8 @@ func NewBetaThreadRunService(opts ...option.RequestOption) (r BetaThreadRunServi } // Create a run. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) New(ctx context.Context, threadID string, params BetaThreadRunNewParams, opts ...option.RequestOption) (res *Run, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -56,6 +61,8 @@ func (r *BetaThreadRunService) New(ctx context.Context, threadID string, params } // Create a run. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string, params BetaThreadRunNewParams, opts ...option.RequestOption) (stream *ssestream.Stream[AssistantStreamEventUnion]) { var ( raw *http.Response @@ -73,6 +80,8 @@ func (r *BetaThreadRunService) NewStreaming(ctx context.Context, threadID string } // Retrieves a run. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID string, opts ...option.RequestOption) (res *Run, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -90,6 +99,8 @@ func (r *BetaThreadRunService) Get(ctx context.Context, threadID string, runID s } // Modifies a run. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runID string, body BetaThreadRunUpdateParams, opts ...option.RequestOption) (res *Run, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -107,6 +118,8 @@ func (r *BetaThreadRunService) Update(ctx context.Context, threadID string, runI } // Returns a list of runs belonging to a thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) List(ctx context.Context, threadID string, query BetaThreadRunListParams, opts ...option.RequestOption) (res *pagination.CursorPage[Run], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -129,11 +142,15 @@ func (r *BetaThreadRunService) List(ctx context.Context, threadID string, query } // Returns a list of runs belonging to a thread. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) ListAutoPaging(ctx context.Context, threadID string, query BetaThreadRunListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[Run] { return pagination.NewCursorPageAutoPager(r.List(ctx, threadID, query, opts...)) } // Cancels a run that is `in_progress`. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runID string, opts ...option.RequestOption) (res *Run, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -154,6 +171,8 @@ func (r *BetaThreadRunService) Cancel(ctx context.Context, threadID string, runI // `submit_tool_outputs`, this endpoint can be used to submit the outputs from the // tool calls once they're all completed. All outputs must be submitted in a single // request. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID string, runID string, body BetaThreadRunSubmitToolOutputsParams, opts ...option.RequestOption) (res *Run, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -174,6 +193,8 @@ func (r *BetaThreadRunService) SubmitToolOutputs(ctx context.Context, threadID s // `submit_tool_outputs`, this endpoint can be used to submit the outputs from the // tool calls once they're all completed. All outputs must be submitted in a single // request. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunService) SubmitToolOutputsStreaming(ctx context.Context, threadID string, runID string, body BetaThreadRunSubmitToolOutputsParams, opts ...option.RequestOption) (stream *ssestream.Stream[AssistantStreamEventUnion]) { var ( raw *http.Response diff --git a/betathreadrunstep.go b/betathreadrunstep.go index e3466e1..1ae783e 100644 --- a/betathreadrunstep.go +++ b/betathreadrunstep.go @@ -27,6 +27,8 @@ import ( // Note, unlike clients, this service does not read variables from the environment // automatically. You should not instantiate this service directly, and instead use // the [NewBetaThreadRunStepService] method instead. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API type BetaThreadRunStepService struct { Options []option.RequestOption } @@ -41,6 +43,8 @@ func NewBetaThreadRunStepService(opts ...option.RequestOption) (r BetaThreadRunS } // Retrieves a run step. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, runID string, stepID string, query BetaThreadRunStepGetParams, opts ...option.RequestOption) (res *RunStep, err error) { opts = append(r.Options[:], opts...) opts = append([]option.RequestOption{option.WithHeader("OpenAI-Beta", "assistants=v2")}, opts...) @@ -62,6 +66,8 @@ func (r *BetaThreadRunStepService) Get(ctx context.Context, threadID string, run } // Returns a list of run steps belonging to a run. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunStepService) List(ctx context.Context, threadID string, runID string, query BetaThreadRunStepListParams, opts ...option.RequestOption) (res *pagination.CursorPage[RunStep], err error) { var raw *http.Response opts = append(r.Options[:], opts...) @@ -88,6 +94,8 @@ func (r *BetaThreadRunStepService) List(ctx context.Context, threadID string, ru } // Returns a list of run steps belonging to a run. +// +// Deprecated: The Assistants API is deprecated in favor of the Responses API func (r *BetaThreadRunStepService) ListAutoPaging(ctx context.Context, threadID string, runID string, query BetaThreadRunStepListParams, opts ...option.RequestOption) *pagination.CursorPageAutoPager[RunStep] { return pagination.NewCursorPageAutoPager(r.List(ctx, threadID, runID, query, opts...)) }