langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
33.67k stars 4.08k forks source link

Suggest to upgrade astra-assistants client to 2.1.1 to fix OpenAI async functions #3840

Closed sa411022 closed 1 month ago

sa411022 commented 1 month ago

Bug Description

langflow backend has a dependency, astra-assistants client, which replaces the openai.AsyncOpenAI class by astra_assistants.AsyncOpenAIWithDefaultKey.

However, in astra-assistants client 2.1.0.26, the AsyncOpenAIWithDefaultKey has an incorrect inheritance, which causes OpenAI async functions such as ainvoke/astream to be not able to work correctly, as described in https://github.com/datastax/astra-assistants-api/issues/72.

This problem has been fix by astra-assistants client 2.1.1, so it is suggested to upgrade astra-assistants client to 2.1.1

Reproduction

With astra-assistants client 2.1.0.26, calling OpenAI ainvoke will produce the error below. TypeError: object ChatCompletion can't be used in 'await' expression

Expected behavior

Successfully execute OpenAI ainvoke without error.

Who can help?

No response

Operating System

Debian 12 (langflow-backend docker image)

Langflow Version

1.0.18

Python Version

3.12

Screenshot

No response

Flow File

No response

dosubot[bot] commented 1 month ago

@sa411022 Hello! I'm here to assist you with any bugs, questions, or contributions. Let's tackle this together!

Yes, upgrading the astra-assistants client to version 2.1.1 will fix the OpenAI async functions issue in the Langflow backend. The astra_assistants library is used in the AssistantsCreateAssistant class, and upgrading it should address the async functions issue [1].

To update the dependency, you should modify the pyproject.toml file to specify the new version:

astra-assistants = "^2.1.1"

This change will ensure that the correct version of the astra-assistants client is used, resolving the issue with OpenAI async functions [2].

To continue talking to Dosu, mention @dosu.

phact commented 1 month ago

fixed by https://github.com/langflow-ai/langflow/pull/3841