安裝 requests-toolbelt
!pip install requests-toolbelt
demo
from requests_toolbelt import MultipartEncoder
import requests
m = MultipartEncoder(
fields={'query': """
第一,向量化匹配是有能力上限的。搜索引擎實(shí)現(xiàn)語義搜索已經(jīng)是好幾年的事情了,為什么一直無法上線,自然有他的匹配精確度瓶頸問題。
第二,本質(zhì)是匹配問題(即找到語義相似知識(shí)),NLP領(lǐng)域原本也有更優(yōu)美,更高效的方案,只是這波熱潮里,很多以前沒接觸過AI的朋友對(duì)之不熟悉罷了。
第三,甚至不用AI技術(shù),用精確MVSOL、用策略規(guī)則也是一種解法,其至是重要解法。舊AI時(shí)代的產(chǎn)品同學(xué)會(huì)非常熟悉這種“用規(guī)則/策略/產(chǎn)品設(shè)計(jì)”來彌補(bǔ)AI能力贏弱的問題一一現(xiàn)在是因?yàn)樾袠I(yè)早期,大家被LLM的能力錯(cuò)誤迷惑,并且以往產(chǎn)品經(jīng)理的聲音還沒發(fā)出來而已。
其次,在引入外部知識(shí)這個(gè)事情上,如果是特別專業(yè)的領(lǐng)域,純粹依賴向量、NLP、策略/規(guī)則在某些場(chǎng)景仍然不奏效。因?yàn)槟P褪紫刃枰莆漳莻€(gè)領(lǐng)域的專業(yè)知識(shí),才能在這樣一個(gè)基礎(chǔ)能力的加持下,用向量化等手段來便捷地解決外部知識(shí)引入問題。
當(dāng)在模型在基礎(chǔ)知識(shí)中缺乏、或有錯(cuò)誤地學(xué)習(xí)到某些背景知識(shí),即使他有外部知識(shí)庫加持也是無效的最后,不要管是不是90%會(huì)被解決,對(duì)于某個(gè)具體業(yè)務(wù)而言,沒有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官方網(wǎng)站地址
requests_toolbelt
Python自動(dòng)化 requests 庫:發(fā)送 form-data 格式的 http 請(qǐng)求
requests-toolbelt · PyPI文章來源地址http://www.zghlxwxcb.cn/news/detail-771802.html
文章來源:http://www.zghlxwxcb.cn/news/detail-771802.html
到了這里,關(guān)于requests 庫:發(fā)送 form-data 格式的 http 請(qǐng)求 (python)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!