Skip to content

Commit e907067

Browse files
meorphisstainless-app[bot]
meorphis
authored andcommitted
chore(internal): bugfix
1 parent 0ddf973 commit e907067

File tree

6 files changed

+479
-235
lines changed

6 files changed

+479
-235
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 80
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bc8df9bcbd9a3b1822bcbe38af92d0cf289acded43aa5aebc2bc503b186af89.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml

api.md

-2
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,10 @@ Methods:
339339

340340
Params Types:
341341

342-
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#AssisstantVectorStoreChunkingStrategyUnionParam">AssisstantVectorStoreChunkingStrategyUnionParam</a>
343342
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#AssistantResponseFormatOptionUnionParam">AssistantResponseFormatOptionUnionParam</a>
344343
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#AssistantToolChoiceParam">AssistantToolChoiceParam</a>
345344
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#AssistantToolChoiceFunctionParam">AssistantToolChoiceFunctionParam</a>
346345
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#AssistantToolChoiceOptionUnionParam">AssistantToolChoiceOptionUnionParam</a>
347-
- <a href="https://pkg.go.dev/github.com/openai/openai-go">openai</a>.<a href="https://pkg.go.dev/github.com/openai/openai-go#AssistantToolResourcesParam">AssistantToolResourcesParam</a>
348346

349347
Response Types:
350348

betaassistant.go

