sunnysavita10 / RAG-With-Haystack-MistralAI-Pinecone

MIT License
6 stars 2 forks source link

ImportError: cannot import name 'HuggingFaceTGIGenerator' from 'haystack.components.generators' #3

Closed sahlebrahim closed 2 weeks ago

sahlebrahim commented 2 weeks ago

Describe the bug Attempting to import HuggingFaceTGIGenerator from haystack.components.generators results in an ImportError Error message ImportError: cannot import name 'HuggingFaceTGIGenerator' from 'haystack.components.generators'

Additional context this worked when i used an earlier version of haystack-ai(2.2.0) but now i need PineconeEmbeddingRetriever so i had to to revert to 2.3.0+ or else i got a filter policy module error To Reproduce Attempt to import HuggingFaceTGIGenerator from haystack.components.generators.

System: OS: Windows 11 Pro 23H2 GPU/CPU: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz Haystack version: 2.2.0 Transformers version: 4.43.2 Huggingface_hub version: 0.23.2 DocumentStore: Pinecone Retriever: PineconeEmbeddingRetriever

sahlebrahim commented 2 weeks ago

issue is resolved by using HuggingFaceAPIGenerator as HuggingFaceTGIGenerator is deprecated. just use HuggingFaceAPIGenerator(api_type="serverless_inference_api", api_params={"model": "mistralai/Mistral-7B-v0.1"}, token=Secret.from_env_var("HF_API_TOKEN"))