《AIGC学习之 LangChain获取天气预报》

1、把https://colab.research.google.com/drive/1zTTPYk51WvPV8GqFRO18kDe60clKW8VV

拷贝到自己的 drive

2、先运行

3、然后下拉到最下面

API Chains - OpenMeteo - Weather information

can throw errors based on API return length

原理是用自然语言问 OpenMeteo API 关于某个地区的天气。

得到长沙的天气是22.9°,可以打开天气预报查看,也是差不多这个温度

 

下面代码可以继续提问,北京会不会下雨

chain_new.run('Is it raining in Beijing?')

 运行

 It is currently raining in Beijing, with a temperature of 22°C and a windspeed of 7 km/h.

遇到的 问题

 当提问长沙是否会下雨,就会出错。但是输入湖南就是正确的,暂时还不知道什么原因

chain_new.run('Is it raining in Hunan?')
 The response indicates that the location is in Hunan, and the current weather conditions include rain.

 可是问四川或者是成都都是正确的

 强烈给大家推荐一个公众号:Renee 创业随笔,每次都跟着大神姐姐的脚步一起学习。真的写的非常好也非常仔细,对小白和新手都很友好

猜你喜欢

转载自blog.csdn.net/qq_22576071/article/details/130573726