Skip to content

Commit 3abc778

Browse files
committed
Pass only a subset of the agent
1 parent 19d3bf4 commit 3abc778

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/chat-handler.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
mergeMessageRuns,
2424
SystemMessage
2525
} from '@langchain/core/messages';
26-
import { CompiledStateGraph } from '@langchain/langgraph';
2726
import { UUID } from '@lumino/coreutils';
2827

2928
import { DEFAULT_CHAT_SYSTEM_PROMPT } from './default-prompts';
@@ -65,7 +64,7 @@ export class ChatHandler extends AbstractChatModel {
6564
});
6665
}
6766

68-
get agent(): CompiledStateGraph<any, any> | null {
67+
get agent(): AIChatModel | null {
6968
return this._providerRegistry.currentAgent;
7069
}
7170

@@ -216,7 +215,7 @@ export class ChatHandler extends AbstractChatModel {
216215
}
217216

218217
private async _sendAgentMessage(
219-
agent: CompiledStateGraph<any, any>,
218+
agent: AIChatModel,
220219
messages: BaseMessage[],
221220
sender: IUser
222221
): Promise<boolean> {

src/provider.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,14 @@ export class AIProviderRegistry implements IAIProviderRegistry {
159159
/**
160160
* Get the current agent.
161161
*/
162-
get currentAgent(): CompiledStateGraph<any, any> | null {
162+
get currentAgent(): AIChatModel | null {
163163
const agent = Private.getAgent();
164164
if (agent === null) {
165165
return null;
166166
}
167-
return agent;
167+
return {
168+
stream: (input: any, options?: any) => agent.stream(input, options)
169+
};
168170
}
169171

170172
/**

src/tokens.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { CompiledStateGraph } from '@langchain/langgraph';
21
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
32
import { ReadonlyPartialJSONObject, Token } from '@lumino/coreutils';
43
import { ISignal } from '@lumino/signaling';
@@ -103,7 +102,7 @@ export interface IAIProviderRegistry {
103102
/**
104103
* Get the current agent.
105104
*/
106-
readonly currentAgent: CompiledStateGraph<any, any> | null;
105+
readonly currentAgent: AIChatModel | null;
107106
/**
108107
* Getter/setter for the chat system prompt.
109108
*/

0 commit comments

Comments
 (0)