Update agent.py
Browse files
agent.py
CHANGED
|
@@ -6,7 +6,8 @@ from langchain_core.messages import HumanMessage, AIMessage
|
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 7 |
from langchain_core.runnables import Runnable
|
| 8 |
# from llama_index.core.agent.workflow import AgentWorkflow, ReActAgent
|
| 9 |
-
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
|
|
|
| 10 |
from tools import TOOLS
|
| 11 |
import pandas as pd
|
| 12 |
|
|
@@ -21,7 +22,11 @@ def build_graph():
|
|
| 21 |
# Initialize the LLM (e.g., Gemini Flash, zero temperature)
|
| 22 |
# llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash", temperature=0)
|
| 23 |
# llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
|
| 24 |
-
llm = HuggingFaceInferenceAPI(model_name="Qwen/Qwen2.5-Coder-32B-Instruct")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
llm_with_tools = llm.bind_tools(TOOLS)
|
| 26 |
|
| 27 |
# Step 1: Retriever node
|
|
|
|
| 6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 7 |
from langchain_core.runnables import Runnable
|
| 8 |
# from llama_index.core.agent.workflow import AgentWorkflow, ReActAgent
|
| 9 |
+
# from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
| 10 |
+
from langchain_huggingface import HuggingFaceEndpoint
|
| 11 |
from tools import TOOLS
|
| 12 |
import pandas as pd
|
| 13 |
|
|
|
|
| 22 |
# Initialize the LLM (e.g., Gemini Flash, zero temperature)
|
| 23 |
# llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash", temperature=0)
|
| 24 |
# llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
|
| 25 |
+
# llm = HuggingFaceInferenceAPI(model_name="Qwen/Qwen2.5-Coder-32B-Instruct")
|
| 26 |
+
llm = HuggingFaceEndpoint(
|
| 27 |
+
url="https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.1",
|
| 28 |
+
huggingfacehub_api_token=os.environ["HF_TOKEN"]
|
| 29 |
+
)
|
| 30 |
llm_with_tools = llm.bind_tools(TOOLS)
|
| 31 |
|
| 32 |
# Step 1: Retriever node
|