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

fix: resolve Model Issues and add huggingface dependency #2339

Merged
merged 3 commits into from
Jul 2, 2024

Conversation

berrytern
Copy link
Collaborator

@berrytern berrytern commented Jun 25, 2024

Fixes:

  • Add default values to Azure OpenAi mandotory component;
  • Add the model_id field (auto resolution was broken);
  • Add HuggingFace as an extra dependency;
    Refact:
  • Remove redundant attribution on children of LCModelComponent;

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 25, 2024
Copy link

vercel bot commented Jun 25, 2024

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

Name Status Preview Comments Updated (UTC)
langflow ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2024 6:52pm

@dosubot dosubot bot added bug Something isn't working enhancement New feature or request python Pull requests that update Python code labels Jun 25, 2024
Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

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

Hey @berrytern

Thanks for the PR. Please review the comments.

@@ -157,6 +148,8 @@ def build_model(self) -> LanguageModel:
f"Provider {self.provider} is not supported. Supported providers are: {', '.join(provider_map.keys())}"
)

os.environ["OPENAI_API_KEY"] = self.api_key
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't change the users environment.

replicate_api_key=api_keys["replicate_api_key"],
cohere_api_key=api_keys["cohere_api_key"],
openrouter_api_key=api_keys["openrouter_api_key"],
openai_api_key=self.api_key,
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this pass the same variable to all? I assume only one api key must be passed, otherwise it will try to run the wrong one.

@ogabrielluiz ogabrielluiz force-pushed the dev branch 2 times, most recently from 299eaa5 to 4365e3d Compare June 25, 2024 18:31
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jun 25, 2024

os.environ["OPENAI_API_KEY"] = self.api_key
api_keys: dict[str, Optional[str]] = {provider_map[self.provider]: self.api_key}
os.environ[self.provider.upper() + "_API_KEY"] = self.api_key
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't change the user's environment.

Copy link
Collaborator Author

@berrytern berrytern Jun 27, 2024

Choose a reason for hiding this comment

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

Sorry about that. I fixed it in my last commit.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 27, 2024
@ogabrielluiz ogabrielluiz disabled auto-merge June 27, 2024 17:34
@ogabrielluiz ogabrielluiz changed the base branch from dev to main July 1, 2024 18:39
Copy link
Contributor

autofix-ci bot commented Jul 1, 2024

Hi! I'm autofix logoautofix.ci, a bot that automatically fixes trivial issues such as code formatting in pull requests.

I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:

  1. Allow edits by maintainers for your pull request, and then re-trigger CI (for example by pushing a new commit).
  2. Manually fix the issues identified for your pull request (see the GitHub Actions output for details on what I would like to change).

@ogabrielluiz ogabrielluiz changed the title Resolve Model Issues and Add HuggingFace Dependency fix: resolve Model Issues and add huggingface dependency Jul 1, 2024
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) July 1, 2024 22:18
Copy link
Contributor

github-actions bot commented Jul 1, 2024

Cannot auto-update because of conflicts.

Copy link
Contributor

github-actions bot commented Jul 2, 2024

Cannot auto-update because of conflicts.

berrytern added 3 commits July 2, 2024 11:02
  - Change Huggingface-hub version from 0.20.0 to 0.22.0;
  - Internal model_id resolver not working, create a field to model_id;
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 2, 2024
@ogabrielluiz ogabrielluiz merged commit 805df82 into langflow-ai:main Jul 2, 2024
8 of 21 checks passed
nicoloboschi pushed a commit to datastax/ragstack-ai-langflow that referenced this pull request Jul 2, 2024
…#2339)

* chore: adding default values to Azure OpenAI mandatory component

* fix: huggingface model component:
  - Change Huggingface-hub version from 0.20.0 to 0.22.0;
  - Internal model_id resolver not working, create a field to model_id;

* feat: add HuggingFace as extra dependency

* chore: remove redundant atribution on children

* fix: remove user environment variables from ChatLiteLLMModelComponent

---------

Co-authored-by: joaoguilhermeS <[email protected]>
(cherry picked from commit 805df82)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request lgtm This PR has been approved by a maintainer python Pull requests that update Python code size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants