Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
196cdcf
Merge tag '0.23.2' into develop
intitni Sep 9, 2023
dea46ab
Add Copilot for Xcode Plus.xcworkspace
intitni Sep 9, 2023
7288b61
Add workspace.didUpdateFilespace
intitni Sep 9, 2023
16c76b4
Update
intitni Sep 10, 2023
a4439e6
Change type of Filespace.language
intitni Sep 11, 2023
cede9e0
Add EnhancedWorkspacePlugin
intitni Sep 11, 2023
85872fa
Move ChatContextCollector to Tool
intitni Sep 14, 2023
2a686d3
Track workspaceURL
intitni Sep 17, 2023
37ea5c0
Add ProChatContextCollectors
intitni Sep 17, 2023
8c2f2b8
Remove useless schemes
intitni Sep 17, 2023
e187a35
Add function calling agent
intitni Sep 17, 2023
477c6fc
Update function call base agent
intitni Sep 17, 2023
eb71146
Fix latestActiveXcode initialization
intitni Sep 17, 2023
a08cca8
Support no memory for OpenAIChat
intitni Sep 17, 2023
57925ce
Update
intitni Sep 17, 2023
59e9a04
Make AgentScratchPad generic
intitni Sep 18, 2023
5e8596c
Rename cases of ReturnValue
intitni Sep 18, 2023
e2c469f
Adjust agent
intitni Sep 18, 2023
c1f1250
Update prompt
intitni Sep 18, 2023
67c200e
Update
intitni Sep 18, 2023
ff01a98
Add ReActFunctionCallingChatAgent
intitni Sep 18, 2023
144e4e6
ReActFunctionCallingChatAgent
intitni Sep 18, 2023
87f876a
Add StructuredOutputChatModelChain
intitni Sep 19, 2023
314841b
Update
intitni Sep 19, 2023
cfd11d8
Update
intitni Sep 19, 2023
48acf04
Adjust API of ChatGPTFunction
intitni Sep 20, 2023
d4c811c
Add realtimeActiveProjectURL
intitni Sep 20, 2023
8334ce8
Make active project/workspace/document URL optional
intitni Sep 20, 2023
40fe5d4
Update AgentExecutor
intitni Sep 21, 2023
b30d42b
Update
intitni Sep 21, 2023
bf94948
Update QAInformationRetrievalChain to support multiple vector store
intitni Sep 21, 2023
14c8d07
Add dimensions to embedding model
intitni Sep 21, 2023
c74a50b
Update
intitni Sep 21, 2023
01fed71
Add comment
intitni Sep 21, 2023
b0605ba
Make the keys publick
intitni Sep 21, 2023
4860fc8
Add a method to access typed metadata keys
intitni Sep 21, 2023
ba3b360
Simplify usage of StructuredOutputChatModelChain
intitni Sep 21, 2023
74df8f7
Adjust implementation of QAInformationRetrievalChain
intitni Sep 21, 2023
de74bfb
Fix FunctionCallingAgentTool
intitni Sep 21, 2023
a0230b4
Update
intitni Sep 21, 2023
12cd285
WIP
intitni Sep 22, 2023
4a702ab
Update
intitni Sep 24, 2023
3967eb4
Update
intitni Sep 26, 2023
dffdf5f
Update pro package
intitni Sep 26, 2023
ef1e9c9
Merge branch 'feature/project-scope-v1' into develop
intitni Sep 26, 2023
268c818
Add settings keys for prompt to code chat model and embedding model
intitni Sep 26, 2023
d16f291
Add pickers for prompt to code chat/embedding model
intitni Sep 26, 2023
74cc12d
Update PromtToCodeService to use the defined models
intitni Sep 26, 2023
d38a481
Add description to the function calling toggle
intitni Sep 26, 2023
202450c
Merge branch 'feature/custom-prompt-to-code-model' into develop
intitni Sep 26, 2023
46bf8aa
Fix a racing issue
intitni Sep 26, 2023
9ee64dc
Update pro package
intitni Sep 27, 2023
cc0d5d3
Remove generic of OverridingEmbeddingConfiguration
intitni Sep 27, 2023
30b556d
Support changing temperature and model from chat tab
intitni Sep 27, 2023
7fedca9
Merge branch 'feature/change-chat-model-and-temparature' into develop
intitni Sep 27, 2023
ce539f9
Fix unit tests
intitni Sep 27, 2023
363e2f8
Update pro package
intitni Sep 27, 2023
f43065e
Bump GitHub Copilot to 1.10.3
intitni Sep 27, 2023
91ff0eb
Bump Codeium to 1.2.93
intitni Sep 27, 2023
46d91fb
Bump version to 0.24.0
intitni Sep 27, 2023
edc8c29
Check if to include pro package with a configuration file
intitni Sep 27, 2023
d171043
Prevent opening multiple prompt to code panel
intitni Sep 27, 2023
9b6f798
Fix project url detection when it's a git worktree, workspace, xcproj…
intitni Sep 27, 2023
07cf6e8
Adjust prompt
intitni Sep 27, 2023
b291d99
Update chat instruction
intitni Sep 27, 2023
20bf45d
Update
intitni Sep 27, 2023
5aedc75
Fix that activateOrCreatePromptToCode is not making the panel active
intitni Sep 27, 2023
17d202a
Add toggle to disable enhanced workspace
intitni Sep 27, 2023
4fed754
Fix project URL
intitni Sep 27, 2023
4affcf0
Update appcast.xml
intitni Sep 28, 2023
dfd69e8
Update
intitni Sep 28, 2023
151776f
Merge branch 'release/0.24.0'
intitni Sep 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ReActFunctionCallingChatAgent
  • Loading branch information
