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

“In terms of functionality, there is no significant difference between the two, but I highly recommend using the TS version. Langchain’s modules have undergone significant integration from version 0.1 to 0.2. If you are developing in VSCode, the type hints and automatic imports available with TS are far superior to the module management and indexing in Python, which is quite disastrous. Moreover, a lot of the documentation available online does not clearly distinguish between versions 0.1 and 0.2. If you are just starting to learn, just differentiating between the import methods of the two versions and testing their effects can be very painful. These issues do not exist in the TS version.”