Skip to content

Commit

Permalink
Merge branch 'release/3.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Aug 5, 2024
2 parents aa46ca9 + 92354f0 commit 55a4b7b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LangChainDemo/LangChainDemo/AgentExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public func runAgent( input: String, llm: LLM, tools: [BaseTool], callbacks: [Ba
}


let workflow = StateGraph( schema: AgentExecutorState.schema ) {
let workflow = StateGraph( channels: AgentExecutorState.schema ) {
AgentExecutorState( $0 )
}

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
To use the LangGraph for Swift library in a [SwiftPM] project, add the following line to the dependencies in your `Package.swift` file:

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

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


let workflow = StateGraph {
AgentExecutorState($0) // $0 is the initial state provided by the graph
let workflow = StateGraph( channels: AgentExecutorState.schema ) {
AgentExecutorState( $0 )
}

try workflow.addNode("call_agent" ) { state in

guard let input = state.input else {
Expand Down
8 changes: 4 additions & 4 deletions Sources/LangGraph/LangGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public class StateGraph<State: AgentState> {
let schema: Channels

init( owner: StateGraph ) {
self.schema = owner.schema
self.schema = owner.channels
self.stateFactory = owner.stateFactory
self.nodes = Dictionary()
self.edges = Dictionary()
Expand Down Expand Up @@ -411,10 +411,10 @@ public class StateGraph<State: AgentState> {
private var finishPoint: String?

private var stateFactory: StateFactory<State>
private var schema: Channels
private var channels: Channels

public init( schema: Channels = [:], stateFactory: @escaping StateFactory<State> ) {
self.schema = schema
public init( channels: Channels = [:], stateFactory: @escaping StateFactory<State> ) {
self.channels = channels
self.stateFactory = stateFactory

}
Expand Down
6 changes: 3 additions & 3 deletions Tests/LangGraphTests/LangGraphTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ final class LangGraphTests: XCTestCase {

func testAppender() async throws {

let workflow = StateGraph( schema: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }
let workflow = StateGraph( channels: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }

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

Expand Down Expand Up @@ -320,7 +320,7 @@ final class LangGraphTests: XCTestCase {

func testWithStream() async throws {

let workflow = StateGraph( schema: AgentStateWithAppender.schema ) { AgentStateWithAppender( $0 ) }
let workflow = StateGraph( channels: AgentStateWithAppender.schema ) { AgentStateWithAppender( $0 ) }

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

func testWithStreamAnCancellation() async throws {

let workflow = StateGraph( schema: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }
let workflow = StateGraph( channels: AgentStateWithAppender.schema ) { AgentStateWithAppender($0) }

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

0 comments on commit 55a4b7b

Please sign in to comment.