From bbe4a644bf71cb04245f62167bfa20183a364a13 Mon Sep 17 00:00:00 2001 From: Kevin Hermawan <84965338+kevinhermawan@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:02:27 +0700 Subject: [PATCH] refactor: makes the `id` in the `ChatCompletion` and `ChatCompletionChunk` optional --- Sources/LLMChatOpenAI/ChatCompletion.swift | 2 +- Sources/LLMChatOpenAI/ChatCompletionChunk.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/LLMChatOpenAI/ChatCompletion.swift b/Sources/LLMChatOpenAI/ChatCompletion.swift index efbd611..bd2d679 100644 --- a/Sources/LLMChatOpenAI/ChatCompletion.swift +++ b/Sources/LLMChatOpenAI/ChatCompletion.swift @@ -10,7 +10,7 @@ import Foundation /// A struct that represents a chat completion response. public struct ChatCompletion: Decodable, Sendable { /// A unique identifier for the chat completion. - public let id: String + public let id: String? /// An array of chat completion choices. Can be more than one if `n` is greater than 1. public let choices: [Choice] diff --git a/Sources/LLMChatOpenAI/ChatCompletionChunk.swift b/Sources/LLMChatOpenAI/ChatCompletionChunk.swift index 6b2dbef..a88a62b 100644 --- a/Sources/LLMChatOpenAI/ChatCompletionChunk.swift +++ b/Sources/LLMChatOpenAI/ChatCompletionChunk.swift @@ -10,7 +10,7 @@ import Foundation /// A struct that represents a streamed chunk of a chat completion response. public struct ChatCompletionChunk: Decodable, Sendable { /// A unique identifier for the chat completion. Each chunk has the same identifier. - public let id: String + public let id: String? /// An array of chat completion choices. Can contain more than one elements if `n` is greater than 1. public var choices: [Choice]