File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Tool/Sources/LangChain/ChatModel Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,19 @@ import OpenAIService
33
44public struct OpenAIChat : ChatModel {
55 public var configuration : ChatGPTConfiguration
6+ public var memory : ChatGPTMemory
7+ public var functionProvider : ChatGPTFunctionProvider
68 public var stream : Bool
79
810 public init (
9- configuration: ChatGPTConfiguration ,
11+ configuration: ChatGPTConfiguration = UserPreferenceChatGPTConfiguration ( ) ,
12+ memory: ChatGPTMemory = ConversationChatGPTMemory ( systemPrompt: " " ) ,
13+ functionProvider: ChatGPTFunctionProvider = NoChatGPTFunctionProvider ( ) ,
1014 stream: Bool
1115 ) {
1216 self . configuration = configuration
17+ self . memory = memory
18+ self . functionProvider = functionProvider
1319 self . stream = stream
1420 }
1521
@@ -18,12 +24,11 @@ public struct OpenAIChat: ChatModel {
1824 stops: [ String ] ,
1925 callbackManagers: [ CallbackManager ]
2026 ) async throws -> String {
21- let memory = AutoManagedChatGPTMemory (
22- systemPrompt : " " ,
27+ let service = ChatGPTService (
28+ memory : memory ,
2329 configuration: configuration,
24- functionProvider: NoChatGPTFunctionProvider ( )
30+ functionProvider: functionProvider
2531 )
26- let service = ChatGPTService ( memory: memory, configuration: configuration)
2732 for message in prompt {
2833 let role : OpenAIService . ChatMessage . Role = {
2934 switch message. role {
You can’t perform that action at this time.
0 commit comments