-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2001 from solliancenet/cp-langraph-react-workflow
Introduction of the LangGraph ReAct workflow
- Loading branch information
Showing
11 changed files
with
134 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...otnet/Common/Models/ResourceProviders/Agent/AgentWorkflows/LangGraphReactAgentWorkflow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
namespace FoundationaLLM.Common.Models.ResourceProviders.Agent.AgentWorkflows | ||
{ | ||
/// <summary> | ||
/// Provides an agent workflow configuration for a LangGraph ReAct Agent workflow. | ||
/// </summary> | ||
public class LangGraphReactAgentWorkflow : AgentWorkflowBase | ||
{ | ||
/// <inheritdoc/> | ||
[JsonIgnore] | ||
public override string Type => AgentWorkflowTypes.LangGraphReactAgent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/python/PythonSDK/foundationallm/models/agents/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...ndationallm/models/agents/agent_workflows/langchain_expression_language_agent_workflow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
.../PythonSDK/foundationallm/models/agents/agent_workflows/langgraph_react_agent_workflow.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from typing import Any, Self, Literal | ||
from foundationallm.langchain.exceptions import LangChainException | ||
from foundationallm.utils import object_utils | ||
from .agent_workflow_base import AgentWorkflowBase | ||
|
||
class LangGraphReactAgentWorkflow(AgentWorkflowBase): | ||
""" | ||
The configuration for a LangGraph ReAct agent workflow. | ||
""" | ||
type: Literal["langgraph-react-agent-workflow"] = "langgraph-react-agent-workflow" | ||
|
||
@staticmethod | ||
def from_object(obj: Any) -> Self: | ||
|
||
workflow: LangGraphReactAgentWorkflow = None | ||
|
||
try: | ||
workflow = LangGraphReactAgentWorkflow(**object_utils.translate_keys(obj)) | ||
except Exception as e: | ||
raise LangChainException(f"The LangGraph ReAct Agent Workflow object provided is invalid. {str(e)}", 400) | ||
|
||
if workflow is None: | ||
raise LangChainException("The LangGraph ReAct Agent Workflow object provided is invalid.", 400) | ||
|
||
return workflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters