feat: Added tutorial and warnings for langchain orchestration template - #572
feat: Added tutorial and warnings for langchain orchestration template#572BrigittaK307 wants to merge 20 commits into
Conversation
| id: langgraph-orchestration-client | ||
| title: Using Orchestration Client in LangGraph Workflows | ||
| sidebar_label: Orchestration Client in LangGraph |
There was a problem hiding this comment.
| id: langgraph-orchestration-client | |
| title: Using Orchestration Client in LangGraph Workflows | |
| sidebar_label: Orchestration Client in LangGraph | |
| id: langgraph-template-orchestration-client | |
| title: Using Orchestration Templates in LangGraph Agents | |
| sidebar_label: Using Orchestration Templates in LangGraph Agents |
| } | ||
| }); | ||
| ``` | ||
|
|
There was a problem hiding this comment.
[pp] As a tutorial, I would prefer if there was something e.g. at the bottom for both that shows how to combine these into an actual LangGraph (or maybe createAgent()...)
| .addConditionalEdges(START, routeByTurn, [ | ||
| 'firstTurnNode', | ||
| 'conversationNode' | ||
| ]) | ||
| .addEdge('firstTurnNode', END) | ||
| .addEdge('conversationNode', END) |
There was a problem hiding this comment.
[pp] I think there should be edge from START -> firstTurnNode -> conversationNode with a conditional edge from conversationNode to itself or END (in this case perhaps just END).
There was a problem hiding this comment.
The graph re-enters from START on every graph.invoke() call. Adapting the firstTurnNode → conversationNode case would cause both nodes to fire on turn 1, making two LLM calls instead of one.
| When initializing the client with an orchestration configuration reference, any messages passed to the `chatCompletion()` or `stream()` methods are automatically appended to the `messages_history` array as they cannot be merged into the stored configuration's prompt template. | ||
| The `messages` property defined in the `template` array are appended after any existing `messagesHistory` entries. | ||
| :::warning | ||
| Messages passed alongside a configuration reference are **automatically routed to `messages_history`** and cannot be merged into the remotely stored configuration's prompt template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows. |
There was a problem hiding this comment.
| Messages passed alongside a configuration reference are **automatically routed to `messages_history`** and cannot be merged into the remotely stored configuration's prompt template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows. | |
| Messages passed alongside a configuration reference are **automatically routed to `messages_history`** and cannot be merged into the remotely stored configuration's prompt template. See the [LangGraph tutorial](../tutorials/langgraph-template-orchestration-client) for the recommended two-client pattern in multi-turn workflows with configuration references. |
| const agent = createAgent({ | ||
| model: clientWithTemplate, | ||
| tools: [], | ||
| checkpointSaver: new MemorySaver() |
There was a problem hiding this comment.
| checkpointSaver: new MemorySaver() | |
| checkpointer: new MemorySaver() |
There was a problem hiding this comment.
To ease review please enable twoslash on all code blocks via ```ts twoslash
Related to https://github.com/orgs/SAP/projects/111/views/1?pane=issue&itemId=141534346&issue=SAP%7Cai-sdk-js-backlog%7C438