from langchain.agents import Tool,AgentType,initialize_agent from langchain.memory import ConversationBufferMemory from langchain_deepseek import ChatDeepSeek from ddgs import DDGS from dotenv import load_dotenv load_dotenv()
from langchain_community.utilities import GoogleSerperAPIWrapper from langchain.agents import AgentType, initialize_agent, Tool
from langchain_deepseek import ChatDeepSeek from dotenv import load_dotenv load_dotenv()
llm = ChatDeepSeek(model="deepseek-chat") search = GoogleSerperAPIWrapper() tools = [Tool( name="Intermediate Answer", # 必须是这个名字 func=search.run, description="useful for when you need to answer questions about current events", )]
from langchain_deepseek import ChatDeepSeek from langchain.agents import initialize_agent,AgentType from langchain.tools import StructuredTool from dotenv import load_dotenv load_dotenv() llm = ChatDeepSeek(model="deepseek-chat")
# 定义工具函数 defmultipliter(a:float, b:float) -> float: """将两个数字相乘,返回乘积"""# 这个注释是必须给的,用于描述工具函数的功能 return a * b tool = [StructuredTool.from_function(multipliter)]
from pydantic import BaseModel, Field, model_validator from langchain_deepseek import ChatDeepSeek from langchain_community.tools import RequestsGetTool from langchain_community.utilities.requests import TextRequestsWrapper from langchain.agents import initialize_agent, AgentType import tldextract from dotenv import load_dotenv from urllib.parse import urlparse
# Do you approve of the following input? Anything except 'Y'/'Yes' (case-insensitive) will be treated as a no. # y # Executing command: # pwd # /root/python-langchain