File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Demo/Demo/ChatCompletions
Sources/SwiftOpenAI/OpenAI/DataModels Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ final class ChatCompletionsViewModel {
2323 maxTokens: 2000 )
2424 if isStream {
2525 do {
26- for try await newMessage in try await openAI. createChatCompletionsStream ( model: . gpt4 ( . base) ,
26+ for try await newMessage in try await openAI. createChatCompletionsStream ( model: . gpt4o ( . base) ,
2727 messages: messages,
2828 optionalParameters: optionalParameters) {
2929 onReceiveStream ( newMessage: newMessage)
Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ let optionalParameters = ChatCompletionsOptionalParameters(
233233do {
234234 // Create a chat completion stream using the OpenAI API.
235235 let stream = try await openAI.createChatCompletionsStream (
236- model : .gpt4 (.base ), // Specify the model, here GPT-4 base model.
236+ model : .gpt4o (.base ), // Specify the model, here GPT-4 base model.
237237 messages : messages, // Provide the conversation messages.
238238 optionalParameters : optionalParameters // Include the optional parameters.
239239 )
Original file line number Diff line number Diff line change 11import Foundation
22
33public enum OpenAIModelType {
4+ case gpt4o( GPT4o )
45 case gpt4( GPT4 )
56 case gpt3_5( GPT3_5 )
67 case embedding( EmbeddingModel )
78
89 var name : String {
910 switch self {
11+ case . gpt4o( let gpt4oModel) :
12+ return gpt4oModel. rawValue
1013 case . gpt4( let gpt4Model) :
1114 return gpt4Model. rawValue
1215 case . gpt3_5( let gpt3_5Model) :
@@ -28,6 +31,11 @@ public enum OpenAIImageModelType {
2831 }
2932}
3033
34+ public enum GPT4o : String {
35+ case base = " gpt-4o "
36+ case gpt_4o_2024_05_13 = " gpt-4o-2024-05-13 "
37+ }
38+
3139public enum GPT4 : String {
3240 case base = " gpt-4-turbo "
3341 case gpt_4_turbo_2024_04_09 = " gpt-4-turbo-2024-04-09 "
You can’t perform that action at this time.
0 commit comments