feat(agent): Add signal support for cancellation in agent workflows
This commit is contained in:
parent
765d084b44
commit
74c3934aa5
2 changed files with 4 additions and 1 deletions
|
|
@ -99,6 +99,7 @@ export class AgentSearch {
|
|||
const result = await workflow.invoke(initialState, {
|
||||
configurable: { thread_id: `agent_search_${Date.now()}` },
|
||||
recursionLimit: 20,
|
||||
signal: this.signal,
|
||||
});
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
|||
llm: BaseChatModel,
|
||||
systemInstructions: string,
|
||||
emitter: eventEmitter,
|
||||
signal: AbortSignal,
|
||||
) {
|
||||
(llm as unknown as ChatOpenAI).temperature = 0;
|
||||
|
||||
|
|
@ -238,7 +239,7 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
|||
</text>
|
||||
|
||||
Make sure to answer the query in the summary.
|
||||
`); //TODO: Pass signal for cancellation
|
||||
`, { signal });
|
||||
|
||||
const document = new Document({
|
||||
pageContent: res.content as string,
|
||||
|
|
@ -340,6 +341,7 @@ class MetaSearchAgent implements MetaSearchAgentType {
|
|||
llm,
|
||||
systemInstructions,
|
||||
emitter,
|
||||
signal,
|
||||
);
|
||||
var date = formatDateForLLM();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue