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

LiteLLM Chat Model missing API key fix #27829

Closed

Conversation

DangerousPotential
Copy link
Contributor

Explicitly check for the API keys before using the utility function which should ideally fix the issue mentioned in #27826

Explicitly check for the API keys before using the utility function
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Nov 1, 2024
Copy link

vercel bot commented Nov 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Nov 1, 2024 5:04pm

@dosubot dosubot bot added community Related to langchain-community 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Nov 1, 2024
@@ -302,28 +302,28 @@ def validate_environment(cls, values: Dict) -> Dict:
"Please install it with `pip install litellm`"
)

values["openai_api_key"] = get_from_dict_or_env(
values["openai_api_key"] = values.get("openai_api_key") or get_from_dict_or_env(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_from_dict_or_env should be doing this:

if isinstance(key, str) and key in data and data[key]:
return data[key]

Could you write a unit test that fails with existing behavior and is fixed with your update, to demonstrate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature community Related to langchain-community size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants