Yongkang ZOU
commited on
Commit
·
3681af9
1
Parent(s):
664b67c
update llm tool
Browse files- .env +2 -0
- .gitignore +0 -0
- agent.py +7 -1
- requirements.txt +159 -3
.env
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GROQ_API_KEY = "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"
|
| 2 |
+
OPENAI_API_KEY = "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"
|
.gitignore
ADDED
|
File without changes
|
agent.py
CHANGED
|
@@ -79,9 +79,10 @@ sys_msg = SystemMessage(content=system_prompt)
|
|
| 79 |
|
| 80 |
# ------------------- GRAPH CONSTRUCTION -------------------
|
| 81 |
|
|
|
|
|
|
|
| 82 |
def build_graph(provider: str = "groq"):
|
| 83 |
"""Build the LangGraph with tool-use."""
|
| 84 |
-
# Select LLM provider
|
| 85 |
if provider == "google":
|
| 86 |
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
|
| 87 |
elif provider == "groq":
|
|
@@ -96,6 +97,11 @@ def build_graph(provider: str = "groq"):
|
|
| 96 |
temperature=0
|
| 97 |
)
|
| 98 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
else:
|
| 100 |
raise ValueError("Invalid provider")
|
| 101 |
|
|
|
|
| 79 |
|
| 80 |
# ------------------- GRAPH CONSTRUCTION -------------------
|
| 81 |
|
| 82 |
+
from langchain_openai import ChatOpenAI # ✅ 新增导入
|
| 83 |
+
|
| 84 |
def build_graph(provider: str = "groq"):
|
| 85 |
"""Build the LangGraph with tool-use."""
|
|
|
|
| 86 |
if provider == "google":
|
| 87 |
llm = ChatGoogleGenerativeAI(model="gemini-2.0-flash", temperature=0)
|
| 88 |
elif provider == "groq":
|
|
|
|
| 97 |
temperature=0
|
| 98 |
)
|
| 99 |
)
|
| 100 |
+
elif provider == "openai":
|
| 101 |
+
openai_key = os.getenv("OPENAI_API_KEY")
|
| 102 |
+
if not openai_key:
|
| 103 |
+
raise ValueError("OPENAI_API_KEY is not set.")
|
| 104 |
+
llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0, api_key=openai_key) # ✅ OpenAI GPT
|
| 105 |
else:
|
| 106 |
raise ValueError("Invalid provider")
|
| 107 |
|
requirements.txt
CHANGED
|
@@ -1,22 +1,81 @@
|
|
| 1 |
aiofiles==24.1.0
|
|
|
|
| 2 |
aiohttp==3.12.4
|
|
|
|
|
|
|
| 3 |
anyio==4.9.0
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
chromadb==1.0.11
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
fastapi==0.115.9
|
| 7 |
ffmpy==0.5.0
|
|
|
|
| 8 |
filetype==1.2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
gradio==5.31.0
|
| 10 |
gradio_client==1.10.1
|
|
|
|
| 11 |
groq==0.26.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
huggingface-hub==0.32.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
langchain==0.3.25
|
|
|
|
| 14 |
langchain-community==0.3.24
|
| 15 |
langchain-core==0.3.63
|
| 16 |
-
langchain-chroma==0.2.4
|
| 17 |
langchain-google-genai==2.1.5
|
| 18 |
langchain-groq==0.3.2
|
| 19 |
langchain-huggingface==0.2.0
|
|
|
|
| 20 |
langchain-tavily==0.2.0
|
| 21 |
langchain-text-splitters==0.3.8
|
| 22 |
langgraph==0.4.7
|
|
@@ -24,14 +83,111 @@ langgraph-checkpoint==2.0.26
|
|
| 24 |
langgraph-prebuilt==0.2.2
|
| 25 |
langgraph-sdk==0.1.70
|
| 26 |
langsmith==0.3.43
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
numpy==2.2.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
pandas==2.2.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
pydantic==2.11.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
python-dotenv==1.1.0
|
| 32 |
python-multipart==0.0.20
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
requests==2.32.3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
scikit-learn==1.6.1
|
|
|
|
|
|
|
| 35 |
sentence-transformers==4.1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
tqdm==4.67.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
uvicorn==0.34.2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
aiofiles==24.1.0
|
| 2 |
+
aiohappyeyeballs==2.6.1
|
| 3 |
aiohttp==3.12.4
|
| 4 |
+
aiosignal==1.3.2
|
| 5 |
+
annotated-types==0.7.0
|
| 6 |
anyio==4.9.0
|
| 7 |
+
appnope==0.1.4
|
| 8 |
+
asgiref==3.8.1
|
| 9 |
+
asttokens==3.0.0
|
| 10 |
+
attrs==25.3.0
|
| 11 |
+
audioop-lts==0.2.1
|
| 12 |
+
backoff==1.11.1
|
| 13 |
+
bcrypt==4.3.0
|
| 14 |
+
build==1.2.2.post1
|
| 15 |
+
cachetools==5.5.2
|
| 16 |
+
certifi==2025.4.26
|
| 17 |
+
charset-normalizer==3.4.2
|
| 18 |
chromadb==1.0.11
|
| 19 |
+
click==8.2.1
|
| 20 |
+
coloredlogs==15.0.1
|
| 21 |
+
comm==0.2.2
|
| 22 |
+
dataclasses-json==0.6.7
|
| 23 |
+
debugpy==1.8.14
|
| 24 |
+
decorator==5.2.1
|
| 25 |
+
Deprecated==1.2.18
|
| 26 |
+
distro==1.9.0
|
| 27 |
+
durationpy==0.10
|
| 28 |
+
executing==2.2.0
|
| 29 |
fastapi==0.115.9
|
| 30 |
ffmpy==0.5.0
|
| 31 |
+
filelock==3.18.0
|
| 32 |
filetype==1.2.0
|
| 33 |
+
flatbuffers==25.2.10
|
| 34 |
+
frozenlist==1.6.0
|
| 35 |
+
fsspec==2025.5.1
|
| 36 |
+
google-ai-generativelanguage==0.6.18
|
| 37 |
+
google-api-core==2.24.2
|
| 38 |
+
google-auth==2.40.2
|
| 39 |
+
googleapis-common-protos==1.70.0
|
| 40 |
gradio==5.31.0
|
| 41 |
gradio_client==1.10.1
|
| 42 |
+
groovy==0.1.2
|
| 43 |
groq==0.26.0
|
| 44 |
+
grpcio==1.73.0rc1
|
| 45 |
+
grpcio-status==1.73.0rc1
|
| 46 |
+
h11==0.16.0
|
| 47 |
+
hf-xet==1.1.2
|
| 48 |
+
httpcore==1.0.9
|
| 49 |
+
httptools==0.6.4
|
| 50 |
+
httpx==0.28.1
|
| 51 |
+
httpx-sse==0.4.0
|
| 52 |
huggingface-hub==0.32.3
|
| 53 |
+
humanfriendly==10.0
|
| 54 |
+
idna==3.10
|
| 55 |
+
importlib_metadata==8.6.1
|
| 56 |
+
importlib_resources==6.5.2
|
| 57 |
+
ipykernel==6.29.5
|
| 58 |
+
ipython==9.2.0
|
| 59 |
+
ipython_pygments_lexers==1.1.1
|
| 60 |
+
jedi==0.19.2
|
| 61 |
+
Jinja2==3.1.6
|
| 62 |
+
jiter==0.10.0
|
| 63 |
+
joblib==1.5.1
|
| 64 |
+
jsonpatch==1.33
|
| 65 |
+
jsonpointer==3.0.0
|
| 66 |
+
jsonschema==4.24.0
|
| 67 |
+
jsonschema-specifications==2025.4.1
|
| 68 |
+
jupyter_client==8.6.3
|
| 69 |
+
jupyter_core==5.8.1
|
| 70 |
+
kubernetes==32.0.1
|
| 71 |
langchain==0.3.25
|
| 72 |
+
langchain-chroma==0.2.4
|
| 73 |
langchain-community==0.3.24
|
| 74 |
langchain-core==0.3.63
|
|
|
|
| 75 |
langchain-google-genai==2.1.5
|
| 76 |
langchain-groq==0.3.2
|
| 77 |
langchain-huggingface==0.2.0
|
| 78 |
+
langchain-openai==0.3.18
|
| 79 |
langchain-tavily==0.2.0
|
| 80 |
langchain-text-splitters==0.3.8
|
| 81 |
langgraph==0.4.7
|
|
|
|
| 83 |
langgraph-prebuilt==0.2.2
|
| 84 |
langgraph-sdk==0.1.70
|
| 85 |
langsmith==0.3.43
|
| 86 |
+
markdown-it-py==3.0.0
|
| 87 |
+
MarkupSafe==3.0.2
|
| 88 |
+
marshmallow==3.26.1
|
| 89 |
+
matplotlib-inline==0.1.7
|
| 90 |
+
mdurl==0.1.2
|
| 91 |
+
mmh3==5.1.0
|
| 92 |
+
mpmath==1.3.0
|
| 93 |
+
multidict==6.4.4
|
| 94 |
+
mypy==1.16.0
|
| 95 |
+
mypy_extensions==1.1.0
|
| 96 |
+
nest-asyncio==1.6.0
|
| 97 |
+
networkx==3.5
|
| 98 |
numpy==2.2.6
|
| 99 |
+
oauthlib==3.2.2
|
| 100 |
+
onnxruntime==1.22.0
|
| 101 |
+
openai==1.82.1
|
| 102 |
+
opentelemetry-api==1.33.1
|
| 103 |
+
opentelemetry-exporter-otlp-proto-grpc==1.11.1
|
| 104 |
+
opentelemetry-instrumentation==0.54b1
|
| 105 |
+
opentelemetry-instrumentation-asgi==0.54b1
|
| 106 |
+
opentelemetry-instrumentation-fastapi==0.54b1
|
| 107 |
+
opentelemetry-proto==1.11.1
|
| 108 |
+
opentelemetry-sdk==1.33.1
|
| 109 |
+
opentelemetry-semantic-conventions==0.54b1
|
| 110 |
+
opentelemetry-util-http==0.54b1
|
| 111 |
+
orjson==3.10.18
|
| 112 |
+
ormsgpack==1.10.0
|
| 113 |
+
overrides==7.7.0
|
| 114 |
+
packaging==24.2
|
| 115 |
pandas==2.2.3
|
| 116 |
+
parso==0.8.4
|
| 117 |
+
pathspec==0.12.1
|
| 118 |
+
pexpect==4.9.0
|
| 119 |
+
pillow==11.2.1
|
| 120 |
+
platformdirs==4.3.8
|
| 121 |
+
posthog==4.2.0
|
| 122 |
+
prompt_toolkit==3.0.51
|
| 123 |
+
propcache==0.3.1
|
| 124 |
+
proto-plus==1.26.1
|
| 125 |
+
protobuf==6.31.1
|
| 126 |
+
psutil==7.0.0
|
| 127 |
+
ptyprocess==0.7.0
|
| 128 |
+
pure_eval==0.2.3
|
| 129 |
+
pyasn1==0.6.1
|
| 130 |
+
pyasn1_modules==0.4.2
|
| 131 |
pydantic==2.11.5
|
| 132 |
+
pydantic-settings==2.9.1
|
| 133 |
+
pydantic_core==2.33.2
|
| 134 |
+
pydub==0.25.1
|
| 135 |
+
Pygments==2.19.1
|
| 136 |
+
PyPika==0.48.9
|
| 137 |
+
pyproject_hooks==1.2.0
|
| 138 |
+
python-dateutil==2.9.0.post0
|
| 139 |
python-dotenv==1.1.0
|
| 140 |
python-multipart==0.0.20
|
| 141 |
+
pytz==2025.2
|
| 142 |
+
PyYAML==6.0.2
|
| 143 |
+
pyzmq==26.4.0
|
| 144 |
+
referencing==0.36.2
|
| 145 |
+
regex==2024.11.6
|
| 146 |
requests==2.32.3
|
| 147 |
+
requests-oauthlib==2.0.0
|
| 148 |
+
requests-toolbelt==1.0.0
|
| 149 |
+
rich==14.0.0
|
| 150 |
+
rpds-py==0.25.1
|
| 151 |
+
rsa==4.9.1
|
| 152 |
+
ruff==0.11.12
|
| 153 |
+
safehttpx==0.1.6
|
| 154 |
+
safetensors==0.5.3
|
| 155 |
scikit-learn==1.6.1
|
| 156 |
+
scipy==1.15.3
|
| 157 |
+
semantic-version==2.10.0
|
| 158 |
sentence-transformers==4.1.0
|
| 159 |
+
setuptools==80.9.0
|
| 160 |
+
shellingham==1.5.4
|
| 161 |
+
six==1.17.0
|
| 162 |
+
sniffio==1.3.1
|
| 163 |
+
SQLAlchemy==2.0.41
|
| 164 |
+
stack-data==0.6.3
|
| 165 |
+
starlette==0.45.3
|
| 166 |
+
sympy==1.14.0
|
| 167 |
+
tenacity==9.1.2
|
| 168 |
+
threadpoolctl==3.6.0
|
| 169 |
+
tiktoken==0.9.0
|
| 170 |
+
tokenizers==0.21.1
|
| 171 |
+
tomlkit==0.13.2
|
| 172 |
+
torch==2.7.0
|
| 173 |
+
tornado==6.5.1
|
| 174 |
tqdm==4.67.1
|
| 175 |
+
traitlets==5.14.3
|
| 176 |
+
transformers==4.52.4
|
| 177 |
+
typer==0.16.0
|
| 178 |
+
typing-inspect==0.9.0
|
| 179 |
+
typing-inspection==0.4.1
|
| 180 |
+
typing_extensions==4.13.2
|
| 181 |
+
tzdata==2025.2
|
| 182 |
+
urllib3==2.4.0
|
| 183 |
uvicorn==0.34.2
|
| 184 |
+
uvloop==0.21.0
|
| 185 |
+
watchfiles==1.0.5
|
| 186 |
+
wcwidth==0.2.13
|
| 187 |
+
websocket-client==1.8.0
|
| 188 |
+
websockets==15.0.1
|
| 189 |
+
wrapt==1.17.2
|
| 190 |
+
xxhash==3.5.0
|
| 191 |
+
yarl==1.20.0
|
| 192 |
+
zipp==3.22.0
|
| 193 |
+
zstandard==0.23.0
|