tuan3335 commited on
Commit
ed71eea
·
1 Parent(s): 52370d5

Replace HuggingFace model with Groq free API to fix payment required error

Browse files
Files changed (1) hide show
  1. agent.py +9 -9
agent.py CHANGED
@@ -24,8 +24,8 @@ from langgraph.graph import StateGraph, END
24
  from langgraph.graph.message import add_messages
25
  from typing_extensions import TypedDict
26
 
27
- # HuggingFace imports
28
- from huggingface_hub import InferenceClient
29
 
30
  # Utils system imports
31
  from utils import (
@@ -68,20 +68,20 @@ class AgentState(TypedDict):
68
  # =============================================================================
69
 
70
  class LangChainQwen3Brain:
71
- """AI Brain using LangChain + Qwen3-8B"""
72
 
73
  def __init__(self):
74
- self.client = InferenceClient(
75
- provider="auto",
76
- api_key=os.environ.get("HF_TOKEN", "")
77
  )
78
- self.model_name = "Qwen/Qwen2.5-7B-Instruct"
79
 
80
  # Setup parsers
81
  self.json_parser = JsonOutputParser()
82
  self.str_parser = StrOutputParser()
83
 
84
- print("🧠 LangChain Qwen3 Brain initialized")
85
 
86
  def _invoke_model(self, messages: List[Dict[str, str]]) -> str:
87
  """Invoke model with messages"""
@@ -386,7 +386,7 @@ class LangGraphUtilsAgent:
386
  self.ai_brain = ai_brain
387
 
388
  print("🤖 LangGraph Utils Agent initialized!")
389
- print("🧠 AI Brain: Qwen3-8B with LangChain")
390
  print("🔧 Tools: YouTube, Image OCR, Audio Transcript, Wikipedia, File Reader, Text Processor")
391
  print("⚡ Features: AI-driven routing, Smart tool selection, Multimodal processing")
392
 
 
24
  from langgraph.graph.message import add_messages
25
  from typing_extensions import TypedDict
26
 
27
+ # Groq imports for free AI model
28
+ from groq import Groq
29
 
30
  # Utils system imports
31
  from utils import (
 
68
  # =============================================================================
69
 
70
  class LangChainQwen3Brain:
71
+ """AI Brain using LangChain + Groq free models"""
72
 
73
  def __init__(self):
74
+ # Use Groq instead of HuggingFace
75
+ self.client = Groq(
76
+ api_key=os.environ.get("GROQ_API_KEY", "")
77
  )
78
+ self.model_name = "llama3-8b-8192" # Free Groq model
79
 
80
  # Setup parsers
81
  self.json_parser = JsonOutputParser()
82
  self.str_parser = StrOutputParser()
83
 
84
+ print("🧠 LangChain Groq Brain initialized")
85
 
86
  def _invoke_model(self, messages: List[Dict[str, str]]) -> str:
87
  """Invoke model with messages"""
 
386
  self.ai_brain = ai_brain
387
 
388
  print("🤖 LangGraph Utils Agent initialized!")
389
+ print("🧠 AI Brain: Groq free models with LangChain")
390
  print("🔧 Tools: YouTube, Image OCR, Audio Transcript, Wikipedia, File Reader, Text Processor")
391
  print("⚡ Features: AI-driven routing, Smart tool selection, Multimodal processing")
392