You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have trying to add a callback to my AgentExecutor with langserve but I got some errors. I have an already implemented route in my backend so I've added the parameter include_callback_events=True to this route :
class Input(BaseModel):
input: str
chat_history: List[Union[HumanMessage, AIMessage, FunctionMessage]]
class Output(BaseModel):
output: Any
# Create chat model from Azure AI
chatModel = AzureChatOpenAI(
openai_api_version="2023-07-01-preview",
azure_deployment="gpt-35-turbo_1106",
)
# Create agent with create_openai_tools_agent
tools = [myTool]
agent = create_openai_tools_agent(chatModel, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools)
add_routes(
app,
agent_executor.with_types(input_type=Input, output_type=Output),
path="/backend",
include_callback_events=True
)
I have a React client that calls this route thanks to the RemoteRunnable import :
Apologies don't use callbacks yet, callback code is still untested so I don't have confidence in it working.
For now work-around if you need token counting is to use astream_events and count tokens client side with tik-token. I'll address this at some point, but token counting is not high priority right now
Hello 馃憢
I have trying to add a callback to my AgentExecutor with langserve but I got some errors. I have an already implemented route in my backend so I've added the parameter
include_callback_events=True
to this route :I have a React client that calls this route thanks to the RemoteRunnable import :
And I have the following errors from langserve, (note that it happens also even without callback from client) :
It seems quite related to this ticket, but it doesn't have any fix : #283
Thanks a lot for your help !
The text was updated successfully, but these errors were encountered: