export const createAgentMethod = (llm: ChatOpenAI, tools: any[], prompt: ChatPromptTemplate): RunnableBinding<ChainValues, AgentExecutorOutput> => {
const agent = createToolCallingAgent({
llm,
tools,
prompt
});
return new AgentExecutor({
agent,
tools
}).withConfig({runName: 'Agent'});
};
When invoking an agent and creating streamEvents
, I want to enforce the use of tools. If tools are not used, issues arise in my service.
let eventStream = agent.streamEvents(
{
input: requestText
},
{version: 'v1'}
);
How can I ensure that the agent always uses the tools provided? Are there specific configurations or methods in Langchain to enforce this behavior?