#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2025/3/16 16:38 # @Author : old-tom # @File : basic_tool # @Project : llmFunctionCallDemo # @Desc : import json from langchain_core.tools import tool @tool def get_current_weather(location: str, unit: str = "celsius") -> str: """Get the current weather in a given location Args: location (str): location of the weather. unit (str): unit of the tempuature. Returns: str: weather in the given location. """ weather_info = { "location": location, "temperature": "27", "unit": unit, "forecast": ["sunny", "windy"], } return json.dumps(weather_info)