Closed LittleColin closed 1 year ago
Interesting, I am unable to reproduce this. Could you please tell me what version of langchain and OS you're running this on, and whether you're doing it from Jupyter or some other similar notebook?
Thanks!
Sure, so when I run this from the command line it is all fine but when run as part of a flask API, it gives the error described.
I am using Ubuntu, langchain 0.0.216
and flask 2.2.2
.
But I've actually realised I don't need the visualizer imported in this file at all. Instead, I now have a wrapper at a higher level that imports it specifically for command line use.
Previously I was doing this in a file that was being executed as part of the flask app and that was causing the problem:
import langchain_visualizer
# ... functions for my web app
if __name__ == "__main__":
langchain_visualizer.visualize(chat(sys.argv[1]))
Ahh interesting, thanks for letting me know! This doesn't yet support Flask out of the box, although I think others have gotten it to work :P
I use the visualiser for specific cases to debug flows but for usage of my API, I don't want the visualisation. However, simply importing the langchain_visualizer causes an error during
agent.run
(presumably because it's not wrapped invisualize
).