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

requests 库:发送 form-data 格式的 http 请求 (python)

安装 requests-toolbelt

!pip install requests-toolbelt

demo

from requests_toolbelt import MultipartEncoder
import requestsm = MultipartEncoder(fields={'query': """第一,向量化匹配是有能力上限的。搜索引擎实现语义搜索已经是好几年的事情了,为什么一直无法上线,自然有他的匹配精确度瓶颈问题。第二,本质是匹配问题(即找到语义相似知识),NLP领域原本也有更优美,更高效的方案,只是这波热潮里,很多以前没接触过AI的朋友对之不熟悉罢了。第三,甚至不用AI技术,用精确MVSOL、用策略规则也是一种解法,其至是重要解法。旧AI时代的产品同学会非常熟悉这种“用规则/策略/产品设计”来弥补AI能力赢弱的问题一一现在是因为行业早期,大家被LLM的能力错误迷惑,并且以往产品经理的声音还没发出来而已。其次,在引入外部知识这个事情上,如果是特别专业的领域,纯粹依赖向量、NLP、策略/规则在某些场景仍然不奏效。因为模型首先需要掌握那个领域的专业知识,才能在这样一个基础能力的加持下,用向量化等手段来便捷地解决外部知识引入问题。当在模型在基础知识中缺乏、或有错误地学习到某些背景知识,即使他有外部知识库加持也是无效的最后,不要管是不是90%会被解决,对于某个具体业务而言,没有90%,只有100%0%"""})r = requests.post('http://*.*.*.*:8788/translate_zh2en',data=m,headers={'Content-Type': m.content_type})
print(r.text)

response

{"code":10000,
"res":"First, vectorized matching has an upper limit of capability. Implementing semantic search in search engines has been a thing for several years, but why has it not been launched? There naturally exists a bottleneck issue with its matching accuracy.\n\nSecond, the essence is a matching problem (i.e., finding semantically similar knowledge). The NLP field originally had more elegant and efficient solutions, but in this wave of enthusiasm, many friends who had not previously been exposed to AI are simply unfamiliar with it.\n\nThird, even without AI technology, using precise MVSOL or strategic rules is also a solution, and it is an important solution at that. Product colleagues from the old AI era are very familiar with using \"rules/strategies/product design\" to compensate for the weak capabilities of AI. The reason it is not being used now is because the industry is still in its early stages, and everyone has been misled by the capabilities of LLM, and the voices of past product managers have not yet been heard.\n\nFurthermore, when it comes to introducing external knowledge, if it is in a particularly specialized field, purely relying on vectors, NLP, and strategies/rules may still not be effective in certain scenarios. This is because the model first needs to master the specialized knowledge of that field in order to conveniently solve the problem of introducing external knowledge using methods such as vectorization.\n\nWhen the model lacks basic knowledge or has learned certain background knowledge incorrectly, even with the support of an external knowledge base, it will be ineffective in the end. Regardless of whether it can solve 90% of the cases, for a specific business, there is no 90%, only 100% and 0%.",
"time_cost":13.629586219787598}

参考

requests官方网站地址
requests_toolbelt
Python自动化 requests 库:发送 form-data 格式的 http 请求
requests-toolbelt · PyPI

http://www.lryc.cn/news/154967.html

相关文章:

  • 行测图形推理规律(一)元素组成
  • 【python爬虫】13.吃什么不会胖(爬虫实操练习)
  • 深入理解联邦学习——联邦学习与现有理论的区别与联系
  • 基于Python+DenseNet121算法模型实现一个图像分类识别系统案例
  • 旋转图片两种方法
  • 10 mysql tiny/small/medium/big int 的数据存储
  • UI自动化测试之Jenkins配置
  • 电视盒子什么品牌好?数码博主盘点目前性能最好的电视盒子
  • 对于枚举类型的输出
  • solidity开发环境配置,vscode搭配remix
  • chatGPT生成代码--go组合算法
  • 推荐6款普通人搞副业做自媒体AI工具
  • vs中git提交合并分支的步骤记录
  • PostgreSQL 备份恢复:pg_probackup
  • 博客程序系统其它功能扩充
  • MATLAB 2023安装方法之删除旧版本MATLAB,安装新版本MATLAB
  • 全国唯一一所初试考Java的学校!平均300分拿下
  • day35 | 860.柠檬水找零、406.根据身高重建队列、452. 用最少数量的箭引爆气球
  • ffmpeg批量转码
  • 时序预测 | MATLAB实现基于QPSO-BiLSTM、PSO-BiLSTM和BiLSTM时间序列预测
  • 【TypeScript学习】—基本类型(二)
  • uni-app点击复制指定内容(点击复制)
  • 无涯教程-Flutter - 简介
  • 【STM32】学习笔记-时间戳RTC
  • 绿色能源迎来跨越式增长新时代
  • 【算法】函数渐近的界基础知识及定理
  • stable diffusion实践操作-writing
  • idea查找maven所有依赖
  • 【业务功能篇97】微服务-springcloud-springboot-电商购物车模块-获取当前登录用户的购物车信息
  • Shell常用的几个正则表达式:[:alnum:], [:alpha:], [:upper:], [:lower:], [:digit:] 认知