-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathtool_resources.tsp
More file actions
165 lines (144 loc) · 6.04 KB
/
tool_resources.tsp
File metadata and controls
165 lines (144 loc) · 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import "@typespec/http";
import "@typespec/versioning";
import "../main.tsp";
using TypeSpec.Http;
using TypeSpec.Versioning;
namespace Azure.AI.OpenAI.Assistants;
//
// Response objects
//
/**
* A set of resources that are used by the assistant's tools. The resources are specific to the type of
* tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search`
* tool requires a list of vector store IDs.
*/
@added(ServiceApiVersions.v2024_05_01_preview)
model ToolResources {
/** Resources to be used by the `code_interpreter tool` consisting of file IDs. */
@encodedName("application/json", "code_interpreter")
codeInterpreter?: CodeInterpreterToolResource;
/** Resources to be used by the `file_search` tool consisting of vector store IDs. */
@encodedName("application/json", "file_search")
fileSearch?: FileSearchToolResource;
}
/**
* A set of resources that are used by the `code_interpreter` tool.
*/
@added(ServiceApiVersions.v2024_05_01_preview)
model CodeInterpreterToolResource {
/**
* A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files
* associated with the tool.
*/
@encodedName("application/json", "file_ids")
@maxItems(20)
fileIds: string[] = [];
}
/**
* A set of resources that are used by the `file_search` tool.
*/
@added(ServiceApiVersions.v2024_05_01_preview)
model FileSearchToolResource {
/**
* The ID of the vector store attached to this assistant. There can be a maximum of 1 vector
* store attached to the assistant.
*/
@maxItems(1)
@encodedName("application/json", "vector_store_ids")
vectorStoreIds?: string[];
}
//
// Creation request objects
//
/**
* Request object. A set of resources that are used by the assistant's tools. The resources are specific to the
* type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search`
* tool requires a list of vector store IDs.
*/
@added(ServiceApiVersions.v2024_05_01_preview)
model CreateToolResourcesOptions {
/**
* A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files
* associated with the tool.
*/
@encodedName("application/json", "code_interpreter")
codeInterpreter?: CreateCodeInterpreterToolResourceOptions;
/** A list of vector stores or their IDs made available to the `file_search` tool. */
@encodedName("application/json", "file_search")
fileSearch?: CreateFileSearchToolResourceOptions;
}
/**
* A set of resources that will be used by the `code_interpreter` tool. Request object.
*/
@added(ServiceApiVersions.v2024_05_01_preview)
model CreateCodeInterpreterToolResourceOptions {
/** A list of file IDs made available to the `code_interpreter` tool. */
@maxItems(20)
@encodedName("application/json", "file_ids")
fileIds?: string[] = [];
}
/**
* A set of resources that are used by the assistant's tools. The resources are specific to the type of tool.
* For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires
* a list of vector store IDs.
*/
#suppress "@azure-tools/typespec-autorest/union-unsupported" "This union is defined according to the OpenAI API"
@added(ServiceApiVersions.v2024_05_01_preview)
union CreateFileSearchToolResourceOptions {
/** The vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. */
@encodedName("application/json", "vector_store_ids")
// @maxItems(1) // this can't be applied to string[]
vectorStoreIds: string[],
/** A helper to create a vector store with file_ids and attach it to this assistant. There can be a maximum of 1 vector
* store attached to the assistant. */
@encodedName("application/json", "vector_stores")
// @maxItems(1) // this can't be applied to string[]
vectorStores: CreateFileSearchToolResourceVectorStoreOptions[],
}
/** File IDs associated to the vector store to be passed to the helper. */
@added(ServiceApiVersions.v2024_05_01_preview)
model CreateFileSearchToolResourceVectorStoreOptions {
/** A list of file IDs to add to the vector store. There can be a maximum of 10000 files in a vector store. */
@encodedName("application/json", "file_ids")
@maxItems(10000)
fileIds: string[];
/** Set of 16 key-value pairs that can be attached to a vector store. This can be useful for storing additional information
* about the vector store in a structured format. Keys can be a maximum of 64 characters long and values can be a maximum of
* 512 characters long. */
...OptionalNullableMetadata;
}
//
// Update request objects
//
/**
* Request object. A set of resources that are used by the assistant's tools. The resources are specific to the type of tool.
* For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of
* vector store IDs.
*/
@added(ServiceApiVersions.v2024_05_01_preview)
model UpdateToolResourcesOptions {
/**
* Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files
* associated with the tool.
*/
@encodedName("application/json", "code_interpreter")
codeInterpreter?: UpdateCodeInterpreterToolResourceOptions;
/** Overrides the vector store attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. */
@encodedName("application/json", "file_search")
fileSearch?: UpdateFileSearchToolResourceOptions;
}
/** Request object to update `code_interpreted` tool resources. */
@added(ServiceApiVersions.v2024_05_01_preview)
model UpdateCodeInterpreterToolResourceOptions {
/** A list of file IDs to override the current list of the assistant. */
@maxItems(20)
fileIds?: string[];
}
/** Request object to update `file_search` tool resources. */
@added(ServiceApiVersions.v2024_05_01_preview)
model UpdateFileSearchToolResourceOptions {
/** A list of vector store IDs to override the current list of the assistant. */
@maxItems(1)
@encodedName("application/json", "vector_store_ids")
vectorStoreIds?: string[];
}