tavily - 简单使用

news/2024/10/18 16:50:47 标签: tavily

github :https://github.com/tavily-ai/tavily-python


安装

pip install tavily-python

获取 API Key

https://app.tavily.com/home


在这里插入图片描述


使用

from tavily import TavilyClient

TAVILY_API_KEY = 'tvly-3iO5Ek...3hbCNl'

# Step 1. Instantiating your TavilyClient
tavily_client = TavilyClient(api_key=TAVILY_API_KEY)

# Step 2. Executing a simple search query
response = tavily_client.search("Who is Leo Messi?")

# Step 3. That's it! You've done a Tavily Search!
print(response)

结果:

{
	'query': 'Who is Leo Messi?',
	'follow_up_questions': None,
	'answer': None,
	'images': [],
	'results': [{
		'title': '20 years of Messi: Ranking his seasons from worst to first',
		'url': 'https://www.espn.com/soccer/story/_/id/41809892/20-years-lionel-messi-ranking-barcelona-psg-inter-miami-legends-seasons-worst-first',
		'content': 'For 20 years, Lionel Messi has flourished from a young rising star to one of the greatest soccer players of all time. Illustration by ESPN 13. 2023-24 | Inter Miami',
		'score': 0.9492005,
		'raw_content': None
	}, {
		'title': "Lionel Messi | Biography, Barcelona, PSG, Ballon d'Or, Inter Miami ...",
		'url': 'https://www.britannica.com/biography/Lionel-Messi',
		'content': 'In early 2009 Messi capped ... course of the campaign, which resulted in his fifth world player of the year honour.',
		'score': 0.8749346,
		'raw_content': None
	}, {
		'title': 'Argentina 6-0 Bolivia: Lionel Messi scores hat-trick in World Cup ... - BBC',
		'url': 'https://www.bbc.com/sport/football/articles/c62re2n8qq7o',
		'content': 'Lionel Messi scored his 10th international hat-trick as Argentina thrashed Bolivia 6-0 in World Cup qualifying. The 37-year-old Inter Miami forward, who also set up two goals at Monumental Stadium',
		'score': 0.86373675,
		'raw_content': None
	}, {
		'title': "Lionel Messi: 'I Haven't Set a Goal' to Play in 2026 World Cup with ...",
		'url': 'https://bleacherreport.com/articles/10139842-lionel-messi-i-havent-set-a-goal-to-play-in-2026-world-cup-with-argentina',
		'content': 'The 37-year-old played a key role in the triumph over France in the final, winning 4-2 on penalties following a 3-3 draw. Messi scored twice and converted his penalty kick to help Argentina secure',
		'score': 0.8546422,
		'raw_content': None
	}, {
		'title': 'Lionel Messi - Wikipedia',
		'url': 'https://en.wikipedia.org/wiki/Lionel_Messi',
		'content': 'He scored ... at the Camp Nou.[164]',
		'score': 0.8143483,
		'raw_content': None
	}],
	'response_time': 2.1
}

2024-10-18(五)


http://www.niftyadmin.cn/n/5711420.html

相关文章

centors7升级GLIBC2.18

错误来源:找不到GLIBC2.18,因为glibc的版本是2.17 网上大多教程方法,反正我是行不通: 方法1:更新源,然后使用yum安装更新 方法2:下载源码,configrue,make执行 wget h…

宠物空气净化器选哪款?希喂、霍尼韦尔、安德迈真实测评!

自从家里养了猫,我的生活就多了不少乐趣,但也多了不少烦恼。最大的烦恼就是猫毛满天飞,弄得地板、衣服都是猫毛,甚至水杯里都能见到猫毛的踪迹。渐渐地,我的鼻子和喉咙都开始不舒服,医生给我开了先药&#…

银发产业动态:阿里、华为、京东健康、平安健康均有布局

整理 | 李梦媛 一周银发产业大事件速览 10月18日 星期五 养老服务 民政部发布《2023年度国家老龄事业发展公报》市场监管总局发布系列适老化国家标准扬州出台全国首部优待老年人地方性法规中信保诚人寿联合得到,共探养老综合解决方案饿了么携手北京西城&#xf…

Vue 组件 view-shadcn-ui 2024.1.1 发布

Vue 组件 view-shadcn-ui 2024.1.1 发布 View Shadcn UI 是一个基于 Shadcn UI 和 Tailwind CSS 构建的组件库。 推荐一套为 Java 开发人员提供方便易用的 SDK 来与目前提供服务的的 Open AI 进行交互组件:https://github.com/devlive-community/openai-java-sdk 推…

【数据分析】影响系数 =(今日量-昨日量)/(今日总量-昨日总量)

1. 影响系数 影响系数是一个用来衡量两个相关变量之间变化关系的指标。在给定的公式中: 今日量:指的是当前时间点的某个特定变量的值,比如今天某个商品的销售数量。昨日量:指的是前一个时间点(通常是前一天&#xff…

HTML(七)表格

https://chatgai.lovepor.cn/ 在HTML中&#xff0c;表格的标准形式如下&#xff1a; <table></table> 使用上面的语言&#xff0c;就已经生成了一个表格&#xff0c;只不过这个表格什么都没有 那么&#xff0c;该如何让表格存在东西呢&#xff1f; 首先&#xf…

RAID 矩阵

在架构设计中&#xff0c;RAID矩阵&#xff08;RAID Log&#xff09;是一个用于项目管理和风险管理的工具&#xff0c;帮助团队有效管理和跟踪项目中可能影响成功交付的关键因素。与存储技术中的 RAID 不同&#xff0c;这里的 RAID 是一个缩写&#xff0c;代表&#xff1a; R:…

什么是 SQL 命令?SQL 如何工作?

什么是 SQL 命令&#xff1f; SQL&#xff08;Structured Query Language&#xff0c;结构化查询语言&#xff09;是一种专门用于与关系型数据库通信的标准语言。SQL 通过特定的命令集与数据库系统进行交互&#xff0c;允许用户执行以下任务&#xff1a; 查询数据&#xff08…