Spaces:
Runtime error
Runtime error
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -1,32 +1,37 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
Abhängigkeiten (requirements.txt):
|
| 6 |
-
----------------------------------
|
| 7 |
-
langchain==0.1.*
|
| 8 |
-
langgraph
|
| 9 |
-
google-generativeai
|
| 10 |
-
tavily-python
|
| 11 |
-
wikipedia-api
|
| 12 |
-
pandas
|
| 13 |
-
openpyxl
|
| 14 |
-
tabulate
|
| 15 |
-
"""
|
| 16 |
-
|
| 17 |
-
import os, re, time, functools
|
| 18 |
from typing import Dict, Any, List
|
| 19 |
|
| 20 |
import pandas as pd
|
|
|
|
|
|
|
| 21 |
from langgraph.graph import StateGraph, START, END, MessagesState
|
| 22 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 23 |
|
| 24 |
-
|
| 25 |
from langchain_core.messages import SystemMessage, HumanMessage
|
| 26 |
from langchain_core.tools import tool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 28 |
from langchain_community.utilities.wikipedia import WikipediaAPIWrapper
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# ---------------------------------------------------------------------
|
| 32 |
# 0) Optionale LangSmith-Tracing (setze ENV: LANGCHAIN_API_KEY)
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import re
|
| 3 |
+
import time
|
| 4 |
+
import functools
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from typing import Dict, Any, List
|
| 6 |
|
| 7 |
import pandas as pd
|
| 8 |
+
|
| 9 |
+
# LangGraph
|
| 10 |
from langgraph.graph import StateGraph, START, END, MessagesState
|
| 11 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 12 |
|
| 13 |
+
# LangChain Core
|
| 14 |
from langchain_core.messages import SystemMessage, HumanMessage
|
| 15 |
from langchain_core.tools import tool
|
| 16 |
+
|
| 17 |
+
# Google Gemini
|
| 18 |
+
from langchain_google_genai import ChatGoogleGenerativeAI
|
| 19 |
+
|
| 20 |
+
# Tools
|
| 21 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 22 |
from langchain_community.utilities.wikipedia import WikipediaAPIWrapper
|
| 23 |
+
|
| 24 |
+
# Python REPL Tool
|
| 25 |
+
try:
|
| 26 |
+
from langchain_experimental.tools.python.tool import PythonAstREPLTool
|
| 27 |
+
except ImportError:
|
| 28 |
+
from langchain.tools.python.tool import PythonAstREPLTool
|
| 29 |
+
|
| 30 |
+
# Optional: LangSmith Tracing
|
| 31 |
+
try:
|
| 32 |
+
from langchain_community.tracing import configure_langsmith
|
| 33 |
+
except ImportError:
|
| 34 |
+
configure_langsmith = None
|
| 35 |
|
| 36 |
# ---------------------------------------------------------------------
|
| 37 |
# 0) Optionale LangSmith-Tracing (setze ENV: LANGCHAIN_API_KEY)
|