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
35.95k stars 4.25k forks source link

Bug in OpenAI Component Build fails sometimes without a clearly cause #4915

Open joaoguilhermeS opened 7 hours ago

joaoguilhermeS commented 7 hours ago

Bug Description

The bug happens when you try to run the OpenAI component with a temperature bigger then 1 and with the system prompt set, if you just the temperature value is bigger than 1 and do not set the system prompt, the component build without any problem (I have checked this behavior in both Langflow OpenSource and in LF Datastax).

The problem is that it is an unstable problem, sometimes it work even with these invalid parameters and other times it crashes, when you run the flow outside the playground the problem happens more often.

Reproduction

  1. Set a really simple Flow with a Chat Input, an OpenAI component and a Chat Output
  2. On the OpenAI component set a system prompt and a temperature higher than 1
  3. Run the Flow multiple times in playground and in the LF UI until you get a build error.

Expected behavior

The Langflow raises an error containing the error description properly instead of build forever.

Who can help?

No response

Operating System

MacOS Sonoma 14.4

Langflow Version

1.1.1 (opensource and datastax deployment) or 1.1

Python Version

3.12

Screenshot

image image

Flow File

Ex_openai_error.json

joaoguilhermeS commented 2 hours ago

Searching further, I found out that the allowed temperature range allowed is actually between 0-2, so probably the problem is not as directly related to that as I thought. But the problem still happening in an unstable way (not predictable).

It also seems not to be related to the system prompt.

italojohnny commented 2 hours ago

Debugging this, the last point in the Langflow code before it calls the Langchain code is here: https://github.com/langflow-ai/langflow/blob/79e3d3f50dc20c3ede4f5dcb34159f9c5d837ff0/src/backend/base/langflow/base/models/model.py#L190