Skip to content
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

issue with langflow 1.0.19 #4160

Closed
michelgirault opened this issue Oct 15, 2024 · 11 comments
Closed

issue with langflow 1.0.19 #4160

michelgirault opened this issue Oct 15, 2024 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@michelgirault
Copy link

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

Screenshot from 2024-10-15 19-18-52
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

  1. create an empty flow
  2. attach openai and setup the base url and api key
  3. 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

@michelgirault michelgirault added the bug Something isn't working label Oct 15, 2024
Copy link

dosubot bot commented Oct 15, 2024

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:

  1. Double-check that the API key is correctly entered and valid.
  2. Ensure that the Sequential Crew node is configured to use the correct API key and base URL.
  3. 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.

@michelgirault
Copy link
Author

as i said it was working in previous version with the exact setup and in other node i dont have any issue

@michelgirault michelgirault changed the title issue with langflow 1.19 issue with langflow 1.0.19 Oct 15, 2024
@phact
Copy link
Collaborator

phact commented Oct 15, 2024

seems to be related to this fix #4150

@phact
Copy link
Collaborator

phact commented Oct 15, 2024

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:
image

@michelgirault
Copy link
Author

thanks

@phact
Copy link
Collaborator

phact commented Oct 15, 2024

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

@michelgirault
Copy link
Author

Hi, thanks i think this is an issue with crewai and the memory component enabled,
crewAIInc/crewAI#447

@phact
Copy link
Collaborator

phact commented Oct 16, 2024

Yeah more specifically crewai's memory feature tries to use embeddings from openai and expects the api key to be set via env var.

@carlosrcoelho carlosrcoelho assigned erichare and unassigned phact Nov 27, 2024
@erichare
Copy link
Collaborator

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.

@michelgirault
Copy link
Author

i will check and get back to you, thanks for following up

@erichare
Copy link
Collaborator

Thanks @michelgirault !

@erichare erichare closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants