Marqo是一个端到端的向量搜索引擎,专为文本和图像搜索而设计。它通过单一API提供向量生成、存储和检索的全套功能,无需用户自行提供嵌入向量。Marqo的目标是让开发者能够以最小的努力将向量搜索集成到应用程序中。

传统的向量数据库仅提供向量相似度计算,而完整的向量搜索系统还需要机器学习模型部署和管理、输入预处理和转换,以及在不重新训练模型的情况下修改搜索行为的能力。Marqo将这些组件整合在一起,为开发者提供了一个完整的解决方案。
Marqo支持使用最新的机器学习模型,包括:
用户可以选择预配置的模型,也可以使用自定义模型。Marqo同时支持CPU和GPU推理。
Marqo采用"文档输入-文档输出"的设计理念,自动处理:
这使得开发者可以专注于应用逻辑,而不必关心底层的向量处理细节。
Marqo还提供托管的云服务,具有以下特点:
要开始使用Marqo,只需几个简单步骤:
安装Docker并确保至少分配8GB内存和50GB存储空间。
使用Docker运行Marqo:
docker rm -f marqo docker pull marqoai/marqo:latest docker run --name marqo -it -p 8882:8882 marqoai/marqo:latest
pip install marqo
import marqo mq = marqo.Client(url='http://localhost:8882') mq.create_index("my-first-index", model="hf/e5-base-v2") mq.index("my-first-index").add_documents([ { "Title": "The Travels of Marco Polo", "Description": "A 13th-century travelogue describing Polo's travels" }, { "Title": "Extravehicular Mobility Unit (EMU)", "Description": "The EMU is a spacesuit that provides environmental protection, " "mobility, life support, and communications for astronauts", "_id": "article_591" }], tensor_fields=["Description"] ) results = mq.index("my-first-index").search( q="What is the best outfit to wear on the moon?" )
这个简单的示例展示了如何创建索引、添加文档和执行搜索查询。Marqo会自动处理文本嵌入和向量搜索,返回最相关的结果。
Marqo支持图像和文本的联合搜索。使用CLIP模型,可以轻松实现图文混合检索:
settings = { "treat_urls_and_pointers_as_images":True, "model":"ViT-L/14" } mq.create_index("my-multimodal-index", **settings) mq.index("my-multimodal-index").add_documents([{ "My_Image": "https://example.com/image.jpg", "Description": "A beautiful landscape", "_id": "image-1" }], tensor_fields=["My_Image"]) results = mq.index("my-multimodal-index").search('nature scene')
Marqo允许对查询组件进行加权,实现更精细的搜索控制:
query = { "I need a communication device": 1.1, "It should be modern and smart": 1.0, } results = mq.index("my-index").search(q=query)
Marqo支持将文本和图像组合成单一字段,实现更高效的存储和检索:
mq.index("multimodal-index").add_documents( [ { "Title": "Flying Plane", "caption": "An image of a passenger plane flying in front of the moon.", "image": "https://example.com/plane.jpg", } ], mappings={ "captioned_image": { "type": "multimodal_combination", "weights": { "caption": 0.3, "image": 0.7 } } }, tensor_fields=["captioned_image"] )
Marqo与多个流行的AI和数据处理框架集成,包括:
这些集成使得Marqo可以轻松融入各种AI驱动的应用场景。
Marqo在多个领域都有广泛应用:
Marqo作为一个强大的端到端向量搜索引擎,为开发者提供了一个全面的解决方案,简化了AI驱动搜索应用的开发过程。通过集成向量生成、存储和检索功能,Marqo使得构建高性能、多模态的搜索系统变得前所未有的简单。
无论是处理文本、图像还是多模态数据,Marqo都能提供卓越的性能和灵活性。随着AI技术的不断发展,Marqo将继续扮演重要角色,助力开发者构建下一代智能搜索应用。
如果您正在寻找一个强大、易用且功能丰富的向量搜索解决方案,Marqo无疑是一个值得考虑的选择。立即开始使用Marqo,探索AI驱动搜索的无限可能性!
