Skip to content

Commit 55a4b7b

Browse files
committed
Merge branch 'release/3.0.1'
2 parents aa46ca9 + 92354f0 commit 55a4b7b

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

LangChainDemo/LangChainDemo/AgentExecutor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public func runAgent( input: String, llm: LLM, tools: [BaseTool], callbacks: [Ba
152152
}
153153

154154

155-
let workflow = StateGraph( schema: AgentExecutorState.schema ) {
155+
let workflow = StateGraph( channels: AgentExecutorState.schema ) {
156156
AgentExecutorState( $0 )
157157
}
158158

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
To use the LangGraph for Swift library in a [SwiftPM] project, add the following line to the dependencies in your `Package.swift` file:
1010

1111
```Swift
12-
.package(url: "https://github.com/bsorrentino/LangGraph-Swift.git", from: "1.0.0"),
12+
.package(url: "https://github.com/bsorrentino/LangGraph-Swift.git", from: "3.0.1"),
1313
```
1414
Include `LangGraph` as a dependency for your executable target:
1515

@@ -94,10 +94,10 @@ In the [LangChainDemo](LangChainDemo) project, you can find the porting of [Agen
9494
}
9595

9696

97-
let workflow = StateGraph {
98-
AgentExecutorState($0) // $0 is the initial state provided by the graph
97+
let workflow = StateGraph( channels: AgentExecutorState.schema ) {
98+
AgentExecutorState( $0 )
9999
}
100-
100+
101101
try workflow.addNode("call_agent" ) { state in
102102

103103
guard let input = state.input else {

Sources/LangGraph/LangGraph.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public class StateGraph<State: AgentState> {
212212
let schema: Channels
213213

214214
init( owner: StateGraph ) {
215-
self.schema = owner.schema
215+
self.schema = owner.channels
216216
self.stateFactory = owner.stateFactory
217217
self.nodes = Dictionary()
218218
self.edges = Dictionary()
@@ -411,10 +411,10 @@ public class StateGraph<State: AgentState> {
411411
private var finishPoint: String?
412412

413413
private var stateFactory: StateFactory<State>
414-
private var schema: Channels
414+
private var channels: Channels
415415

416-
public init( schema: Channels = [:], stateFactory: @escaping StateFactory<State> ) {
417-
self.schema = schema
416+
public init( channels: Channels = [:], stateFactory: @escaping StateFactory<State> ) {
417+
self.channels = channels
418418
self.stateFactory = stateFactory
419419

420420
}

Tests/LangGraphTests/LangGraphTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ final class LangGraphTests: XCTestCase {
286286

287287
func testAppender() async throws {
288288

289-
let workflow = StateGraph( schema: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }
289+
let workflow = StateGraph( channels: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }
290290

291291
try workflow.addNode("agent_1") { state in
292292

@@ -320,7 +320,7 @@ final class LangGraphTests: XCTestCase {
320320

321321
func testWithStream() async throws {
322322

323-
let workflow = StateGraph( schema: AgentStateWithAppender.schema ) { AgentStateWithAppender( $0 ) }
323+
let workflow = StateGraph( channels: AgentStateWithAppender.schema ) { AgentStateWithAppender( $0 ) }
324324

325325
try workflow.addNode("agent_1") { state in
326326
["messages": "message1"]
@@ -356,7 +356,7 @@ final class LangGraphTests: XCTestCase {
356356

357357
func testWithStreamAnCancellation() async throws {
358358

359-
let workflow = StateGraph( schema: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }
359+
let workflow = StateGraph( channels: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }
360360

361361
try workflow.addNode("agent_1") { state in
362362
try await Task.sleep(nanoseconds: 500_000_000)

0 commit comments

Comments
 (0)