Chat and UI messages
Symbol counts
Section titled “Symbol counts”| Symbol kind | Count |
|---|---|
| Case | 10 |
| Class | 1 |
| Enumeration | 3 |
| Function | 13 |
| Initializer | 12 |
| Instance Method | 23 |
| Instance Property | 78 |
| Protocol | 1 |
| Structure | 10 |
| Type Alias | 1 |
| Type Method | 2 |
Public symbols
Section titled “Public symbols”| Kind | Symbol | Declaration | Source |
|---|---|---|---|
| Case | SwiftAISDK.AIChatSessionStatus.error | case error | Sources/SwiftAISDK/AIChatSession.swift |
| Case | SwiftAISDK.AIChatSessionStatus.ready | case ready | Sources/SwiftAISDK/AIChatSession.swift |
| Case | SwiftAISDK.AIChatSessionStatus.streaming | case streaming | Sources/SwiftAISDK/AIChatSession.swift |
| Case | SwiftAISDK.AIChatSessionStatus.submitted | case submitted | Sources/SwiftAISDK/AIChatSession.swift |
| Case | SwiftAISDK.AIChatTransportTrigger.regenerateMessage | case regenerateMessage | Sources/SwiftAISDK/AIChatTransport.swift |
| Case | SwiftAISDK.AIChatTransportTrigger.submitMessage | case submitMessage | Sources/SwiftAISDK/AIChatTransport.swift |
| Case | SwiftAISDK.AIUIMessageStreamOutcome.aborted | case aborted | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Case | SwiftAISDK.AIUIMessageStreamOutcome.completed | case completed | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Case | SwiftAISDK.AIUIMessageStreamOutcome.failed | case failed | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Case | SwiftAISDK.AIUIMessageStreamOutcome.unknown | case unknown | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Class | SwiftAISDK.AIChatSession | @MainActor final class AIChatSession | Sources/SwiftAISDK/AIChatSession.swift |
| Enumeration | SwiftAISDK.AIChatSessionStatus | enum AIChatSessionStatus | Sources/SwiftAISDK/AIChatSession.swift |
| Enumeration | SwiftAISDK.AIChatTransportTrigger | enum AIChatTransportTrigger | Sources/SwiftAISDK/AIChatTransport.swift |
| Enumeration | SwiftAISDK.AIUIMessageStreamOutcome | enum AIUIMessageStreamOutcome | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Function | SwiftAISDK.convertToModelMessage(_:) | func convertToModelMessage(_ message: AIUIMessage) throws -> AIMessage | Sources/SwiftAISDK/AIUIMessageConversion.swift |
| Function | SwiftAISDK.convertToModelMessages(_:) | func convertToModelMessages(_ messages: [AIUIMessage]) throws -> [AIMessage] | Sources/SwiftAISDK/AIUIMessageConversion.swift |
| Function | SwiftAISDK.convertToModelMessages(_:ignoreIncompleteToolCalls:) | func convertToModelMessages(_ messages: [AIUIMessage], ignoreIncompleteToolCalls: Bool) throws -> [AIMessage] | Sources/SwiftAISDK/AIUIMessageConversion.swift |
| Function | SwiftAISDK.convertToModelMessages(_:ignoreIncompleteToolCalls:convertDataPart:) | func convertToModelMessages(_ messages: [AIUIMessage], ignoreIncompleteToolCalls: Bool = false, convertDataPart: AIUIDataPartConverter?) throws -> [AIMessage] | Sources/SwiftAISDK/AIUIMessageConversion.swift |
| Function | SwiftAISDK.convertToModelMessages(_:tools:ignoreIncompleteToolCalls:convertDataPart:) | func convertToModelMessages(_ messages: [AIUIMessage], tools: [String : AITool], ignoreIncompleteToolCalls: Bool = false, convertDataPart: AIUIDataPartConverter? = nil) async throws -> [AIMessage] | Sources/SwiftAISDK/AIUIMessageConversion.swift |
| Function | SwiftAISDK.safeValidateUIMessages(_:) | func safeValidateUIMessages(_ messages: [AIUIMessage]) -> AIUIMessageValidationResult | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.safeValidateUIMessages(_:toolSchemas:) | func safeValidateUIMessages(_ messages: [AIUIMessage], toolSchemas: [String : AIUIMessageToolSchema]) -> AIUIMessageValidationResult | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.safeValidateUIMessages(_:toolSchemas:refineToolInput:) | func safeValidateUIMessages(_ messages: [AIUIMessage], toolSchemas: [String : AIUIMessageToolSchema], refineToolInput: [String : AIUIMessageToolInputRefiner]) async -> AIUIMessageValidationResult | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.validateUIMessages(_:) | @discardableResult func validateUIMessages(_ messages: [AIUIMessage]) throws -> [AIUIMessage] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.validateUIMessages(_:toolSchemas:) | @discardableResult func validateUIMessages(_ messages: [AIUIMessage], toolSchemas: [String : AIUIMessageToolSchema]) throws -> [AIUIMessage] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.validateUIMessages(_:toolSchemas:refineToolInput:) | @discardableResult func validateUIMessages(_ messages: [AIUIMessage], toolSchemas: [String : AIUIMessageToolSchema], refineToolInput: [String : AIUIMessageToolInputRefiner]) async throws -> [AIUIMessage] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.validateUIMessagesForAgent(_:toolSchemas:) | @discardableResult func validateUIMessagesForAgent(_ messages: [AIUIMessage], toolSchemas: [String : AIUIMessageToolSchema] = [:]) throws -> [AIUIMessage] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Function | SwiftAISDK.validateUIMessagesForAgent(_:toolSchemas:refineToolInput:) | @discardableResult func validateUIMessagesForAgent(_ messages: [AIUIMessage], toolSchemas: [String : AIUIMessageToolSchema] = [:], refineToolInput: [String : AIUIMessageToolInputRefiner]) async throws -> [AIUIMessage] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Initializer | SwiftAI.init(temperature:topP:topK:presencePenalty:frequencyPenalty:seed:maxOutputTokens:stopSequences:responseFormat:reasoning:tools:toolContexts:toolChoice:includeRawChunks:providerOptions:extraBody:headers:) | init(temperature: Double? = nil, topP: Double? = nil, topK: Int? = nil, presencePenalty: Double? = nil, frequencyPenalty: Double? = nil, seed: Int? = nil, maxOutputTokens: Int? = nil, stopSequences: [String] = [], responseFormat: AIResponseFormat? = nil, reasoning: String? = nil, tools: [String : JSONValue] = [:], toolContexts: [String : JSONValue] = [:], toolChoice: JSONValue? = nil, includeRawChunks: Bool = false, providerOptions: [String : JSONValue] = [:], extraBody: [String : JSONValue] = [:], headers: [String : String] = [:]) | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Initializer | SwiftAISDK.init(chatID:abortSignal:headers:body:metadata:) | init(chatID: String, abortSignal: AIAbortSignal? = nil, headers: [String : String] = [:], body: [String : JSONValue] = [:], metadata: JSONValue? = nil) | Sources/SwiftAISDK/AIChatTransport.swift |
| Initializer | SwiftAISDK.init(chatID:transport:messages:generateMessageID:onError:onFinish:sendAutomaticallyWhen:) | @MainActor init(chatID: String = UUID().uuidString, transport: any AIChatTransport, messages: [AIUIMessage] = [], generateMessageID: @escaping @Sendable () -> String = { UUID().uuidString }, onError: (@MainActor @Sendable (any Error) -> Void)? = nil, onFinish: (@MainActor @Sendable (AIChatSessionFinishEvent) -> Void)? = nil, sendAutomaticallyWhen: (@MainActor @Sendable ([AIUIMessage]) -> Bool)? = nil) | Sources/SwiftAISDK/AIChatSession.swift |
| Initializer | SwiftAISDK.init(chatID:trigger:messageID:responseMessageID:messages:abortSignal:headers:body:metadata:) | init(chatID: String, trigger: AIChatTransportTrigger = .submitMessage, messageID: String? = nil, responseMessageID: String? = nil, messages: [AIUIMessage], abortSignal: AIAbortSignal? = nil, headers: [String : String] = [:], body: [String : JSONValue] = [:], metadata: JSONValue? = nil) | Sources/SwiftAISDK/AIChatTransport.swift |
| Initializer | SwiftAISDK.init(headers:body:metadata:) | init(headers: [String : String] = [:], body: [String : JSONValue] = [:], metadata: JSONValue? = nil) | Sources/SwiftAISDK/AIChatSession.swift |
| Initializer | SwiftAISDK.init(message:) | init(message: AIUIMessage = .assistant()) | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Initializer | SwiftAISDK.init(message:isAborted:isCancelled:outcome:errorDescription:) | init(message: AIUIMessage, isAborted: Bool, isCancelled: Bool, outcome: AIUIMessageStreamOutcome, errorDescription: String? = nil) | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Initializer | SwiftAISDK.init(message:messages:isAbort:isDisconnect:isError:finishReason:) | init(message: AIUIMessage?, messages: [AIUIMessage], isAbort: Bool, isDisconnect: Bool, isError: Bool, finishReason: String? = nil) | Sources/SwiftAISDK/AIChatSession.swift |
| Initializer | SwiftAISDK.init(messages:issues:) | init(messages: [AIUIMessage], issues: [AIUIMessageValidationIssue]) | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Initializer | SwiftAISDK.init(model:executableTools:maxSteps:stopWhen:prepareStep:toolApproval:requestOptions:timeoutNanoseconds:retryPolicy:telemetry:sendReasoning:sendSources:sendFinish:generateMessageID:) | init(model: any LanguageModel, executableTools: [AITool] = [], maxSteps: Int = 5, stopWhen: [AIStopCondition] = [], prepareStep: AIPrepareStep? = nil, toolApproval: AIToolApproval? = nil, requestOptions: AIChatRequestOptions = AIChatRequestOptions(), timeoutNanoseconds: UInt64? = nil, retryPolicy: AIRetryPolicy = .default, telemetry: Telemetry.Options? = nil, sendReasoning: Bool = true, sendSources: Bool = false, sendFinish: Bool = true, generateMessageID: @escaping @Sendable () -> String = { UUID().uuidString }) | Sources/SwiftAISDK/AIChatTransport.swift |
| Initializer | SwiftAISDK.init(model:executableTools:maxSteps:toolCallers:stopWhen:prepareStep:toolApproval:requestOptions:timeoutNanoseconds:retryPolicy:telemetry:sendReasoning:sendSources:sendFinish:generateMessageID:) | init(model: any LanguageModel, executableTools: [AITool] = [], maxSteps: Int = 5, toolCallers: AIToolCallerRouting = [:], stopWhen: [AIStopCondition] = [], prepareStep: AIPrepareStep? = nil, toolApproval: AIToolApproval? = nil, requestOptions: AIChatRequestOptions = AIChatRequestOptions(), timeoutNanoseconds: UInt64? = nil, retryPolicy: AIRetryPolicy = .default, telemetry: Telemetry.Options? = nil, sendReasoning: Bool = true, sendSources: Bool = false, sendFinish: Bool = true, generateMessageID: @escaping @Sendable () -> String = { UUID().uuidString }) | Sources/SwiftAISDK/AIChatTransport.swift |
| Initializer | SwiftAISDK.init(path:message:) | init(path: String, message: String) | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Method | SwiftAI.languageModelRequest(messages:abortSignal:headers:) | func languageModelRequest(messages: [AIMessage], abortSignal: AIAbortSignal? = nil, headers additionalHeaders: [String : String] = [:]) -> LanguageModelRequest | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Method | SwiftAISDK.addToolApprovalResponse(_:id:metadata:options:) | @MainActor func addToolApprovalResponse(_ response: AIToolApprovalResponse, id: String? = nil, metadata: [String : JSONValue] = [:], options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.addToolOutput(_:id:metadata:options:) | @MainActor func addToolOutput(_ result: AIToolResult, id: String? = nil, metadata: [String : JSONValue] = [:], options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.addToolResult(_:id:metadata:options:) | @MainActor func addToolResult(_ result: AIToolResult, id: String? = nil, metadata: [String : JSONValue] = [:], options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.clearError() | @MainActor func clearError() | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.close() | func close() async | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.close() | func close() async | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.consume(_:) | @discardableResult mutating func consume(_ part: LanguageStreamPart) throws -> AIUIMessage | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Method | SwiftAISDK.consume(contentsOf:) | @discardableResult mutating func consume<S>(contentsOf parts: S) throws -> AIUIMessage where S : Sequence, S.Element == LanguageStreamPart | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Method | SwiftAISDK.dispose() | @MainActor func dispose() async | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.reconnectToStream(_:) | func reconnectToStream(_ request: AIChatReconnectRequest) async throws -> AsyncThrowingStream<AIUIMessage, any Error>? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.reconnectToStream(_:) | func reconnectToStream(_ request: AIChatReconnectRequest) async throws -> AsyncThrowingStream<AIUIMessage, any Error>? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.reconnectToStream(_:) | func reconnectToStream(_ request: AIChatReconnectRequest) async throws -> AsyncThrowingStream<AIUIMessage, any Error>? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.regenerate(messageID:options:) | @discardableResult @MainActor func regenerate(messageID: String? = nil, options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) -> Task<Void, Never> | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.resumeStream(options:) | @discardableResult @MainActor func resumeStream(options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) -> Task<Void, Never> | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.sendMessage(_:id:metadata:replacingMessageID:options:) | @discardableResult @MainActor func sendMessage(_ text: String, id: String? = nil, metadata: [String : JSONValue] = [:], replacingMessageID: String? = nil, options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) -> Task<Void, Never> | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.sendMessage(_:replacingMessageID:options:) | @discardableResult @MainActor func sendMessage(_ message: AIUIMessage, replacingMessageID: String? = nil, options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) -> Task<Void, Never> | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.sendMessage(options:) | @discardableResult @MainActor func sendMessage(options: AIChatSessionRequestOptions = AIChatSessionRequestOptions()) -> Task<Void, Never> | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.sendMessages(_:) | func sendMessages(_ request: AIChatTransportRequest) throws -> AsyncThrowingStream<AIUIMessage, any Error> | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.sendMessages(_:) | func sendMessages(_ request: AIChatTransportRequest) throws -> AsyncThrowingStream<AIUIMessage, any Error> | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Method | SwiftAISDK.setMessages(_:) | @MainActor func setMessages(_ messages: [AIUIMessage]) | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.stop(reason:) | @MainActor func stop(reason: String? = "stopped") | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Method | SwiftAISDK.stopAndWait(reason:) | @MainActor func stopAndWait(reason: String? = "stopped") async | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAI.extraBody | var extraBody: [String : JSONValue] | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.frequencyPenalty | var frequencyPenalty: Double? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.headers | var headers: [String : String] | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.includeRawChunks | var includeRawChunks: Bool | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.maxOutputTokens | var maxOutputTokens: Int? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.presencePenalty | var presencePenalty: Double? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.providerOptions | var providerOptions: [String : JSONValue] | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.reasoning | var reasoning: String? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.responseFormat | var responseFormat: AIResponseFormat? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.seed | var seed: Int? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.stopSequences | var stopSequences: [String] | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.temperature | var temperature: Double? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.toolCallConcurrency | var toolCallConcurrency: Int? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.toolChoice | var toolChoice: JSONValue? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.toolContexts | var toolContexts: [String : JSONValue] | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.tools | var tools: [String : JSONValue] | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.topK | var topK: Int? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAI.topP | var topP: Double? | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Instance Property | SwiftAISDK.abortSignal | var abortSignal: AIAbortSignal? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.abortSignal | var abortSignal: AIAbortSignal? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.body | var body: [String : JSONValue] | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.body | var body: [String : JSONValue] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.body | var body: [String : JSONValue] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.chatID | @MainActor let chatID: String | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.chatID | var chatID: String | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.chatID | var chatID: String | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.description | var description: String { get } | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Property | SwiftAISDK.error | @Published @MainActor var error: (any Error)? { get set } | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.errorDescription | var errorDescription: String? | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Property | SwiftAISDK.executableTools | var executableTools: [AITool] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.finishReason | var finishReason: String? | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.generateMessageID | @MainActor var generateMessageID: @Sendable () -> String | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.generateMessageID | var generateMessageID: @Sendable () -> String | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.headers | var headers: [String : String] | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.headers | var headers: [String : String] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.headers | var headers: [String : String] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.isAbort | var isAbort: Bool | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.isAborted | var isAborted: Bool | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Property | SwiftAISDK.isCancelled | var isCancelled: Bool | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Property | SwiftAISDK.isDisconnect | var isDisconnect: Bool | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.isError | var isError: Bool | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.isRunning | @MainActor var isRunning: Bool { get } | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.issues | var issues: [AIUIMessageValidationIssue] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Property | SwiftAISDK.isValid | var isValid: Bool { get } | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Property | SwiftAISDK.maxSteps | var maxSteps: Int | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.message | var message: AIUIMessage? | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.message | var message: AIUIMessage | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Property | SwiftAISDK.message | var message: AIUIMessage { get } | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Property | SwiftAISDK.message | var message: String | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Property | SwiftAISDK.messageID | var messageID: String? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.messages | var messages: [AIUIMessage] | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.messages | @Published @MainActor var messages: [AIUIMessage] { get set } | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.messages | var messages: [AIUIMessage] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.messages | var messages: [AIUIMessage] | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Property | SwiftAISDK.metadata | var metadata: JSONValue? | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.metadata | var metadata: JSONValue? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.metadata | var metadata: JSONValue? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.model | var model: any LanguageModel | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.onError | @MainActor var onError: (@MainActor @Sendable (any Error) -> Void)? | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.onFinish | @MainActor var onFinish: (@MainActor @Sendable (AIChatSessionFinishEvent) -> Void)? | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.outcome | var outcome: AIUIMessageStreamOutcome | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Instance Property | SwiftAISDK.path | var path: String | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Instance Property | SwiftAISDK.prepareStep | var prepareStep: AIPrepareStep? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.requestOptions | var requestOptions: AIChatRequestOptions | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.responseMessageID | var responseMessageID: String? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.retryPolicy | var retryPolicy: AIRetryPolicy | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.sendAutomaticallyWhen | @MainActor var sendAutomaticallyWhen: (@MainActor @Sendable ([AIUIMessage]) -> Bool)? | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.sendFinish | var sendFinish: Bool | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.sendReasoning | var sendReasoning: Bool | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.sendSources | var sendSources: Bool | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.status | @Published @MainActor var status: AIChatSessionStatus { get set } | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.stopWhen | var stopWhen: [AIStopCondition] | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.telemetry | var telemetry: Telemetry.Options? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.timeoutNanoseconds | var timeoutNanoseconds: UInt64? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.toolApproval | var toolApproval: AIToolApproval? | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.toolCallers | var toolCallers: AIToolCallerRouting | Sources/SwiftAISDK/AIChatTransport.swift |
| Instance Property | SwiftAISDK.transport | @MainActor var transport: any AIChatTransport | Sources/SwiftAISDK/AIChatSession.swift |
| Instance Property | SwiftAISDK.trigger | var trigger: AIChatTransportTrigger | Sources/SwiftAISDK/AIChatTransport.swift |
| Protocol | SwiftAISDK.AIChatTransport | protocol AIChatTransport : Sendable | Sources/SwiftAISDK/AIChatTransport.swift |
| Structure | SwiftAI.AIChatRequestOptions | struct AIChatRequestOptions | Packages/swift-ai-core/Sources/SwiftAI/AIChatTransport.swift |
| Structure | SwiftAISDK.AIChatReconnectRequest | struct AIChatReconnectRequest | Sources/SwiftAISDK/AIChatTransport.swift |
| Structure | SwiftAISDK.AIChatSessionFinishEvent | struct AIChatSessionFinishEvent | Sources/SwiftAISDK/AIChatSession.swift |
| Structure | SwiftAISDK.AIChatSessionRequestOptions | struct AIChatSessionRequestOptions | Sources/SwiftAISDK/AIChatSession.swift |
| Structure | SwiftAISDK.AIChatTransportRequest | struct AIChatTransportRequest | Sources/SwiftAISDK/AIChatTransport.swift |
| Structure | SwiftAISDK.AIUIMessageStreamEndEvent | struct AIUIMessageStreamEndEvent | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Structure | SwiftAISDK.AIUIMessageStreamReducer | struct AIUIMessageStreamReducer | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Structure | SwiftAISDK.AIUIMessageValidationIssue | struct AIUIMessageValidationIssue | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Structure | SwiftAISDK.AIUIMessageValidationResult | struct AIUIMessageValidationResult | Sources/SwiftAISDK/AIUIMessageValidation.swift |
| Structure | SwiftAISDK.DirectAIChatTransport | struct DirectAIChatTransport | Sources/SwiftAISDK/AIChatTransport.swift |
| Type Alias | SwiftAISDK.AIUIDataPartConverter | typealias AIUIDataPartConverter = @Sendable (AIUIDataPart) throws -> AIContentPart? | Sources/SwiftAISDK/AIUIMessageConversion.swift |
| Type Method | SwiftAISDK.snapshots(from:messageID:terminateOnError:) | static func snapshots(from stream: AsyncThrowingStream<LanguageStreamPart, any Error>, messageID: String = UUID().uuidString, terminateOnError: Bool = false) -> AsyncThrowingStream<AIUIMessage, any Error> | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
| Type Method | SwiftAISDK.snapshots(from:messageID:terminateOnError:originalMessage:onEnd:) | static func snapshots(from stream: AsyncThrowingStream<LanguageStreamPart, any Error>, messageID: String = UUID().uuidString, terminateOnError: Bool = false, originalMessage: AIUIMessage? = nil, onEnd: (@Sendable (AIUIMessageStreamEndEvent) async -> Void)? = nil) -> AsyncThrowingStream<AIUIMessage, any Error> | Sources/SwiftAISDK/AIUIMessageStreamReducer.swift |
Awaitable lifecycle and restored tools
Section titled “Awaitable lifecycle and restored tools”await session.stopAndWait() waits for active send/reconnect consumer tasks to settle;
await session.dispose() also calls the transport’s defaultable close().
Existing synchronous stop() remains available. Cancellation suppresses an
automatic follow-up even when a restored or superseded stream settles later.
Custom transports own the completion of asynchronous producers that ignore
cancellation: the public stream contract has no producer-completion handle.
Use AIUIMessageToolSchema with schema-aware validateUIMessages or
validateUIMessagesForAgent. Async overloads accept refineToolInput callbacks
and check the preserved pre-refinement approval input before refinement.
DirectAIChatTransport bridges current tool refiners and output converters.
Agent normalization records unavailableStaticToolCallIDs for removed static
tools. Successful missing-tool outputs become an omission message; dynamic
outputs, errors and tools restored with a current converter keep their intended
model representation. Browser HTTP/WebSocket framing and explicit UI stream
step boundaries remain separate deferred surfaces.
When a streamed tool call reuses an ID, its latest nonempty name replaces the
previous name during input and completion. pruneMessages removes a reasoning
group when all following content before the next reasoning group was pruned;
reasoning attached to retained text/tools and trailing reasoning survive.