intitni committed Sep 18, 2023
commit ff01a983495e63b66a5d3bc3e13c33a7bec790d5
2 changes: 1 addition & 1 deletion Pro
Submodule Pro updated from 051590 to 36828e
13 changes: 7 additions & 6 deletions Tool/Sources/LangChain/Agent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,19 @@ public struct AgentFinish<Output: AgentOutputParsable> {
public enum AgentNextStep<Output: AgentOutputParsable> {
case actions([AgentAction])
case finish(AgentFinish<Output>)
case thought(String)
}

public struct AgentScratchPad<Content: Equatable>: Equatable {
var content: Content
public var content: Content

public init(content: Content) {
self.content = content
}
}

public struct AgentInput<T, ScratchPadContent: Equatable> {
var input: T
var thoughts: AgentScratchPad<ScratchPadContent>
public var input: T
public var thoughts: AgentScratchPad<ScratchPadContent>

public init(input: T, thoughts: AgentScratchPad<ScratchPadContent>) {
self.input = input
Expand Down Expand Up @@ -146,8 +149,6 @@ public extension Agent {
return finish
case .actions:
return .init(returnValue: .unstructured(output.content ?? ""), log: output.content ?? "")
case let .thought(content):
return .init(returnValue: .unstructured(content), log: content)
}
}
}
Expand Down
22 changes: 9 additions & 13 deletions Tool/Sources/LangChain/AgentExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@ public actor AgentExecutor<InnerAgent: Agent>: Chain
var earlyStopHandleType: AgentEarlyStopHandleType
var now: () -> Date = { Date() }
var isCancelled = false
var initialSteps: [AgentAction]

public init(
agent: InnerAgent,
tools: [AgentTool],
maxIteration: Int? = 10,
maxExecutionTime: Double? = nil,
earlyStopHandleType: AgentEarlyStopHandleType = .force
earlyStopHandleType: AgentEarlyStopHandleType = .force,
initialSteps: [AgentAction] = []
) {
self.agent = agent
self.tools = tools.reduce(into: [:]) { $0[$1.name] = $1 }
self.maxIteration = maxIteration
self.maxExecutionTime = maxExecutionTime
self.earlyStopHandleType = earlyStopHandleType
self.initialSteps = initialSteps
}

public func callLogic(
Expand All @@ -41,7 +44,7 @@ public actor AgentExecutor<InnerAgent: Agent>: Chain

let startTime = now().timeIntervalSince1970
var iterations = 0
var intermediateSteps: [AgentAction] = []
var intermediateSteps: [AgentAction] = initialSteps

func shouldContinue() -> Bool {
if isCancelled { return false }
Expand Down Expand Up @@ -84,8 +87,6 @@ public actor AgentExecutor<InnerAgent: Agent>: Chain
callbackManagers: callbackManagers
)
}
case .thought:
break
}
iterations += 1
}
Expand Down Expand Up @@ -152,6 +153,10 @@ extension AgentExecutor {
for action in actions {
callbackManagers
.forEach { $0.send(CallbackEvents.AgentActionDidStart(info: action)) }
if action.observation != nil {
taskGroup.addTask { action }
continue
}
guard let tool = tools[action.toolName] else { throw InvalidToolError() }
taskGroup.addTask {
let observation = try await tool.run(input: action.toolInput)
Expand All @@ -169,15 +174,6 @@ extension AgentExecutor {
}

return .actions(completedActions)
case let .thought(content):
return .actions([
.init(
toolName: "Thought",
toolInput: content,
log: "Thought: \(content)",
observation: nil
),
])
}
}

Expand Down
2 changes: 0 additions & 2 deletions Tool/Sources/LangChain/Agents/FunctionCallingChatAgent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ public class FunctionCallingChatAgent<Output: AgentOutputParsable & Decodable>:
case let .unstructured(x), let .structured(x):
return .finish(.init(returnValue: .unstructured(x), log: finish.log))
}
case let .thought(content):
return .finish(.init(returnValue: .unstructured(content), log: content))
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Tool/Sources/LangChain/Chains/LLMChain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import Foundation
public class ChatModelChain<Input>: Chain {
public typealias Output = ChatMessage

var chatModel: ChatModel
var promptTemplate: (Input) -> [ChatMessage]
var stops: [String]
public internal(set) var chatModel: ChatModel
public internal(set) var promptTemplate: (Input) -> [ChatMessage]
public internal(set) var stops: [String]

public init(
chatModel: ChatModel,
Expand Down
7 changes: 6 additions & 1 deletion Tool/Sources/Logger/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum LogLevel: String {
public final class Logger {
private let subsystem: String
private let category: String
private let osLog: OSLog

public static let service = Logger(category: "Service")
public static let ui = Logger(category: "UI")
Expand All @@ -25,6 +26,7 @@ public final class Logger {
public init(subsystem: String = "com.intii.CopilotForXcode", category: String) {
self.subsystem = subsystem
self.category = category
osLog = OSLog(subsystem: subsystem, category: category)
}

func log(level: LogLevel, message: String) {
Expand All @@ -38,7 +40,6 @@ public final class Logger {
osLogType = .error
}

let osLog = OSLog(subsystem: subsystem, category: category)
os_log("%{public}@", log: osLog, type: osLogType, message as CVarArg)
}

Expand All @@ -57,4 +58,8 @@ public final class Logger {
public func error(_ error: Error) {
log(level: .error, message: error.localizedDescription)
}

public func signpost(_ type: OSSignpostType, name: StaticString) {
os_signpost(type, log: osLog, name: name)
}
}