Release 1.0.0

github-actions[bot] committed Apr 26, 2026 at 15:24 UTC 83bfe89489d3eee34a960dd7a3db31dc26735a09
2 files changed +324 -6
Package.swift
+2 -2
@@ -35,8 +35,8 @@ let package = Package(
35 targets: [
36 .binaryTarget(
37 name: "OndeFramework",
38 - url: "https://github.com/ondeinference/onde/releases/download/0.1.7/OndeFramework.xcframework.zip",
39 - checksum: "81b8b4892a5e88f2338d3cbabf388416e19b5b8608c5fb4450e5b903f9b661e6"
38 + url: "https://github.com/ondeinference/onde/releases/download/1.0.0/OndeFramework.xcframework.zip",
39 + checksum: "e50d88a657abe8d5bcc6df9422fa1bae2b2e1855209bbc4f8746ceb97f1ffd3b"
40 ),
41 .target(
42 name: "Onde",
Sources/Onde/onde.swift
+322 -4
@@ -601,6 +601,18 @@ public protocol OndeChatEngineProtocol: AnyObject, Sendable {
601 */
602 func isLoaded() async -> Bool
603
604 + /**
605 + * Load the model assigned to this app via the Onde dashboard.
606 + *
607 + * The `app_id` and `app_secret` identify your app on
608 + * [ondeinference.com](https://ondeinference.com). The backend returns
609 + * the GGUF model configuration assigned to your app; if no model is
610 + * assigned (HTTP 404) the platform default is loaded instead.
611 + *
612 + * Returns the wall-clock loading time in seconds.
613 + */
614 + func loadAssignedModel(appId: String, appSecret: String, systemPrompt: String?, sampling: SamplingConfig?) async throws -> Double
615 +
616 /**
617 * Load the platform-appropriate default model.
618 *
@@ -855,6 +867,33 @@ open func isLoaded()async -> Bool {
867 )
868 }
869
870 + /**
871 + * Load the model assigned to this app via the Onde dashboard.
872 + *
873 + * The `app_id` and `app_secret` identify your app on
874 + * [ondeinference.com](https://ondeinference.com). The backend returns
875 + * the GGUF model configuration assigned to your app; if no model is
876 + * assigned (HTTP 404) the platform default is loaded instead.
877 + *
878 + * Returns the wall-clock loading time in seconds.
879 + */
880 +open func loadAssignedModel(appId: String, appSecret: String, systemPrompt: String?, sampling: SamplingConfig?)async throws -> Double {
881 + return
882 + try await uniffiRustCallAsync(
883 + rustFutureFunc: {
884 + uniffi_onde_fn_method_ondechatengine_load_assigned_model(
885 + self.uniffiCloneHandle(),
886 + FfiConverterString.lower(appId),FfiConverterString.lower(appSecret),FfiConverterOptionString.lower(systemPrompt),FfiConverterOptionTypeSamplingConfig.lower(sampling)
887 + )
888 + },
889 + pollFunc: ffi_onde_rust_future_poll_f64,
890 + completeFunc: ffi_onde_rust_future_complete_f64,
891 + freeFunc: ffi_onde_rust_future_free_f64,
892 + liftFunc: FfiConverterDouble.lift,
893 + errorHandler: FfiConverterTypeInferenceError_lift
894 + )
895 +}
896 +
897 /**
898 * Load the platform-appropriate default model.
899 *
@@ -1233,6 +1272,12 @@ public struct GgufModelConfig: Equatable, Hashable {
1272 * Approximate memory footprint description, e.g. `"~941 MB (GGUF Q4_K_M)"`.
1273 */
1274 public var approxMemory: String
1275 + /**
1276 + * Optional Jinja chat template string. When set, this overrides the
1277 + * template embedded in the GGUF file (if any). Required for older GGUF
1278 + * files that don't embed a chat template (e.g. TheBloke models).
1279 + */
1280 + public var chatTemplate: String?
1281
1282 // Default memberwise initializers are never public by default, so we
1283 // declare one manually.
@@ -1252,12 +1297,18 @@ public struct GgufModelConfig: Equatable, Hashable {
1297 */displayName: String,
1298 /**
1299 * Approximate memory footprint description, e.g. `"~941 MB (GGUF Q4_K_M)"`.
1255 - */approxMemory: String) {
1300 + */approxMemory: String,
1301 + /**
1302 + * Optional Jinja chat template string. When set, this overrides the
1303 + * template embedded in the GGUF file (if any). Required for older GGUF
1304 + * files that don't embed a chat template (e.g. TheBloke models).
1305 + */chatTemplate: String?) {
1306 self.modelId = modelId
1307 self.files = files
1308 self.tokModelId = tokModelId
1309 self.displayName = displayName
1310 self.approxMemory = approxMemory
1311 + self.chatTemplate = chatTemplate
1312 }
1313
1314
@@ -1280,7 +1331,8 @@ public struct FfiConverterTypeGgufModelConfig: FfiConverterRustBuffer {
1331 files: FfiConverterSequenceString.read(from: &buf),
1332 tokModelId: FfiConverterOptionString.read(from: &buf),
1333 displayName: FfiConverterString.read(from: &buf),
1283 - approxMemory: FfiConverterString.read(from: &buf)
1334 + approxMemory: FfiConverterString.read(from: &buf),
1335 + chatTemplate: FfiConverterOptionString.read(from: &buf)
1336 )
1337 }
1338
@@ -1290,6 +1342,7 @@ public struct FfiConverterTypeGgufModelConfig: FfiConverterRustBuffer {
1342 FfiConverterOptionString.write(value.tokModelId, into: &buf)
1343 FfiConverterString.write(value.displayName, into: &buf)
1344 FfiConverterString.write(value.approxMemory, into: &buf)
1345 + FfiConverterOptionString.write(value.chatTemplate, into: &buf)
1346 }
1347 }
1348
@@ -1329,6 +1382,10 @@ public struct InferenceResult: Equatable, Hashable {
1382 * Finish reason reported by the model (e.g. `"stop"`, `"length"`).
1383 */
1384 public var finishReason: String
1385 + /**
1386 + * Tool calls requested by the model (empty when no tools were invoked).
1387 + */
1388 + public var toolCalls: [ToolCallInfo]
1389
1390 // Default memberwise initializers are never public by default, so we
1391 // declare one manually.
@@ -1344,11 +1401,15 @@ public struct InferenceResult: Equatable, Hashable {
1401 */durationDisplay: String,
1402 /**
1403 * Finish reason reported by the model (e.g. `"stop"`, `"length"`).
1347 - */finishReason: String) {
1404 + */finishReason: String,
1405 + /**
1406 + * Tool calls requested by the model (empty when no tools were invoked).
1407 + */toolCalls: [ToolCallInfo]) {
1408 self.text = text
1409 self.durationSecs = durationSecs
1410 self.durationDisplay = durationDisplay
1411 self.finishReason = finishReason
1412 + self.toolCalls = toolCalls
1413 }
1414
1415
@@ -1370,7 +1431,8 @@ public struct FfiConverterTypeInferenceResult: FfiConverterRustBuffer {
1431 text: FfiConverterString.read(from: &buf),
1432 durationSecs: FfiConverterDouble.read(from: &buf),
1433 durationDisplay: FfiConverterString.read(from: &buf),
1373 - finishReason: FfiConverterString.read(from: &buf)
1434 + finishReason: FfiConverterString.read(from: &buf),
1435 + toolCalls: FfiConverterSequenceTypeToolCallInfo.read(from: &buf)
1436 )
1437 }
1438
@@ -1379,6 +1441,7 @@ public struct FfiConverterTypeInferenceResult: FfiConverterRustBuffer {
1441 FfiConverterDouble.write(value.durationSecs, into: &buf)
1442 FfiConverterString.write(value.durationDisplay, into: &buf)
1443 FfiConverterString.write(value.finishReason, into: &buf)
1444 + FfiConverterSequenceTypeToolCallInfo.write(value.toolCalls, into: &buf)
1445 }
1446 }
1447
@@ -1701,6 +1764,233 @@ public func FfiConverterTypeStreamChunk_lower(_ value: StreamChunk) -> RustBuffe
1764 return FfiConverterTypeStreamChunk.lower(value)
1765 }
1766
1767 +
1768 +/**
1769 + * Information about a single tool call requested by the model.
1770 + */
1771 +public struct ToolCallInfo: Equatable, Hashable {
1772 + /**
1773 + * Unique identifier for this tool call (used to correlate results).
1774 + */
1775 + public var id: String
1776 + /**
1777 + * The name of the function the model wants to invoke.
1778 + */
1779 + public var functionName: String
1780 + /**
1781 + * JSON-encoded arguments for the function.
1782 + */
1783 + public var arguments: String
1784 +
1785 + // Default memberwise initializers are never public by default, so we
1786 + // declare one manually.
1787 + public init(
1788 + /**
1789 + * Unique identifier for this tool call (used to correlate results).
1790 + */id: String,
1791 + /**
1792 + * The name of the function the model wants to invoke.
1793 + */functionName: String,
1794 + /**
1795 + * JSON-encoded arguments for the function.
1796 + */arguments: String) {
1797 + self.id = id
1798 + self.functionName = functionName
1799 + self.arguments = arguments
1800 + }
1801 +
1802 +
1803 +
1804 +
1805 +}
1806 +
1807 +#if compiler(>=6)
1808 +extension ToolCallInfo: Sendable {}
1809 +#endif
1810 +
1811 +#if swift(>=5.8)
1812 +@_documentation(visibility: private)
1813 +#endif
1814 +public struct FfiConverterTypeToolCallInfo: FfiConverterRustBuffer {
1815 + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ToolCallInfo {
1816 + return
1817 + try ToolCallInfo(
1818 + id: FfiConverterString.read(from: &buf),
1819 + functionName: FfiConverterString.read(from: &buf),
1820 + arguments: FfiConverterString.read(from: &buf)
1821 + )
1822 + }
1823 +
1824 + public static func write(_ value: ToolCallInfo, into buf: inout [UInt8]) {
1825 + FfiConverterString.write(value.id, into: &buf)
1826 + FfiConverterString.write(value.functionName, into: &buf)
1827 + FfiConverterString.write(value.arguments, into: &buf)
1828 + }
1829 +}
1830 +
1831 +
1832 +#if swift(>=5.8)
1833 +@_documentation(visibility: private)
1834 +#endif
1835 +public func FfiConverterTypeToolCallInfo_lift(_ buf: RustBuffer) throws -> ToolCallInfo {
1836 + return try FfiConverterTypeToolCallInfo.lift(buf)
1837 +}
1838 +
1839 +#if swift(>=5.8)
1840 +@_documentation(visibility: private)
1841 +#endif
1842 +public func FfiConverterTypeToolCallInfo_lower(_ value: ToolCallInfo) -> RustBuffer {
1843 + return FfiConverterTypeToolCallInfo.lower(value)
1844 +}
1845 +
1846 +
1847 +/**
1848 + * A tool definition passed to the model so it knows which tools are available.
1849 + */
1850 +public struct ToolDefinition: Equatable, Hashable {
1851 + /**
1852 + * Tool name (e.g. `"read_file"`).
1853 + */
1854 + public var name: String
1855 + /**
1856 + * Human-readable description of what the tool does.
1857 + */
1858 + public var description: String
1859 + /**
1860 + * JSON Schema string describing the tool's parameters.
1861 + */
1862 + public var parametersSchema: String
1863 +
1864 + // Default memberwise initializers are never public by default, so we
1865 + // declare one manually.
1866 + public init(
1867 + /**
1868 + * Tool name (e.g. `"read_file"`).
1869 + */name: String,
1870 + /**
1871 + * Human-readable description of what the tool does.
1872 + */description: String,
1873 + /**
1874 + * JSON Schema string describing the tool's parameters.
1875 + */parametersSchema: String) {
1876 + self.name = name
1877 + self.description = description
1878 + self.parametersSchema = parametersSchema
1879 + }
1880 +
1881 +
1882 +
1883 +
1884 +}
1885 +
1886 +#if compiler(>=6)
1887 +extension ToolDefinition: Sendable {}
1888 +#endif
1889 +
1890 +#if swift(>=5.8)
1891 +@_documentation(visibility: private)
1892 +#endif
1893 +public struct FfiConverterTypeToolDefinition: FfiConverterRustBuffer {
1894 + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ToolDefinition {
1895 + return
1896 + try ToolDefinition(
1897 + name: FfiConverterString.read(from: &buf),
1898 + description: FfiConverterString.read(from: &buf),
1899 + parametersSchema: FfiConverterString.read(from: &buf)
1900 + )
1901 + }
1902 +
1903 + public static func write(_ value: ToolDefinition, into buf: inout [UInt8]) {
1904 + FfiConverterString.write(value.name, into: &buf)
1905 + FfiConverterString.write(value.description, into: &buf)
1906 + FfiConverterString.write(value.parametersSchema, into: &buf)
1907 + }
1908 +}
1909 +
1910 +
1911 +#if swift(>=5.8)
1912 +@_documentation(visibility: private)
1913 +#endif
1914 +public func FfiConverterTypeToolDefinition_lift(_ buf: RustBuffer) throws -> ToolDefinition {
1915 + return try FfiConverterTypeToolDefinition.lift(buf)
1916 +}
1917 +
1918 +#if swift(>=5.8)
1919 +@_documentation(visibility: private)
1920 +#endif
1921 +public func FfiConverterTypeToolDefinition_lower(_ value: ToolDefinition) -> RustBuffer {
1922 + return FfiConverterTypeToolDefinition.lower(value)
1923 +}
1924 +
1925 +
1926 +/**
1927 + * The result of executing a tool, sent back to the model.
1928 + */
1929 +public struct ToolResult: Equatable, Hashable {
1930 + /**
1931 + * The tool call ID this result corresponds to.
1932 + */
1933 + public var toolCallId: String
1934 + /**
1935 + * The output produced by executing the tool.
1936 + */
1937 + public var content: String
1938 +
1939 + // Default memberwise initializers are never public by default, so we
1940 + // declare one manually.
1941 + public init(
1942 + /**
1943 + * The tool call ID this result corresponds to.
1944 + */toolCallId: String,
1945 + /**
1946 + * The output produced by executing the tool.
1947 + */content: String) {
1948 + self.toolCallId = toolCallId
1949 + self.content = content
1950 + }
1951 +
1952 +
1953 +
1954 +
1955 +}
1956 +
1957 +#if compiler(>=6)
1958 +extension ToolResult: Sendable {}
1959 +#endif
1960 +
1961 +#if swift(>=5.8)
1962 +@_documentation(visibility: private)
1963 +#endif
1964 +public struct FfiConverterTypeToolResult: FfiConverterRustBuffer {
1965 + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ToolResult {
1966 + return
1967 + try ToolResult(
1968 + toolCallId: FfiConverterString.read(from: &buf),
1969 + content: FfiConverterString.read(from: &buf)
1970 + )
1971 + }
1972 +
1973 + public static func write(_ value: ToolResult, into buf: inout [UInt8]) {
1974 + FfiConverterString.write(value.toolCallId, into: &buf)
1975 + FfiConverterString.write(value.content, into: &buf)
1976 + }
1977 +}
1978 +
1979 +
1980 +#if swift(>=5.8)
1981 +@_documentation(visibility: private)
1982 +#endif
1983 +public func FfiConverterTypeToolResult_lift(_ buf: RustBuffer) throws -> ToolResult {
1984 + return try FfiConverterTypeToolResult.lift(buf)
1985 +}
1986 +
1987 +#if swift(>=5.8)
1988 +@_documentation(visibility: private)
1989 +#endif
1990 +public func FfiConverterTypeToolResult_lower(_ value: ToolResult) -> RustBuffer {
1991 + return FfiConverterTypeToolResult.lower(value)
1992 +}
1993 +
1994 // Note that we don't yet support `indirect` for enums.
1995 // See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
1996 /**
@@ -2323,6 +2613,31 @@ fileprivate struct FfiConverterSequenceTypeChatMessage: FfiConverterRustBuffer {
2613 return seq
2614 }
2615 }
2616 +
2617 +#if swift(>=5.8)
2618 +@_documentation(visibility: private)
2619 +#endif
2620 +fileprivate struct FfiConverterSequenceTypeToolCallInfo: FfiConverterRustBuffer {
2621 + typealias SwiftType = [ToolCallInfo]
2622 +
2623 + public static func write(_ value: [ToolCallInfo], into buf: inout [UInt8]) {
2624 + let len = Int32(value.count)
2625 + writeInt(&buf, len)
2626 + for item in value {
2627 + FfiConverterTypeToolCallInfo.write(item, into: &buf)
2628 + }
2629 + }
2630 +
2631 + public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [ToolCallInfo] {
2632 + let len: Int32 = try readInt(&buf)
2633 + var seq = [ToolCallInfo]()
2634 + seq.reserveCapacity(Int(len))
2635 + for _ in 0 ..< len {
2636 + seq.append(try FfiConverterTypeToolCallInfo.read(from: &buf))
2637 + }
2638 + return seq
2639 + }
2640 +}
2641 private let UNIFFI_RUST_FUTURE_POLL_READY: Int8 = 0
2642 private let UNIFFI_RUST_FUTURE_POLL_WAKE: Int8 = 1
2643
@@ -2565,6 +2880,9 @@ private let initializationResult: InitializationResult = {
2880 if (uniffi_onde_checksum_method_ondechatengine_is_loaded() != 59838) {
2881 return InitializationResult.apiChecksumMismatch
2882 }
2883 + if (uniffi_onde_checksum_method_ondechatengine_load_assigned_model() != 25824) {
2884 + return InitializationResult.apiChecksumMismatch
2885 + }
2886 if (uniffi_onde_checksum_method_ondechatengine_load_default_model() != 32187) {
2887 return InitializationResult.apiChecksumMismatch
2888 }