#Getting error while executing langchain agentExecutor

1 messages · Page 1 of 1 (latest)

craggy valve
#

error: {
message: "Invalid 'functions[23].name': string too long. Expected a string with maximum length 64, but got a string with length 69 instead.",
type: 'invalid_request_error',
param: 'functions[23].name',
code: 'string_above_max_length'
},
code: 'string_above_max_length',
param: 'functions[23].name',
type: 'invalid_request_error',
attemptNumber: 1,
retriesLeft: 6

import { LangchainToolSet } from "composio-core";
import { createOpenAIFunctionsAgent } from "langchain/agents";
import { AgentExecutor } from "langchain/agents";
import { pull } from "langchain/hub";
import WebSocket from 'ws';

export const executeRequest = async (appName: any, userPrompt: any) => {
    const toolset = new LangchainToolSet();
    const llm = new ChatOpenAI();
    const connection = await toolset.connectedAccounts.initiate({ appName: appName })
    console.log(`Open this URL to authenticate: ${connection.redirectUrl}`);
    const tools = await toolset.getTools({ apps: [appName] });
    const prompt = await pull(
        "hwchase17/openai-functions-agent"
    );
    const agent = await createOpenAIFunctionsAgent({
        llm,
        tools: tools,
        prompt: prompt as any,
    });
    const agentExecutor = new AgentExecutor({ agent, tools, verbose: true });
    const response = await agentExecutor.invoke({ input: userPrompt });
    console.log(response);
    return response;
}```, this is the code I am using from the docs
slender swiftBOT
#

Hey, This was a known issue as some of the tool ENUMS are longer than 64 characters. Team has identified this and planning to push on a fix for this but there is no definite ETA on when this will be fixed.

craggy valve
#

Okay, thanks, BTW it is working with claud models