-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Langflow Python API delayed response #1287
Comments
🤖 Hello @sampratha28! 👋 Just a quick intro: I'm Dosu, a friendly bot here to offer some help while you're waiting for a human maintainer. From bug solving to answering questions, even helping you become a contributor, I'm at your service. 🤖 Don't worry, we'll figure out your issue together. 😉 Based on the information provided, it's difficult to pinpoint the exact cause of the delay you're experiencing when calling the langflow Python API through the Python requests module. However, I can suggest a few general areas to investigate:
As per the context provided, the Python API for langflow is structured using FastAPI's APIRouter with a base prefix of "/api/v1" and includes various routers. If the delay is happening on specific routes, you might want to investigate those routes in more detail. If you're still having trouble, it would be helpful if you could provide more information about the specific API calls you're making, the exact delays you're experiencing, and any other relevant details about your setup. This could help in identifying the cause of the delay. For more detailed analysis, you might want to consider using a tool like Postman to test your API calls and measure response times. This could help you identify if the delay is consistent across all API calls or specific to certain ones. I hope this helps! If you have any more questions or need further clarification, feel free to ask. -Dosu SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Hi @sampratha28 When you call the API the build process has to occur while in the UI you have to press the build button before starting the chat. The first message always builds the flow and then that session is cached so you can reuse it. |
I recommend using the API to specify a session ID to prevent the session from expiring. If not specified, calling the API by default initiates a new flow rather than continuing an existing session. This approach causes overhead each time the API is called, as it uses an external database to maintain conversation continuity but triggers a new agent executor process. |
@ogabrielluiz @yamonkjd thanks. This was helpful But for how long will the session be cached? Because after a certain time, i am getting ''Graph not found in the session' error. But it works the next time i hit the API with the same session id. |
I don't know if I'm judging correctly, but it seems that when there are more than two workers, the session may not be found properly in certain situations. |
That is correct when not using a cache like Redis. The session data is store in memory and can't be shared between the two processes. |
Hi, @sampratha28, I'm helping the langflow team manage their backlog and am marking this issue as stale. It looks like you're experiencing delayed response times with the Langflow Python API and seeking guidance on how to address this issue. There have been suggestions to investigate network latency, server load, API implementation, and client-side issues. Additionally, recommendations have been made to use a session ID to prevent the session from expiring and to consider using a cache like Redis to store session data. Further investigation is needed to determine if there is a timeout issue and to address potential issues with multiple workers. Could you please confirm if this issue is still relevant to the latest version of the langflow repository? If it is, please let the langflow team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you! |
Hello, @YamonBot |
Hi @sampratha28 We hope you're doing well. Just a friendly reminder that if we do not hear back from you within the next 3 days, we will close this issue. If you need more time or further assistance, please let us know. Thank you for your understanding! |
Thank you for your contribution! This issue will be closed. If you have any questions or encounter another problem, please open a new issue and we will be ready to assist you. |
I am callling the langflow python API through python requests module.
it is taking too long to respond compared to the time taken for response in the langflow UI.
How do i fix this
The text was updated successfully, but these errors were encountered: