to the package langchain/embeddings in langchain:API Initialization‚ÄãTo use the LLM services based on Baidu Qianfan, you have to initialize these parameters:You could either choose to init the AK,SK in environment variables or init params:export QIANFAN_AK=XXXexport QIANFAN_SK=XXX"""For basic init and call"""from langchain.embeddings import QianfanEmbeddingsEndpoint import osos.environ["QIANFAN_AK"] = "your_ak"os.environ["QIANFAN_SK"] = "your_sk"embed = QianfanEmbeddingsEndpoint(    # qianfan_ak='xxx',     # qianfan_sk='xxx')res = embed.embed_documents(["hi", "world"])async def aioEmbed():    res = await embed.aembed_query("qianfan")    print(res[:8])await aioEmbed()import asyncioasync def aioEmbedDocs():    res = await embed.aembed_documents(["hi", "world"])    for r in res:        print("", r[:8])await aioEmbedDocs()    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: trying to refresh access_token    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: sucessfully refresh access_token    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: requesting llm api endpoint: /embeddings/embedding-v1    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: async requesting llm api endpoint: /embeddings/embedding-v1    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: async requesting llm api endpoint: /embeddings/embedding-v1    [-0.03313107788562775, 0.052325375378131866, 0.04951248690485954, 0.0077608139254152775, -0.05907672271132469, -0.010798933915793896, 0.03741293027997017, 0.013969100080430508]     [0.0427522286772728, -0.030367236584424973, -0.14847028255462646, 0.055074431002140045, -0.04177454113960266, -0.059512972831726074, -0.043774791061878204, 0.0028191760648041964]     [0.03803155943751335, -0.013231384567916393, 0.0032379645854234695, 0.015074018388986588, -0.006529552862048149, -0.13813287019729614, 0.03297128155827522, 0.044519297778606415]Use different models in Qianfan‚ÄãIn the case you want to deploy your own
Baidu AI Cloud Qianfan Platform is a one-stop large model development and service operation platform for enterprise developers. Qianfan not only provides including the model of Wenxin Yiyan (ERNIE-Bot) and the third-party open-source models, but also provides various AI development tools and the whole set of development environment, which facilitates customers to use and develop large model applications easily.
Baidu AI Cloud Qianfan Platform is a one-stop large model development and service operation platform for enterprise developers. Qianfan not only provides including the model of Wenxin Yiyan (ERNIE-Bot) and the third-party open-source models, but also provides various AI development tools and the whole set of development environment, which facilitates customers to use and develop large model applications easily. ->: to the package langchain/embeddings in langchain:API Initialization‚ÄãTo use the LLM services based on Baidu Qianfan, you have to initialize these parameters:You could either choose to init the AK,SK in environment variables or init params:export QIANFAN_AK=XXXexport QIANFAN_SK=XXX"""For basic init and call"""from langchain.embeddings import QianfanEmbeddingsEndpoint import osos.environ["QIANFAN_AK"] = "your_ak"os.environ["QIANFAN_SK"] = "your_sk"embed = QianfanEmbeddingsEndpoint(    # qianfan_ak='xxx',     # qianfan_sk='xxx')res = embed.embed_documents(["hi", "world"])async def aioEmbed():    res = await embed.aembed_query("qianfan")    print(res[:8])await aioEmbed()import asyncioasync def aioEmbedDocs():    res = await embed.aembed_documents(["hi", "world"])    for r in res:        print("", r[:8])await aioEmbedDocs()    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: trying to refresh access_token    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: sucessfully refresh access_token    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: requesting llm api endpoint: /embeddings/embedding-v1    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: async requesting llm api endpoint: /embeddings/embedding-v1    [INFO] [09-15 20:01:35] logging.py:55 [t:140292313159488]: async requesting llm api endpoint: /embeddings/embedding-v1    [-0.03313107788562775, 0.052325375378131866, 0.04951248690485954, 0.0077608139254152775, -0.05907672271132469, -0.010798933915793896, 0.03741293027997017, 0.013969100080430508]     [0.0427522286772728, -0.030367236584424973, -0.14847028255462646, 0.055074431002140045, -0.04177454113960266, -0.059512972831726074, -0.043774791061878204, 0.0028191760648041964]     [0.03803155943751335, -0.013231384567916393, 0.0032379645854234695, 0.015074018388986588, -0.006529552862048149, -0.13813287019729614, 0.03297128155827522, 0.044519297778606415]Use different models in Qianfan‚ÄãIn the case you want to deploy your own