当前位置: 首页 > news >正文

Jupyter Notebook运行Milvus Lite

安装python和notebook
https://blog.csdn.net/Cosmoshhhyyy/article/details/153722910?spm=1001.2014.3001.5501
nodebook使用venv虚拟环境
https://blog.csdn.net/Cosmoshhhyyy/article/details/153724440?spm=1001.2014.3001.5501

pip3 install -U pymilvus

官网说下载了pymilvus就自带milvus-lite了,但是我这里还是报错缺少milvus-lite,下载一下。

pip3 install milvus_lite

运行官方demo:

from pymilvus import MilvusClient
import numpy as npclient = MilvusClient("./milvus_demo.db")
client.create_collection(collection_name="demo_collection",dimension=384  # The vectors we will use in this demo has 384 dimensions
)docs = ["Artificial intelligence was founded as an academic discipline in 1956.","Alan Turing was the first person to conduct substantial research in AI.","Born in Maida Vale, London, Turing was raised in southern England.",
]vectors = [[ np.random.uniform(-1, 1) for _ in range(384) ] for _ in range(len(docs)) ]
data = [ {"id": i, "vector": vectors[i], "text": docs[i], "subject": "history"} for i in range(len(vectors)) ]
res = client.insert(collection_name="demo_collection",data=data
)res = client.search(collection_name="demo_collection",data=[vectors[0]],filter="subject == 'history'",limit=2,output_fields=["text", "subject"],
)
print(res)res = client.query(collection_name="demo_collection",filter="subject == 'history'",output_fields=["text", "subject"],
)
print(res)res = client.delete(collection_name="demo_collection",filter="subject == 'history'",
)
print(res)

在这里插入图片描述

http://www.dtcms.com/a/516245.html

相关文章:

  • 双目测距实战5-立体矫正
  • 阿里云配置了加速器还是访问不了docker.io的解决方案。
  • 四川星星建设集团有限公司网站天津建设工程信息王
  • 网站创建人是网站下做二级域名
  • vivado综合报错,但没有明确报错信息
  • 深度解析 DeepSeek-OCR 的“光学压缩”革命
  • 贪心 --- 前篇
  • Android Studio新手开发第二十九天
  • STM32H743-ARM例程26-TCP_CLIENT
  • 上海先进网站建设公司凡科网站教程
  • 【ffmpeg】win11 python 使用ffmpeg 切割音频
  • macOS环境安装jupyter notebook(极简版)
  • 04_线性回归
  • 自然语言处理实战——基于策略迭代算法的餐厅预订对话系统
  • PHP双轨直销企业会员管理系统/购物直推系统/支持人脉网络分销系统源码
  • 拼接“音频片段”生成完整文件
  • 电影视频网站建设费用wordpress搜索增强
  • 营销型网站建设ppt模板wordpress碎语插件
  • 灵活用工平台如何助力中小企业降本增效:案例分析
  • 【题解】P2216 [HAOI2007] 理想的正方形 [单调队列]
  • UE基础操作2
  • Java IDEA学习之路:第五、六周课程笔记归纳
  • 亚马逊云代理商:怎么使用AWS WAF?
  • 茂名建设企业网站建网站为什么要租空间
  • SOAP 实例详解
  • 【C++】多态深度解析:虚函数表与动态绑定的奥秘
  • 腾讯云网站建设教程企业名录app
  • 重庆做网站有哪些医疗网站建设
  • 语音识别技术之科大讯飞在线API
  • 从案例到实践:仓颉编程语言入门核心知识点全解析