Skip to content

Commit 97a0ec7

Browse files
Assistants V2 (#33)
* Upgrading assistants API to Beta V2 * Udpating Assistants objects to Beta V2 * Removing deprecated AssistantFileObject * Removing MessageFileObject * update Message object * updating read me for message object * Updating Thread objects * Updating run to assistants V2 * Updating run steps tool calls * Updating read me * Batch object * Batch object done * Vector stores support * adding new vector store endpoints * vector store files * File batch object * adding assistants v1 branch support * adding disclaimer * code review
1 parent 3847516 commit 97a0ec7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2062
-851
lines changed

Examples/SwiftOpenAIExample/SwiftOpenAIExample/Assistants/AssistantConfigurationProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftOpenAI
1515
var assistant: AssistantObject?
1616
var assistants: [AssistantObject] = []
1717
var avatarURL: URL?
18-
var assistantDeletionStatus: AssistantObject.DeletionStatus?
18+
var assistantDeletionStatus: DeletionStatus?
1919

2020
// MARK: - Initializer
2121

Examples/SwiftOpenAIExample/SwiftOpenAIExample/Assistants/AssistantThreadConfigurationProvider.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ import SwiftOpenAI
7171
switch toolCall {
7272
case .codeInterpreterToolCall(let toolCall):
7373
toolOuptutMessage += toolCall.input ?? ""
74-
case .retrieveToolCall(let toolCall):
75-
print("PROVIDER: Retrieve tool call \(toolCall)")
74+
case .fileSearchToolCall(let toolCall):
75+
print("PROVIDER: File search tool call \(toolCall)")
7676
case .functionToolCall(let toolCall):
7777
print("PROVIDER: Function tool call \(toolCall)")
7878
case nil:

Examples/SwiftOpenAIExample/SwiftOpenAIExample/FilesDemo/FilesProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SwiftUI
1414

1515
var files: [FileObject] = []
1616
var uploadedFile: FileObject? = nil
17-
var deletedStatus: FileObject.DeletionStatus? = nil
17+
var deletedStatus: DeletionStatus? = nil
1818
var retrievedFile: FileObject? = nil
1919
var fileContent: [[String: Any]] = []
2020

Examples/SwiftOpenAIExample/SwiftOpenAIExample/ModelsDemo/ModelsProvider.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SwiftOpenAI
1414

1515
var models: [ModelObject] = []
1616
var retrievedModel: ModelObject? = nil
17-
var deletionStatus: ModelObject.DeletionStatus? = nil
17+
var deletionStatus: DeletionStatus? = nil
1818

1919
init(service: OpenAIService) {
2020
self.service = service

README.md

+417-178
Large diffs are not rendered by default.

Sources/OpenAI/AIProxy/AIProxyService.swift

+250-123
Large diffs are not rendered by default.

Sources/OpenAI/Azure/DefaultOpenAIAzureService.swift

+111-31
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99

1010
final public class DefaultOpenAIAzureService: OpenAIService {
11-
11+
1212
public init(
1313
azureConfiguration: AzureOpenAIConfiguration,
1414
urlSessionConfiguration: URLSessionConfiguration = .default,
@@ -97,7 +97,7 @@ final public class DefaultOpenAIAzureService: OpenAIService {
9797
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
9898
}
9999

100-
public func deleteFileWith(id: String) async throws -> FileObject.DeletionStatus {
100+
public func deleteFileWith(id: String) async throws -> DeletionStatus {
101101
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
102102
}
103103

@@ -129,7 +129,7 @@ final public class DefaultOpenAIAzureService: OpenAIService {
129129
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
130130
}
131131

132-
public func deleteFineTuneModelWith(id: String) async throws -> ModelObject.DeletionStatus {
132+
public func deleteFineTuneModelWith(id: String) async throws -> DeletionStatus {
133133
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
134134
}
135135

@@ -153,30 +153,14 @@ final public class DefaultOpenAIAzureService: OpenAIService {
153153
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
154154
}
155155

156-
public func deleteAssistant(id: String) async throws -> AssistantObject.DeletionStatus {
156+
public func deleteAssistant(id: String) async throws -> DeletionStatus {
157157
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
158158
}
159159

160160
public func listAssistants(limit: Int?, order: String?, after: String?, before: String?) async throws -> OpenAIResponse<AssistantObject> {
161161
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
162162
}
163163

164-
public func createAssistantFile(assistantID: String, parameters: AssistantFileParamaters) async throws -> AssistantFileObject {
165-
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
166-
}
167-
168-
public func retrieveAssistantFile(assistantID: String, fileID: String) async throws -> AssistantFileObject {
169-
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
170-
}
171-
172-
public func deleteAssistantFile(assistantID: String, fileID: String) async throws -> AssistantFileObject.DeletionStatus {
173-
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
174-
}
175-
176-
public func listAssistantFiles(assistantID: String, limit: Int?, order: String?, after: String?, before: String?) async throws -> OpenAIResponse<AssistantFileObject> {
177-
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
178-
}
179-
180164
public func createThread(parameters: CreateThreadParameters) async throws -> ThreadObject {
181165
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
182166
}
@@ -189,7 +173,7 @@ final public class DefaultOpenAIAzureService: OpenAIService {
189173
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
190174
}
191175

192-
public func deleteThread(id: String) async throws -> ThreadObject.DeletionStatus {
176+
public func deleteThread(id: String) async throws -> DeletionStatus {
193177
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
194178
}
195179

@@ -209,14 +193,6 @@ final public class DefaultOpenAIAzureService: OpenAIService {
209193
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
210194
}
211195

212-
public func retrieveMessageFile(threadID: String, messageID: String, fileID: String) async throws -> MessageFileObject {
213-
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
214-
}
215-
216-
public func listMessageFiles(threadID: String, messageID: String, limit: Int?, order: String?, after: String?, before: String?) async throws -> OpenAIResponse<MessageFileObject> {
217-
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
218-
}
219-
220196
public func createRun(threadID: String, parameters: RunParameter) async throws -> RunObject {
221197
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
222198
}
@@ -255,7 +231,7 @@ final public class DefaultOpenAIAzureService: OpenAIService {
255231

256232
public func createThreadAndRunStream(
257233
parameters: CreateThreadAndRunParameter)
258-
async throws -> AsyncThrowingStream<AssistantStreamEvent, Error> {
234+
async throws -> AsyncThrowingStream<AssistantStreamEvent, Error> {
259235
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
260236
}
261237

@@ -271,7 +247,111 @@ final public class DefaultOpenAIAzureService: OpenAIService {
271247
threadID: String,
272248
runID: String,
273249
parameters: RunToolsOutputParameter)
274-
async throws -> AsyncThrowingStream<AssistantStreamEvent, Error> {
250+
async throws -> AsyncThrowingStream<AssistantStreamEvent, Error> {
251+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
252+
}
253+
254+
// MARK: Batch
255+
256+
public func createBatch(
257+
parameters: BatchParameter)
258+
async throws -> BatchObject
259+
{
260+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
261+
}
262+
263+
public func retrieveBatch(
264+
id: String)
265+
async throws -> BatchObject
266+
{
267+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
268+
}
269+
270+
public func cancelBatch(
271+
id: String) async throws -> BatchObject
272+
{
273+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
274+
}
275+
276+
public func listBatch(
277+
after: String?,
278+
limit: Int?)
279+
async throws-> OpenAIResponse<BatchObject>
280+
{
281+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
282+
}
283+
284+
// MARK: Vector Store
285+
286+
public func createVectorStore(
287+
parameters: VectorStoreParameter)
288+
async throws -> VectorStoreObject
289+
{
290+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
291+
}
292+
293+
public func listVectorStores(
294+
limit: Int?,
295+
order: String?,
296+
after: String?,
297+
before: String?)
298+
async throws -> OpenAIResponse<VectorStoreObject>
299+
{
300+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
301+
}
302+
303+
public func retrieveVectorStore(
304+
id: String) async throws
305+
-> VectorStoreObject
306+
{
307+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
308+
}
309+
310+
public func modifyVectorStore(
311+
id: String)
312+
async throws -> VectorStoreObject
313+
{
314+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
315+
}
316+
317+
public func deleteVectorStore(
318+
id: String)
319+
async throws -> DeletionStatus
320+
{
321+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
322+
}
323+
324+
// MARK: Vector Store Files
325+
326+
public func createVectorStoreFile(vectorStoreID: String, parameters: VectorStoreFileParameter) async throws -> VectorStoreFileObject {
327+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
328+
}
329+
330+
public func listVectorStoreFiles(vectorStoreID: String, limit: Int?, order: String?, after: String?, before: String?, filter: String?) async throws -> OpenAIResponse<VectorStoreFileObject> {
331+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
332+
}
333+
334+
public func retrieveVectorStoreFile(vectorStoreID: String, fileID: String) async throws -> VectorStoreFileObject {
335+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
336+
}
337+
338+
public func deleteVectorStoreFile(vectorStoreID: String, fileID: String) async throws -> DeletionStatus {
339+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
340+
}
341+
342+
public func createVectorStoreFileBatch(vectorStoreID: String, parameters: VectorStoreFileBatchParameter) async throws -> VectorStoreFileBatchObject {
343+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
344+
}
345+
346+
public func retrieveVectorStoreFileBatch(vectorStoreID: String, batchID: String) async throws -> VectorStoreFileBatchObject {
347+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
348+
}
349+
350+
public func cancelVectorStoreFileBatch(vectorStoreID: String, batchID: String) async throws -> VectorStoreFileBatchObject {
351+
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
352+
}
353+
354+
public func listVectorStoreFilesInABatch(vectorStoreID: String, batchID: String, limit: Int?, order: String?, after: String?, before: String?, filter: String?) async throws -> OpenAIResponse<VectorStoreFileObject> {
275355
fatalError("Currently, this API is not supported. We welcome and encourage contributions to our open-source project. Please consider opening an issue or submitting a pull request to add support for this feature.")
276356
}
277357
}

0 commit comments

Comments
 (0)