Skip to main content

Hello everyone,

I would like to use the OpenAI library or Langchain library in Cognite Streamlit for implementing natural language data search and chat applications. We are using Azure OpenAI Services on our Azure tenant, but I understand that due to the mechanism of the Streamlit app running on Pyodide, we can essentially only use Pure Python packages because of certain constraints.

If there are any best practices regarding this, I would appreciate the guidance.

I recognize that one potential solution is to build our own wheel, but I suspect that this option may not be viable since Cognite Streamlit cannot store built wheel files.
https://py.cafe/docs/howto/build

For the OpenAI library, I found that it can be installed by downgrading to version 1.39.0, which I suspect is due to dependencies with jiter library, but I am looking for other (and for langchain) possible solutions.

Hi,

So there are some workarounds where you can install the package without the dependencies that fail. It is not a recommended, nor an easy way, but you might find that doable with enough effort. See https://github.com/cognitedata/python-ai/blob/main/cognite/ai/pandasai.py#L13 on how we have patched pandas_ai in a way that at least works in Pyodide.

Good luck, and reach out if you try and get stuck!


Hello ​@Anders Hafreager ,

Thank you for the reply. However I cannot access to the repository you have shared because it appears to be a Cognite’s private repository.

Could you please share some screenshots or guidelines for a workaround?

Best Regards,


Reply