Skip to content

Commit

Permalink
change summaryNode to messageSummaryNode for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrank-summit committed Feb 4, 2025
1 parent 6b94dce commit d025941
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/agents/workflows/orchestrator/nodes.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { createInputNode } from './nodes/inputNode.js';
import { createSummaryNode } from './nodes/summaryNode.js';
import { createMessageSummaryNode } from './nodes/messageSummaryNode.js';
import { createWorkflowSummaryNode } from './nodes/workflowSummaryNode.js';
import { OrchestratorConfig } from './types.js';

export const createNodes = async (config: OrchestratorConfig) => {
const inputNode = createInputNode(config);
const summaryNode = createSummaryNode(config);
const messageSummaryNode = createMessageSummaryNode(config);
const workflowSummaryNode = createWorkflowSummaryNode(config);
const toolNode = config.toolNode;

return {
inputNode,
summaryNode,
messageSummaryNode,
workflowSummaryNode,
toolNode,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { AIMessage } from '@langchain/core/messages';
import { createLogger } from '../../../../utils/logger.js';
import { OrchestratorConfig, OrchestratorState } from '../types.js';
import { config } from '../../../../config/index.js';
const logger = createLogger('summary-node');
const logger = createLogger('message-summary-node');

export const createSummaryNode = ({ orchestratorModel, prompts }: OrchestratorConfig) => {
export const createMessageSummaryNode = ({ orchestratorModel, prompts }: OrchestratorConfig) => {
const runNode = async (state: typeof OrchestratorState.State) => {
logger.info('Summary Node');
logger.info('MessageSummary Node');
logger.info('State size:', { size: state.messages.length });

if (state.messages.length > config.orchestratorConfig.MAX_QUEUE_SIZE) {
Expand All @@ -29,7 +29,6 @@ export const createSummaryNode = ({ orchestratorModel, prompts }: OrchestratorCo
newMessages,
});

logger.info('Formatted prompt:', { formattedPrompt });
const newSummary = await orchestratorModel.invoke(formattedPrompt);
logger.info('New Summary Result:', { newSummary });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const logger = createLogger('workflow-summary-node');
export const createWorkflowSummaryNode = ({ orchestratorModel }: OrchestratorConfig) => {
const runNode = async (state: typeof OrchestratorState.State) => {
logger.info('Workflow Summary Node');
logger.info('State size:', { size: state.messages.length });

const messages = state.messages
.map(msg => {
Expand Down
6 changes: 3 additions & 3 deletions src/agents/workflows/orchestrator/orchestratorWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ const handleConditionalEdge = async (
const createOrchestratorWorkflow = async (nodes: Awaited<ReturnType<typeof createNodes>>) => {
const workflow = new StateGraph(OrchestratorState)
.addNode('input', nodes.inputNode)
.addNode('summarize', nodes.summaryNode)
.addNode('messageSummary', nodes.messageSummaryNode)
.addNode('workflowSummary', nodes.workflowSummaryNode)
.addNode('tools', nodes.toolNode)
.addEdge(START, 'input')
.addConditionalEdges('input', handleConditionalEdge)
.addEdge('tools', 'summarize')
.addEdge('summarize', 'input')
.addEdge('tools', 'messageSummary')
.addEdge('messageSummary', 'input')
.addEdge('workflowSummary', END);

return workflow;
Expand Down

0 comments on commit d025941

Please sign in to comment.