-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new assistant methods
- Loading branch information
Showing
8 changed files
with
328 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexey on 12/5/23. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Represents an assistant file that can be used by the assistant. | ||
public struct ASAAssistantFile: Codable { | ||
/// The identifier of the assistant file. | ||
public let id: String | ||
|
||
/// The object type, which is always 'assistant.file'. | ||
public let objectType: String | ||
|
||
/// The Unix timestamp (in seconds) for when the assistant file was created. | ||
public let createdAt: Int | ||
|
||
/// The identifier of the assistant to which this file belongs. | ||
public let assistantId: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case id, objectType = "object", createdAt = "created_at", assistantId = "assistant_id" | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Sources/AISwiftAssist/Models/Request/ASACreateAssistantFileRequest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexey on 12/5/23. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Represents a request to create an assistant file. | ||
public struct ASACreateAssistantFileRequest: Codable { | ||
/// A File ID (with purpose="assistants") that the assistant should use. | ||
/// Useful for tools like retrieval and code_interpreter that can access files. | ||
public let fileId: String | ||
|
||
public init(fileId: String) { | ||
self.fileId = fileId | ||
} | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case fileId = "file_id" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Sources/AISwiftAssist/Models/Request/ASAListFilesParameters.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexey on 12/5/23. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Parameters for listing assistant files. | ||
public struct ASAListFilesParameters: Encodable { | ||
/// A limit on the number of objects to be returned. | ||
/// Can range between 1 and 100. Defaults to 20. | ||
public let limit: Int? | ||
|
||
/// Sort order by the created_at timestamp of the objects. | ||
/// 'asc' for ascending order and 'desc' for descending order. | ||
public let order: String? | ||
|
||
/// A cursor for use in pagination. 'after' is an object ID that defines | ||
/// your place in the list, to fetch the next page of the list. | ||
public let after: String? | ||
|
||
/// A cursor for use in pagination. 'before' is an object ID that defines | ||
/// your place in the list, to fetch the previous page of the list. | ||
public let before: String? | ||
|
||
public init(limit: Int? = nil, order: String? = nil, after: String? = nil, before: String? = nil) { | ||
self.limit = limit | ||
self.order = order | ||
self.after = after | ||
self.before = before | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Sources/AISwiftAssist/Models/Response/ASAAssistantFilesListResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Alexey on 12/5/23. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Represents a response containing a list of assistant files. | ||
public struct ASAAssistantFilesListResponse: Codable { | ||
/// The object type, which is always 'list'. | ||
public let object: String | ||
|
||
/// The list of assistant files. | ||
public let data: [ASAAssistantFile] | ||
|
||
/// The ID of the first file in the list. | ||
public let firstId: String | ||
|
||
/// The ID of the last file in the list. | ||
public let lastId: String | ||
|
||
/// Boolean indicating if there are more files available. | ||
public let hasMore: Bool | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case data, firstId = "first_id", lastId = "last_id", hasMore = "has_more", object | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.