feat(client): add helper method to generate constant structs

This commit is contained in:
stainless-app[bot]
2025-04-30 13:45:03 +00:00
parent d69caab3fd
commit 92b233ef44
7 changed files with 104 additions and 39 deletions

View File

@@ -1551,11 +1551,16 @@ func (r CodeInterpreterTool) ToParam() CodeInterpreterToolParam {
return param.OverrideObj[CodeInterpreterToolParam](r.RawJSON())
}
// The property Type is required.
func NewCodeInterpreterToolParam() CodeInterpreterToolParam {
return CodeInterpreterToolParam{
Type: "code_interpreter",
}
}
// This struct has a constant value, construct it with
// [NewCodeInterpreterToolParam].
type CodeInterpreterToolParam struct {
// The type of tool being defined: `code_interpreter`
//
// This field can be elided, and will marshal its zero value as "code_interpreter".
Type constant.CodeInterpreter `json:"type,required"`
paramObj
}
@@ -2027,14 +2032,19 @@ func init() {
)
}
func NewBetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto() BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto {
return BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto{
Type: "auto",
}
}
// The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
// `800` and `chunk_overlap_tokens` of `400`.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewBetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto].
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct {
// Always `auto`.
//
// This field can be elided, and will marshal its zero value as "auto".
Type constant.Auto `json:"type,required"`
paramObj
}

View File

@@ -730,11 +730,16 @@ func init() {
)
}
// The property Type is required.
func NewBetaThreadNewParamsMessageAttachmentToolFileSearch() BetaThreadNewParamsMessageAttachmentToolFileSearch {
return BetaThreadNewParamsMessageAttachmentToolFileSearch{
Type: "file_search",
}
}
// This struct has a constant value, construct it with
// [NewBetaThreadNewParamsMessageAttachmentToolFileSearch].
type BetaThreadNewParamsMessageAttachmentToolFileSearch struct {
// The type of tool being defined: `file_search`
//
// This field can be elided, and will marshal its zero value as "file_search".
Type constant.FileSearch `json:"type,required"`
paramObj
}
@@ -898,14 +903,19 @@ func init() {
)
}
func NewBetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto() BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto {
return BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto{
Type: "auto",
}
}
// The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
// `800` and `chunk_overlap_tokens` of `400`.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewBetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto].
type BetaThreadNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct {
// Always `auto`.
//
// This field can be elided, and will marshal its zero value as "auto".
Type constant.Auto `json:"type,required"`
paramObj
}
@@ -1313,11 +1323,16 @@ func init() {
)
}
// The property Type is required.
func NewBetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch() BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch {
return BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch{
Type: "file_search",
}
}
// This struct has a constant value, construct it with
// [NewBetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch].
type BetaThreadNewAndRunParamsThreadMessageAttachmentToolFileSearch struct {
// The type of tool being defined: `file_search`
//
// This field can be elided, and will marshal its zero value as "file_search".
Type constant.FileSearch `json:"type,required"`
paramObj
}
@@ -1483,14 +1498,19 @@ func init() {
)
}
func NewBetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto() BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto {
return BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto{
Type: "auto",
}
}
// The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
// `800` and `chunk_overlap_tokens` of `400`.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewBetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto].
type BetaThreadNewAndRunParamsThreadToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct {
// Always `auto`.
//
// This field can be elided, and will marshal its zero value as "auto".
Type constant.Auto `json:"type,required"`
paramObj
}

View File

@@ -1672,11 +1672,16 @@ func init() {
)
}
// The property Type is required.
func NewBetaThreadMessageNewParamsAttachmentToolFileSearch() BetaThreadMessageNewParamsAttachmentToolFileSearch {
return BetaThreadMessageNewParamsAttachmentToolFileSearch{
Type: "file_search",
}
}
// This struct has a constant value, construct it with
// [NewBetaThreadMessageNewParamsAttachmentToolFileSearch].
type BetaThreadMessageNewParamsAttachmentToolFileSearch struct {
// The type of tool being defined: `file_search`
//
// This field can be elided, and will marshal its zero value as "file_search".
Type constant.FileSearch `json:"type,required"`
paramObj
}

View File

