Skip to content

Commit

Permalink
feat(specs): add transformation copilot to ingestion (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3479

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
  • Loading branch information
algolia-bot and Fluf22 committed Aug 6, 2024
1 parent 4881704 commit 3b051ad
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Sources/Ingestion/IngestionClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,46 @@ open class IngestionClient {
)
}

/// - returns: TransformationModels
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
open func listTransformationModels(requestOptions: RequestOptions? = nil) async throws -> TransformationModels {
let response: Response<TransformationModels> =
try await listTransformationModelsWithHTTPInfo(requestOptions: requestOptions)

guard let body = response.body else {
throw AlgoliaError.missingData
}

return body
}

// Retrieves a list of existing LLM transformation helpers.
// Required API Key ACLs:
// - addObject
// - deleteIndex
// - editSettings
// - returns: RequestBuilder<TransformationModels>

open func listTransformationModelsWithHTTPInfo(
requestOptions userRequestOptions: RequestOptions? =
nil
) async throws -> Response<TransformationModels> {
let resourcePath = "/1/transformations/copilot"
let body: AnyCodable? = nil
let queryParameters: [String: Any?]? = nil

let nillableHeaders: [String: Any?]? = nil

let headers = APIHelper.rejectNilHeaders(nillableHeaders)

return try await self.transporter.send(
method: "GET",
path: resourcePath,
data: body,
requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
)
}

/// - parameter itemsPerPage: (query) Number of items per page. (optional, default to 10)
/// - parameter page: (query) Page number of the paginated API response. (optional)
/// - parameter sort: (query) Property by which to sort the list. (optional)
Expand Down
62 changes: 62 additions & 0 deletions Sources/Ingestion/Models/Model.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.

import Foundation
#if canImport(Core)
import Core
#endif

public struct Model: Codable, JSONEncodable {
public var fullname: String
public var modelName: String
public var systemPrompt: String
public var id: String
public var provider: String

public init(fullname: String, modelName: String, systemPrompt: String, id: String, provider: String) {
self.fullname = fullname
self.modelName = modelName
self.systemPrompt = systemPrompt
self.id = id
self.provider = provider
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case fullname
case modelName
case systemPrompt
case id
case provider
}

// Encodable protocol methods

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.fullname, forKey: .fullname)
try container.encode(self.modelName, forKey: .modelName)
try container.encode(self.systemPrompt, forKey: .systemPrompt)
try container.encode(self.id, forKey: .id)
try container.encode(self.provider, forKey: .provider)
}
}

extension Model: Equatable {
public static func ==(lhs: Model, rhs: Model) -> Bool {
lhs.fullname == rhs.fullname &&
lhs.modelName == rhs.modelName &&
lhs.systemPrompt == rhs.systemPrompt &&
lhs.id == rhs.id &&
lhs.provider == rhs.provider
}
}

extension Model: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.fullname.hashValue)
hasher.combine(self.modelName.hashValue)
hasher.combine(self.systemPrompt.hashValue)
hasher.combine(self.id.hashValue)
hasher.combine(self.provider.hashValue)
}
}
39 changes: 39 additions & 0 deletions Sources/Ingestion/Models/TransformationModels.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on
// https://github.com/algolia/api-clients-automation. DO NOT EDIT.

import Foundation
#if canImport(Core)
import Core
#endif

/// List of available AI models for transformation purposes.
public struct TransformationModels: Codable, JSONEncodable {
public var llms: [Model]

public init(llms: [Model]) {
self.llms = llms
}

public enum CodingKeys: String, CodingKey, CaseIterable {
case llms
}

// Encodable protocol methods

public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.llms, forKey: .llms)
}
}

extension TransformationModels: Equatable {
public static func ==(lhs: TransformationModels, rhs: TransformationModels) -> Bool {
lhs.llms == rhs.llms
}
}

extension TransformationModels: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(self.llms.hashValue)
}
}

0 comments on commit 3b051ad

Please sign in to comment.