Skip to content

Conversation

@huzaifansari54
Copy link

Feature #19
Description
This pull request is add support for hugging face llms in lang chain

Dependencies
Updated pubspec.yaml to reflect new dependencies
Added a Huggingface_client

Testing
use an example for test the model

@huzaifansari54
Copy link
Author

huzaifansari54 commented Nov 12, 2024

documentation is left i am busy that why i cant add chat model as well let me know if there is any changes required

@davidmigloz
Copy link
Owner

Hey @huzaifansari54,

Thanks for your work!
I'll review it soon (can't promise when, I'm a bit busy at the moment)

@huzaifansari54
Copy link
Author

stream api is add for llms

@davidmigloz
Copy link
Owner

awesome, thanks! I'll try to start the review today

@davidmigloz davidmigloz self-requested a review November 21, 2024 12:39
@davidmigloz davidmigloz added t:enhancement New feature or request c:llms Models and integrations. p:langchain_huggingface langchain_huggingface package labels Nov 21, 2024
@hajajmaor
Copy link

hajajmaor commented Feb 12, 2025

Update on this PR? @huzaifansari54

@huzaifansari54
Copy link
Author

It is under review now

@hajajmaor
Copy link

Tried to use it to create agent, got error:

The argument type 'HuggingfaceInference' can't be assigned to the parameter type 'BaseChatModel'. dartargument_type_not_assignable

final llm = HuggingfaceInference.call(
      apiKey: Env.huggingFaceApiKey,
      model: modelName!,
    );
    final tools = [tool];
final agent = ToolsAgent.fromLLMAndTools(
      llm: llm,
      tools: tools,
    );

Hope to see this PR fixed and merged soon

@davidmigloz
Copy link
Owner

going back to this PR soon! sorry for the delay

@hajajmaor
Copy link

Hey, any updates?

@davidmigloz
Copy link
Owner

@gemini-cli /review

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

📋 Review Summary

This PR adds support for Hugging Face Inference API. The implementation looks good, but there are a few areas for improvement.

🔍 General Feedback

  • The main points are handling of nullable responses from the API client to avoid potential runtime errors.
  • Completing the copyWith method in HuggingFaceOptions.
  • Improving the example by not hardcoding the API key.

Overall, a good contribution that extends the functionality of LangChain.dart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c:llms Models and integrations. p:langchain_huggingface langchain_huggingface package t:enhancement New feature or request

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

3 participants