File tree Expand file tree Collapse file tree 1 file changed +2
-7
lines changed
libs/langchain/src/agents/middleware/tests Expand file tree Collapse file tree 1 file changed +2
-7
lines changed Original file line number Diff line number Diff line change 66 SystemMessage ,
77 ToolMessage ,
88} from "@langchain/core/messages" ;
9+
910import { summarizationMiddleware } from "../summarization.js" ;
1011import { countTokensApproximately } from "../utils.js" ;
1112import { createAgent } from "../../index.js" ;
@@ -367,13 +368,7 @@ describe("summarizationMiddleware", () => {
367368 } ) ;
368369
369370 it ( "can be created using a model string" , async ( ) => {
370- // Verify the mocked ChatAnthropic exists
371- const { ChatAnthropic } = await import ( "@langchain/anthropic" ) ;
372- expect ( ChatAnthropic ) . toBeDefined ( ) ;
373- expect ( typeof ChatAnthropic ) . toBe ( "function" ) ;
374-
375371 const model = "anthropic:claude-sonnet-4-20250514" ;
376-
377372 const middleware = summarizationMiddleware ( {
378373 model,
379374 maxTokensBeforeSummary : 100 ,
@@ -386,6 +381,6 @@ describe("summarizationMiddleware", () => {
386381 } ) ;
387382
388383 const result = await agent . invoke ( { messages : [ ] } ) ;
389- expect ( result . messages . length ) . toBeGreaterThan ( 0 ) ;
384+ expect ( result . messages . at ( - 1 ) ?. content ) . toBe ( "Mocked response" ) ;
390385 } ) ;
391386} ) ;
You can’t perform that action at this time.
0 commit comments