@@ -822,11 +822,16 @@ func init() {
)
}
// The property Type is required.
func NewBetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch() BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch {
return BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch{
Type: "file_search",
}
}
// This struct has a constant value, construct it with
// [NewBetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch].
type BetaThreadRunNewParamsAdditionalMessageAttachmentToolFileSearch struct {
// The type of tool being defined: `file_search`
//
// This field can be elided, and will marshal its zero value as "file_search".
Type constant.FileSearch `json:"type,required"`
paramObj
}

View File

@@ -2158,14 +2158,19 @@ func (r ResponseComputerToolCallActionMoveParam) MarshalJSON() (data []byte, err
return param.MarshalObject(r, (*shadow)(&r))
}
func NewResponseComputerToolCallActionScreenshotParam() ResponseComputerToolCallActionScreenshotParam {
return ResponseComputerToolCallActionScreenshotParam{
Type: "screenshot",
}
}
// A screenshot action.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewResponseComputerToolCallActionScreenshotParam].
type ResponseComputerToolCallActionScreenshotParam struct {
// Specifies the event type. For a screenshot action, this property is always set
// to `screenshot`.
//
// This field can be elided, and will marshal its zero value as "screenshot".
Type constant.Screenshot `json:"type,required"`
paramObj
}
@@ -2234,14 +2239,19 @@ func (r ResponseComputerToolCallActionTypeParam) MarshalJSON() (data []byte, err
return param.MarshalObject(r, (*shadow)(&r))
}
func NewResponseComputerToolCallActionWaitParam() ResponseComputerToolCallActionWaitParam {
return ResponseComputerToolCallActionWaitParam{
Type: "wait",
}
}
// A wait action.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewResponseComputerToolCallActionWaitParam].
type ResponseComputerToolCallActionWaitParam struct {
// Specifies the event type. For a wait action, this property is always set to
// `wait`.
//
// This field can be elided, and will marshal its zero value as "wait".
Type constant.Wait `json:"type,required"`
paramObj
}

View File

@@ -583,15 +583,20 @@ func (r ResponseFormatJSONObject) ToParam() ResponseFormatJSONObjectParam {
return param.OverrideObj[ResponseFormatJSONObjectParam](r.RawJSON())
}
func NewResponseFormatJSONObjectParam() ResponseFormatJSONObjectParam {
return ResponseFormatJSONObjectParam{
Type: "json_object",
}
}
// JSON object response format. An older method of generating JSON responses. Using
// `json_schema` is recommended for models that support it. Note that the model
// will not generate JSON without a system or user message instructing it to do so.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewResponseFormatJSONObjectParam].
type ResponseFormatJSONObjectParam struct {
// The type of response format being defined. Always `json_object`.
//
// This field can be elided, and will marshal its zero value as "json_object".
Type constant.JSONObject `json:"type,required"`
paramObj
}
@@ -758,13 +763,18 @@ func (r ResponseFormatText) ToParam() ResponseFormatTextParam {
return param.OverrideObj[ResponseFormatTextParam](r.RawJSON())
}
func NewResponseFormatTextParam() ResponseFormatTextParam {
return ResponseFormatTextParam{
Type: "text",
}
}
// Default response format. Used to generate text responses.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewResponseFormatTextParam].
type ResponseFormatTextParam struct {
// The type of response format being defined. Always `text`.
//
// This field can be elided, and will marshal its zero value as "text".
Type constant.Text `json:"type,required"`
paramObj
}

View File

@@ -146,14 +146,19 @@ func (r *VectorStoreService) SearchAutoPaging(ctx context.Context, vectorStoreID
return pagination.NewPageAutoPager(r.Search(ctx, vectorStoreID, body, opts...))
}
func NewAutoFileChunkingStrategyParam() AutoFileChunkingStrategyParam {
return AutoFileChunkingStrategyParam{
Type: "auto",
}
}
// The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
// `800` and `chunk_overlap_tokens` of `400`.
//
// The property Type is required.
// This struct has a constant value, construct it with
// [NewAutoFileChunkingStrategyParam].
type AutoFileChunkingStrategyParam struct {
// Always `auto`.
//
// This field can be elided, and will marshal its zero value as "auto".
Type constant.Auto `json:"type,required"`
paramObj
}