安装 requests-toolbelt
!pip install requests-toolbelt
demo
from requests_toolbelt import MultipartEncoder
import requests
m = 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文章来源地址https://www.toymoban.com/news/detail-771802.html
文章来源:https://www.toymoban.com/news/detail-771802.html
到了这里,关于requests 库:发送 form-data 格式的 http 请求 (python)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!