issue with langflow 1.0.19
Bug Description
the node agent: Sequential Crew does not recognize anymore my openai compatible llm (llama 3) in previous version i did not face this issue, i tried a few other agent, same error message, now if i use the node openai with other node, i dont have any problems
the error message:
Error building Component Sequential Crew: litellm.AuthenticationError: AuthenticationError: OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided: dummy. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Reproduction
- create an empty flow
- attach openai and setup the base url and api key
- add a node : Sequential Task Agent and Sequential Crew
Expected behavior
error message as provided with an issue about the api key used
Who can help?
No response
Operating System
ubuntu 22.04
Langflow Version
1.19
Python Version
3.10
Screenshot
No response
Flow File
No response
The error message you're encountering indicates that the Sequential Crew node is not recognizing the API key for your OpenAI-compatible LLM, resulting in an authentication error. This issue seems to be specific to the Sequential Crew node, as other nodes like the OpenAI node are working correctly with the same API key.
In Langflow 1.19, the Sequential Crew node retrieves and uses the API key by accepting it as a parameter in the build method of the OpenAIModelComponent class. The API key is passed as the openai_api_key argument and is wrapped in a SecretStr for security purposes. This key is then used to initialize the ChatOpenAI object, which interacts with the OpenAI API [1].
To troubleshoot this issue, you can:
- Double-check that the API key is correctly entered and valid.
- Ensure that the Sequential Crew node is configured to use the correct API key and base URL.
- Verify that there are no typos or formatting issues in the API key field.
If the problem persists, it might be worth checking if there are any recent changes or updates in the Langflow repository that could affect the authentication process for the Sequential Crew node.
To continue talking to Dosu, mention @dosu.
as i said it was working in previous version with the exact setup and in other node i dont have any issue
seems to be related to this fix https://github.com/langflow-ai/langflow/pull/4150
In the short term, adding OPENAI_API_KEY as an env variable (either in your terminal before starting langflow or using the dotenv component) should function as a workaround:
thanks
By the way I was able to reproduce this same scenario with langflow v1.0.18 and the sequential crew component with memory enabled.
The error message is the same except it says fake instead of dummy
Hi, thanks i think this is an issue with crewai and the memory component enabled, https://github.com/crewAIInc/crewAI/issues/447
Yeah more specifically crewai's memory feature tries to use embeddings from openai and expects the api key to be set via env var.
This should now be addressed in the latest main. Could you confirm @michelgirault ? The credentials of the agents are auto-detected - with the catch being that we don't necessarily have a FULLY general solution to figure out the embedding model credentials and how it is referenced when it is passed to the agent. So this has been tested with OpenAI and other common models, but there may be more to do to better support less commonly use models.
i will check and get back to you, thanks for following up
Thanks @michelgirault !