+216-1
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ type BetaAssistantNewParams struct {
17961796
// specific to the type of tool. For example, the `code_interpreter` tool requires
17971797
// a list of file IDs, while the `file_search` tool requires a list of vector store
17981798
// IDs.
1799-
ToolResources AssistantToolResourcesParam `json:"tool_resources,omitzero"`
1799+
ToolResources BetaAssistantNewParamsToolResources `json:"tool_resources,omitzero"`
18001800
// Specifies the format that the model must output. Compatible with
18011801
// [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
18021802
// [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
@@ -1834,6 +1834,221 @@ func (r BetaAssistantNewParams) MarshalJSON() (data []byte, err error) {
18341834
return param.MarshalObject(r, (*shadow)(&r))
18351835
}
18361836

1837+
// A set of resources that are used by the assistant's tools. The resources are
1838+
// specific to the type of tool. For example, the `code_interpreter` tool requires
1839+
// a list of file IDs, while the `file_search` tool requires a list of vector store
1840+
// IDs.
1841+
type BetaAssistantNewParamsToolResources struct {
1842+
CodeInterpreter BetaAssistantNewParamsToolResourcesCodeInterpreter `json:"code_interpreter,omitzero"`
1843+
FileSearch BetaAssistantNewParamsToolResourcesFileSearch `json:"file_search,omitzero"`
1844+
paramObj
1845+
}
1846+
1847+
// IsPresent returns true if the field's value is not omitted and not the JSON
1848+
// "null". To check if this field is omitted, use [param.IsOmitted].
1849+
func (f BetaAssistantNewParamsToolResources) IsPresent() bool {
1850+
return !param.IsOmitted(f) && !f.IsNull()
1851+
}
1852+
func (r BetaAssistantNewParamsToolResources) MarshalJSON() (data []byte, err error) {
1853+
type shadow BetaAssistantNewParamsToolResources
1854+
return param.MarshalObject(r, (*shadow)(&r))
1855+
}
1856+
1857+
type BetaAssistantNewParamsToolResourcesCodeInterpreter struct {
1858+
// A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made
1859+
// available to the `code_interpreter` tool. There can be a maximum of 20 files
1860+
// associated with the tool.
1861+
FileIDs []string `json:"file_ids,omitzero"`
1862+
paramObj
1863+
}
1864+
1865+
// IsPresent returns true if the field's value is not omitted and not the JSON
1866+
// "null". To check if this field is omitted, use [param.IsOmitted].
1867+
func (f BetaAssistantNewParamsToolResourcesCodeInterpreter) IsPresent() bool {
1868+
return !param.IsOmitted(f) && !f.IsNull()
1869+
}
1870+
func (r BetaAssistantNewParamsToolResourcesCodeInterpreter) MarshalJSON() (data []byte, err error) {
1871+
type shadow BetaAssistantNewParamsToolResourcesCodeInterpreter
1872+
return param.MarshalObject(r, (*shadow)(&r))
1873+
}
1874+
1875+
type BetaAssistantNewParamsToolResourcesFileSearch struct {
1876+
// The
1877+
// [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1878+
// attached to this assistant. There can be a maximum of 1 vector store attached to
1879+
// the assistant.
1880+
VectorStoreIDs []string `json:"vector_store_ids,omitzero"`
1881+
// A helper to create a
1882+
// [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
1883+
// with file_ids and attach it to this assistant. There can be a maximum of 1
1884+
// vector store attached to the assistant.
1885+
VectorStores []BetaAssistantNewParamsToolResourcesFileSearchVectorStore `json:"vector_stores,omitzero"`
1886+
paramObj
1887+
}
1888+
1889+
// IsPresent returns true if the field's value is not omitted and not the JSON
1890+
// "null". To check if this field is omitted, use [param.IsOmitted].
1891+
func (f BetaAssistantNewParamsToolResourcesFileSearch) IsPresent() bool {
1892+
return !param.IsOmitted(f) && !f.IsNull()
1893+
}
1894+
func (r BetaAssistantNewParamsToolResourcesFileSearch) MarshalJSON() (data []byte, err error) {
1895+
type shadow BetaAssistantNewParamsToolResourcesFileSearch
1896+
return param.MarshalObject(r, (*shadow)(&r))
1897+
}
1898+
1899+
type BetaAssistantNewParamsToolResourcesFileSearchVectorStore struct {
1900+
// Set of 16 key-value pairs that can be attached to an object. This can be useful
1901+
// for storing additional information about the object in a structured format, and
1902+
// querying for objects via API or the dashboard.
1903+
//
1904+
// Keys are strings with a maximum length of 64 characters. Values are strings with
1905+
// a maximum length of 512 characters.
1906+
Metadata shared.MetadataParam `json:"metadata,omitzero"`
1907+
// The chunking strategy used to chunk the file(s). If not set, will use the `auto`
1908+
// strategy.
1909+
ChunkingStrategy BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion `json:"chunking_strategy,omitzero"`
1910+
// A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to
1911+
// add to the vector store. There can be a maximum of 10000 files in a vector
1912+
// store.
1913+
FileIDs []string `json:"file_ids,omitzero"`
1914+
paramObj
1915+
}
1916+
1917+
// IsPresent returns true if the field's value is not omitted and not the JSON
1918+
// "null". To check if this field is omitted, use [param.IsOmitted].
1919+
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStore) IsPresent() bool {
1920+
return !param.IsOmitted(f) && !f.IsNull()
1921+
}
1922+
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStore) MarshalJSON() (data []byte, err error) {
1923+
type shadow BetaAssistantNewParamsToolResourcesFileSearchVectorStore
1924+
return param.MarshalObject(r, (*shadow)(&r))
1925+
}
1926+
1927+
// Only one field can be non-zero.
1928+
//
1929+
// Use [param.IsOmitted] to confirm if a field is set.
1930+
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion struct {
1931+
OfAuto *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto `json:",omitzero,inline"`
1932+
OfStatic *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic `json:",omitzero,inline"`
1933+
paramUnion
1934+
}
1935+
1936+
// IsPresent returns true if the field's value is not omitted and not the JSON
1937+
// "null". To check if this field is omitted, use [param.IsOmitted].
1938+
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) IsPresent() bool {
1939+
return !param.IsOmitted(u) && !u.IsNull()
1940+
}
1941+
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) MarshalJSON() ([]byte, error) {
1942+
return param.MarshalUnion[BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion](u.OfAuto, u.OfStatic)
1943+
}
1944+
1945+
func (u *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) asAny() any {
1946+
if !param.IsOmitted(u.OfAuto) {
1947+
return u.OfAuto
1948+
} else if !param.IsOmitted(u.OfStatic) {
1949+
return u.OfStatic
1950+
}
1951+
return nil
1952+
}
1953+
1954+
// Returns a pointer to the underlying variant's property, if present.
1955+
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetStatic() *BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic {
1956+
if vt := u.OfStatic; vt != nil {
1957+
return &vt.Static
1958+
}
1959+
return nil
1960+
}
1961+
1962+
// Returns a pointer to the underlying variant's property, if present.
1963+
func (u BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion) GetType() *string {
1964+
if vt := u.OfAuto; vt != nil {
1965+
return (*string)(&vt.Type)
1966+
} else if vt := u.OfStatic; vt != nil {
1967+
return (*string)(&vt.Type)
1968+
}
1969+
return nil
1970+
}
1971+
1972+
func init() {
1973+
apijson.RegisterUnion[BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion](
1974+
"type",
1975+
apijson.UnionVariant{
1976+
TypeFilter: gjson.JSON,
1977+
Type: reflect.TypeOf(BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto{}),
1978+
DiscriminatorValue: "auto",
1979+
},
1980+
apijson.UnionVariant{
1981+
TypeFilter: gjson.JSON,
1982+
Type: reflect.TypeOf(BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic{}),
1983+
DiscriminatorValue: "static",
1984+
},
1985+
)
1986+
}
1987+
1988+
// The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
1989+
// `800` and `chunk_overlap_tokens` of `400`.
1990+
//
1991+
// The property Type is required.
1992+
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto struct {
1993+
// Always `auto`.
1994+
//
1995+
// This field can be elided, and will marshal its zero value as "auto".
1996+
Type constant.Auto `json:"type,required"`
1997+
paramObj
1998+
}
1999+
2000+
// IsPresent returns true if the field's value is not omitted and not the JSON
2001+
// "null". To check if this field is omitted, use [param.IsOmitted].
2002+
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) IsPresent() bool {
2003+
return !param.IsOmitted(f) && !f.IsNull()
2004+
}
2005+
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto) MarshalJSON() (data []byte, err error) {
2006+
type shadow BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto
2007+
return param.MarshalObject(r, (*shadow)(&r))
2008+
}
2009+
2010+
// The properties Static, Type are required.
2011+
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic struct {
2012+
Static BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic `json:"static,omitzero,required"`
2013+
// Always `static`.
2014+
//
2015+
// This field can be elided, and will marshal its zero value as "static".
2016+
Type constant.Static `json:"type,required"`
2017+
paramObj
2018+
}
2019+
2020+
// IsPresent returns true if the field's value is not omitted and not the JSON
2021+
// "null". To check if this field is omitted, use [param.IsOmitted].
2022+
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) IsPresent() bool {
2023+
return !param.IsOmitted(f) && !f.IsNull()
2024+
}
2025+
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic) MarshalJSON() (data []byte, err error) {
2026+
type shadow BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStatic
2027+
return param.MarshalObject(r, (*shadow)(&r))
2028+
}
2029+
2030+
// The properties ChunkOverlapTokens, MaxChunkSizeTokens are required.
2031+
type BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic struct {
2032+
// The number of tokens that overlap between chunks. The default value is `400`.
2033+
//
2034+
// Note that the overlap must not exceed half of `max_chunk_size_tokens`.
2035+
ChunkOverlapTokens int64 `json:"chunk_overlap_tokens,required"`
2036+
// The maximum number of tokens in each chunk. The default value is `800`. The
2037+
// minimum value is `100` and the maximum value is `4096`.
2038+
MaxChunkSizeTokens int64 `json:"max_chunk_size_tokens,required"`
2039+
paramObj
2040+
}
2041+
2042+
// IsPresent returns true if the field's value is not omitted and not the JSON
2043+
// "null". To check if this field is omitted, use [param.IsOmitted].
2044+
func (f BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) IsPresent() bool {
2045+
return !param.IsOmitted(f) && !f.IsNull()
2046+
}
2047+
func (r BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic) MarshalJSON() (data []byte, err error) {
2048+
type shadow BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyStaticStatic
2049+
return param.MarshalObject(r, (*shadow)(&r))
2050+
}
2051+
18372052
type BetaAssistantUpdateParams struct {
18382053
// The description of the assistant. The maximum length is 512 characters.
18392054
Description param.Opt[string] `json:"description,omitzero"`

betaassistant_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
4040
OfAuto: constant.ValueOf[constant.Auto](),
4141
},
4242
Temperature: openai.Float(1),
43-
ToolResources: openai.AssistantToolResourcesParam{
44-
CodeInterpreter: openai.AssistantToolResourcesCodeInterpreterParam{
43+
ToolResources: openai.BetaAssistantNewParamsToolResources{
44+
CodeInterpreter: openai.BetaAssistantNewParamsToolResourcesCodeInterpreter{
4545
FileIDs: []string{"string"},
4646
},
47-
FileSearch: openai.AssistantToolResourcesFileSearchParam{
47+
FileSearch: openai.BetaAssistantNewParamsToolResourcesFileSearch{
4848
VectorStoreIDs: []string{"string"},
49-
VectorStores: []openai.AssistantToolResourcesFileSearchVectorStoreParam{{
50-
ChunkingStrategy: openai.AssisstantVectorStoreChunkingStrategyUnionParam{
51-
OfAuto: &openai.AssisstantVectorStoreChunkingStrategyAutoParam{},
49+
VectorStores: []openai.BetaAssistantNewParamsToolResourcesFileSearchVectorStore{{
50+
ChunkingStrategy: openai.BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyUnion{
51+
OfAuto: &openai.BetaAssistantNewParamsToolResourcesFileSearchVectorStoreChunkingStrategyAuto{},
5252
},
5353
FileIDs: []string{"string"},
5454
Metadata: shared.MetadataParam{

0 commit comments

Comments
 (0)