做网站盐城,珠海门户网站建设,哪些企业必须用网站,如何注册一个网站文章目录 关于 Metaphor使用示例 关于 Metaphor
Metaphor是基于大语言模型的搜索引擎#xff0c;允许用户使用完整的句子和自然语言搜索#xff0c;还可以模拟人们在互联网上分享和谈论链接的方式进行查询内容。 Metaphor同时还能与LLMs结合使用#xff0c;允许LLMs连接互联… 文章目录 关于 Metaphor使用示例 关于 Metaphor
Metaphor是基于大语言模型的搜索引擎允许用户使用完整的句子和自然语言搜索还可以模拟人们在互联网上分享和谈论链接的方式进行查询内容。 Metaphor同时还能与LLMs结合使用允许LLMs连接互联网查询自己知识库外部的内容。
官网https://exa.aigithub : https://github.com/NorthBit/Metaphor 相关教程
Metaphor改变搜索方式搜索引擎革命基于大语言模型的AI搜索引擎(1min) https://www.bilibili.com/video/BV1om4y1M7XM/ https://www.1aibox.com/sites/2222.htmlLLM之RAG实战二使用LlamaIndex Metaphor实现知识工作自动化 https://mp.weixin.qq.com/s/RsaqhgB9VmMtXDc5UW-1vQ 使用示例
安装环境
!pip install exa_py
!pip install langchain
!pip install llama_hub
!pip install llama_index api_key 为从官网 https://exa.ai 注册后个人的 key过去使用 MetaphorToolSpec后面改为使用 ExaToolSpec
from llama_hub.tools.exa.base import ExaToolSpec
metaphor_tool ExaToolSpec( api_keyxxx )metaphor_tool_list metaphor_tool.to_tool_list() for tool in metaphor_tool_list:print(tool.metadata.name)
search
retrieve_documents
search_and_retrieve_documents
search_and_retrieve_highlights
find_similar
current_date
metaphor_tool.search(machine learning transformers, num_results3)[Exa Tool] Autoprompt: Heres an insightful article on machine learning transformers:
[{title: On the potential of Transformers in Reinforcement Learning,url: https://lorenzopieri.com/rl_transformers/,id: snjxQqPfYVWKEmVXunkqhg},{title: How Transformers work in deep learning and NLP: an intuitive introduction | AI Summer,url: https://theaisummer.com/transformer/,id: kzGcf36vWzWeyL28Az1fNQ},{title: Transformers in Computer Vision: Farewell Convolutions!,url: https://towardsdatascience.com/transformers-in-computer-vision-farewell-convolutions-f083da6ef8ab?gia1d0a9a2896c,id: xF0V2oTHAfVmfS5UvJIFDA}]# 使用 Mataphor 设置 OpenAI Agentfrom llama_index.agent import OpenAIAgent
agent OpenAIAgent.from_tools(metaphor_tool_list,verboseTrue,
)# 直接查询
agent.chat(what are the best restaurants in torando?) from llama_index.tools.tool_spec.load_and_search.base import LoadAndSearchToolSpec# The search_and_retrieve_documents tool is the third in the tool list, as seen above
wrapped_retrieve LoadAndSearchToolSpec.from_defaults(metaphor_tool_list[2],
)# Just pass the wrapped tools and the get_date utility
agent OpenAIAgent.from_tools([*wrapped_retrieve.to_tool_list(), metaphor_tool_list[4]],verboseTrue,
)
agent.chat(Can you summarize everything published in the last month regarding news on superconductors) 伊织 2024-01-27六