Python vs JavaScript/Typescript implementations of LC, differences?

Javascript is is not covered in any shortcourse. how are Python and JS/TS implementations of the Langchain libs different? Do I have to be a Typescript expert to get along to use JS&TS version?

There’s not much difference between the Python and the JS version. Python is widely used in Machine Learning development so it’s easier for you to implement it with other libraries. The Javascript version is just more convenient for you to deploy them on a web app or to build an API. You don’t have to be an expert on Typescript to get along with the JS version, plus, some AI models are still more stable with Python.

Thanks . I wonder if JavaScript has better support for asynchronous operations in LC, in the sense that newer versions of the JS language have keywords async / await built in. The codesamples in the JS documentation do include these constructs, see for example JS DocRetriever.
I know Python also has these keywords, but the Python notebooks in the shortcourse do not use async/await.
Async seems useful to build bigger things. Did course designers omit aync/await from Notebooks to keep things simple? Do LangChain LIbs use async/await internally?

If you’re using Python in Collab Notebook, there’s no async/await in there. Python is a synchronous program which means it only executes one step at a time. Yes, the course wants to keep it simple since it’s best to start out with a simple model or web interface, you can deploy a notebook on a serverless site like Streamlit or Netify if you want to publish your model. If you want to implement LangChain into a fully functional web app (i.e. e-commerce, business service, etc.), then you can use LangChainJs. There are two versions of LangChain, the Python version, and the JavaScript version.

If you’re not a software developer or engineer and just want to start out with AI, I suggest trying the Python model first and trying to deploy it successfully. When you want to incorporate this in a more complex website, then it’s easier to use the JavaScript model.

Hope it helps

1 Like