File tree Expand file tree Collapse file tree
Tool/Sources/OpenAIService Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,8 +69,35 @@ public class ChatGPTService: ChatGPTServiceType {
6969 public var functionProvider : ChatGPTFunctionProvider
7070
7171 var runningTask : Task < Void , Never > ?
72- var buildCompletionStreamAPI : CompletionStreamAPIBuilder = OpenAICompletionStreamAPI . init
73- var buildCompletionAPI : CompletionAPIBuilder = OpenAICompletionAPI . init
72+ var buildCompletionStreamAPI : CompletionStreamAPIBuilder = {
73+ apiKey, model, endpoint, requestBody in
74+ switch model. format {
75+ case . googleAI:
76+ fatalError ( )
77+ case . openAI, . openAICompatible, . azureOpenAI:
78+ return OpenAICompletionStreamAPI (
79+ apiKey: apiKey,
80+ model: model,
81+ endpoint: endpoint,
82+ requestBody: requestBody
83+ )
84+ }
85+ }
86+
87+ var buildCompletionAPI : CompletionAPIBuilder = {
88+ apiKey, model, endpoint, requestBody in
89+ switch model. format {
90+ case . googleAI:
91+ fatalError ( )
92+ case . openAI, . openAICompatible, . azureOpenAI:
93+ return OpenAICompletionAPI (
94+ apiKey: apiKey,
95+ model: model,
96+ endpoint: endpoint,
97+ requestBody: requestBody
98+ )
99+ }
100+ }
74101
75102 public init (
76103 memory: ChatGPTMemory = AutoManagedChatGPTMemory (
You can’t perform that action at this time.
0 commit comments