@@ -37,7 +37,7 @@ type testInstructionHandler struct {
3737 text string
3838}
3939
40- func (h * testInstructionHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
40+ func (h * testInstructionHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
4141 if runCtx .Instruction == "" {
4242 runCtx .Instruction = h .text
4343 } else if h .text != "" {
@@ -51,7 +51,7 @@ type testInstructionFuncHandler struct {
5151 fn func (ctx context.Context , instruction string ) (context.Context , string , error )
5252}
5353
54- func (h * testInstructionFuncHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
54+ func (h * testInstructionFuncHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
5555 newCtx , newInstruction , err := h .fn (ctx , runCtx .Instruction )
5656 if err != nil {
5757 return ctx , runCtx , err
@@ -65,7 +65,7 @@ type testToolsHandler struct {
6565 tools []tool.BaseTool
6666}
6767
68- func (h * testToolsHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
68+ func (h * testToolsHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
6969 runCtx .Tools = append (runCtx .Tools , h .tools ... )
7070 return ctx , runCtx , nil
7171}
@@ -75,7 +75,7 @@ type testToolsFuncHandler struct {
7575 fn func (ctx context.Context , tools []tool.BaseTool , returnDirectly map [string ]bool ) (context.Context , []tool.BaseTool , map [string ]bool , error )
7676}
7777
78- func (h * testToolsFuncHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
78+ func (h * testToolsFuncHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
7979 newCtx , newTools , newReturnDirectly , err := h .fn (ctx , runCtx .Tools , runCtx .ReturnDirectly )
8080 if err != nil {
8181 return ctx , runCtx , err
@@ -87,10 +87,10 @@ func (h *testToolsFuncHandler) BeforeAgent(ctx context.Context, runCtx *ChatMode
8787
8888type testBeforeAgentHandler struct {
8989 * BaseChatModelAgentMiddleware
90- fn func (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error )
90+ fn func (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error )
9191}
9292
93- func (h * testBeforeAgentHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
93+ func (h * testBeforeAgentHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
9494 return h .fn (ctx , runCtx )
9595}
9696
@@ -894,10 +894,10 @@ func TestContextPropagation(t *testing.T) {
894894 Description : "Test agent" ,
895895 Model : cm ,
896896 Handlers : []ChatModelAgentMiddleware {
897- & testBeforeAgentHandler {fn : func (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
897+ & testBeforeAgentHandler {fn : func (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
898898 return context .WithValue (ctx , key1 , "value1" ), runCtx , nil
899899 }},
900- & testBeforeAgentHandler {fn : func (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
900+ & testBeforeAgentHandler {fn : func (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
901901 handler2ReceivedValue = ctx .Value (key1 )
902902 return ctx , runCtx , nil
903903 }},
@@ -962,7 +962,7 @@ func TestHandlerErrorHandling(t *testing.T) {
962962 Description : "Test agent" ,
963963 Model : cm ,
964964 Handlers : []ChatModelAgentMiddleware {
965- & testBeforeAgentHandler {fn : func (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
965+ & testBeforeAgentHandler {fn : func (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
966966 return ctx , runCtx , assert .AnError
967967 }},
968968 },
@@ -1042,7 +1042,7 @@ type countingHandler struct {
10421042 mu sync.Mutex
10431043}
10441044
1045- func (h * countingHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext ) (context.Context , * ChatModelAgentContext , error ) {
1045+ func (h * countingHandler ) BeforeAgent (ctx context.Context , runCtx * ChatModelAgentContext [ * schema. Message ] ) (context.Context , * ChatModelAgentContext [ * schema. Message ] , error ) {
10461046 h .mu .Lock ()
10471047 h .beforeAgentCount ++
10481048 h .mu .Unlock ()
0 commit comments