Error with langchain integration
Closed this issue · 2 comments
I am having an error while trying to integrate Multion with langchain.
here is the code I am executing:
def multion_agent(input):
toolkit = MultionToolkit()
tools = toolkit.get_tools()
multion_api_key = os.getenv("MULTION_API_KEY")
multion.login(use_api=True, multion_api_key=multion_api_key)
agent = initialize_agent(
tools,
llm=model,
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
)
result = agent.run(input)
print(f"{result}")
multion_agent("What are top best restaruants in Ghana based on their ranks?")
The agent kicks off successfully and then there is an error:
$ python main.py
Logged in using API key.
> Entering new AgentExecutor chain...
Action:
{
"action": "create_multion_session",
"action_input": {
"url": "https://www.google.com/",
"query": "What are top best restaruants in Ghana based on their ranks?"
}
}
Request failed with status code: 405
Response text: {"detail":"Method Not Allowed"}
Request failed with status code: 405
Response text: {"detail":"Method Not Allowed"}
Request failed with status code: 405
Response text: {"detail":"Method Not Allowed"}
Request failed with status code: 405
Response text: {"detail":"Method Not Allowed"}
Traceback (most recent call last):
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain_community\tools\multion\create_session.py", line 61, in _run
response = multion.new_session({"input": query, "url": url})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\deprecated\classic.py", line 285, in wrapper_function
return wrapped_(*args_, **kwargs_)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\multion\multion.py", line 600, in new_session
return _multion_instance.new_session(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\multion\multion.py", line 358, in new_session
return self.post(url, data)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\multion\multion.py", line 289, in post
raise Exception("Failed to get a valid response after 5 attempts")
Exception: Failed to get a valid response after 5 attempts
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\main.py", line 15, in <module>
multion_agent("What are top best restaruants in Ghana based on their ranks?")
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\langchain_lab\lab.py", line 216, in multion_agent
result = agent.run(input)
^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain_core\_api\deprecation.py", line 145, in warning_emitting_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\chains\base.py", line 538, in run
return self(args[0], callbacks=callbacks, tags=tags, metadata=metadata)[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain_core\_api\deprecation.py", line 145, in warning_emitting_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\chains\base.py", line 363, in __call__
return self.invoke(
^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\chains\base.py", line 162, in invoke
raise e
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\chains\base.py", line 156, in invoke
self._call(inputs, run_manager=run_manager)
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\agents\agent.py", line 1329, in _call
next_step_output = self._take_next_step(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\agents\agent.py", line 1055, in _take_next_step
[
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\agents\agent.py", line 1055, in <listcomp>
[
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain\agents\agent.py", line 1151, in _iter_next_step
observation = tool.run(
^^^^^^^^^
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain_core\tools.py", line 401, in run
raise e
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain_core\tools.py", line 358, in run
self._run(*tool_args, run_manager=run_manager, **tool_kwargs)
File "C:\Users\ERASMUS\Documents\projects\inboxgenius\.venv\Lib\site-packages\langchain_community\tools\multion\create_session.py", line 67, in _run
raise Exception(f"An error occurred: {e}")
Exception: An error occurred: Failed to get a valid response after 5 attempts
@refugedesigns our langchain integration is currently outdated, and in our roadmap to be updated, please directly use our python or js sdk in the time being
@refugedesigns our langchain integration is currently outdated, and in our roadmap to be updated, please directly use our python or js sdk in the time being
I enjoy this project a lot. :) Thank you for making such a useful tool.
By the way, the link to LangChain Integration
page on the docs is currently a 404 page
URL: https://docs.multion.ai/INTEGRATIONS/langchain_examples