Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -16,7 +16,7 @@ from langchain.chat_models import ChatHuggingFace
|
|
| 16 |
|
| 17 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 18 |
|
| 19 |
-
from langchain.llms import
|
| 20 |
#load_dotenv()
|
| 21 |
google_api_key = os.environ["GOOGLE_API_KEY"]
|
| 22 |
hf_api_key = os.environ["HF_TOKEN"]
|
|
@@ -108,13 +108,10 @@ def build_graph(provider: str = "huggingface"):
|
|
| 108 |
# Google Gemini
|
| 109 |
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0,api_key=google_api_key)
|
| 110 |
elif provider == "huggingface":
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
model_kwargs={"temperature": 0},
|
| 116 |
-
huggingfacehub_api_token=hf_api_key
|
| 117 |
-
),
|
| 118 |
)
|
| 119 |
def assistant(state: MessagesState):
|
| 120 |
""" Use the tools to answer the query. you have add,subtract,multiply,divide,web_search,wikipedia_search,arxiv_search tools."""
|
|
|
|
| 16 |
|
| 17 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 18 |
|
| 19 |
+
from langchain.llms import HuggingFaceHub
|
| 20 |
#load_dotenv()
|
| 21 |
google_api_key = os.environ["GOOGLE_API_KEY"]
|
| 22 |
hf_api_key = os.environ["HF_TOKEN"]
|
|
|
|
| 108 |
# Google Gemini
|
| 109 |
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0,api_key=google_api_key)
|
| 110 |
elif provider == "huggingface":
|
| 111 |
+
llm = HuggingFaceHub(
|
| 112 |
+
repo_id="meta-llama/Llama-2-7b-chat-hf",
|
| 113 |
+
huggingfacehub_api_token=hf_api_key,
|
| 114 |
+
model_kwargs={"temperature": 0}
|
|
|
|
|
|
|
|
|
|
| 115 |
)
|
| 116 |
def assistant(state: MessagesState):
|
| 117 |
""" Use the tools to answer the query. you have add,subtract,multiply,divide,web_search,wikipedia_search,arxiv_search tools."""
|