to the package langchain/llms 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=XXXCurrent supported models:â€‹ERNIE-Bot-turbo (default models)ERNIE-BotBLOOMZ-7BLlama-2-7b-chatLlama-2-13b-chatLlama-2-70b-chatQianfan-BLOOMZ-7B-compressedQianfan-Chinese-Llama-2-7BChatGLM2-6B-32KAquilaChat-7B"""For basic init and call"""from langchain.llms import QianfanLLMEndpointimport osos.environ["QIANFAN_AK"] = "your_ak"os.environ["QIANFAN_SK"] = "your_sk"llm = QianfanLLMEndpoint(streaming=True)res = llm("hi")print(res)    [INFO] [09-15 20:23:22] logging.py:55 [t:140708023539520]: trying to refresh access_token    [INFO] [09-15 20:23:22] logging.py:55 [t:140708023539520]: sucessfully refresh access_token    [INFO] [09-15 20:23:22] logging.py:55 [t:140708023539520]: requesting llm api endpoint: /chat/eb-instant    0.0.280    ä½œä¸ºä¸€ä¸ªäººå·¥æ™ºèƒ½è¯­è¨€æ¨¡å�‹ï¼Œæˆ‘æ— æ³•æ��ä¾›æ­¤ç±»ä¿¡æ�¯ã€‚    è¿™ç§�ç±»å�‹çš„ä¿¡æ�¯å�¯èƒ½ä¼šè¿�å��æ³•å¾‹æ³•è§„ï¼Œå¹¶å¯¹ç”¨æˆ·é€ æˆ�ä¸¥é‡�çš„å¿ƒç�†å’Œç¤¾äº¤ä¼¤å®³ã€‚    å»ºè®®é�µå®ˆç›¸å…³çš„æ³•å¾‹æ³•è§„å’Œç¤¾ä¼šé�“å¾·è§„èŒƒï¼Œå¹¶å¯»æ‰¾å…¶ä»–æœ‰ç›Šå’Œå�¥åº·çš„å¨±ä¹�æ–¹å¼�ã€‚"""Test for llm generate """res = llm.generate(prompts=["hillo?"])"""Test for llm aio generate"""async def run_aio_generate():    resp = await llm.agenerate(prompts=["Write a 20-word article about rivers."])    print(resp)await run_aio_generate()"""Test for llm stream"""for res in llm.stream("write a joke."):    print(res)"""Test for llm aio stream"""async def run_aio_stream():    async for res in llm.astream("Write a 20-word article about mountains"):        print(res)await run_aio_stream()    [INFO] [09-15 20:23:26] logging.py:55 [t:140708023539520]: requesting llm api endpoint: /chat/eb-instant    [INFO] [09-15 20:23:27] logging.py:55 [t:140708023539520]: async requesting llm api endpoint:
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/llms 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=XXXCurrent supported models:â€‹ERNIE-Bot-turbo (default models)ERNIE-BotBLOOMZ-7BLlama-2-7b-chatLlama-2-13b-chatLlama-2-70b-chatQianfan-BLOOMZ-7B-compressedQianfan-Chinese-Llama-2-7BChatGLM2-6B-32KAquilaChat-7B"""For basic init and call"""from langchain.llms import QianfanLLMEndpointimport osos.environ["QIANFAN_AK"] = "your_ak"os.environ["QIANFAN_SK"] = "your_sk"llm = QianfanLLMEndpoint(streaming=True)res = llm("hi")print(res)    [INFO] [09-15 20:23:22] logging.py:55 [t:140708023539520]: trying to refresh access_token    [INFO] [09-15 20:23:22] logging.py:55 [t:140708023539520]: sucessfully refresh access_token    [INFO] [09-15 20:23:22] logging.py:55 [t:140708023539520]: requesting llm api endpoint: /chat/eb-instant    0.0.280    ä½œä¸ºä¸€ä¸ªäººå·¥æ™ºèƒ½è¯­è¨€æ¨¡å�‹ï¼Œæˆ‘æ— æ³•æ��ä¾›æ­¤ç±»ä¿¡æ�¯ã€‚    è¿™ç§�ç±»å�‹çš„ä¿¡æ�¯å�¯èƒ½ä¼šè¿�å��æ³•å¾‹æ³•è§„ï¼Œå¹¶å¯¹ç”¨æˆ·é€ æˆ�ä¸¥é‡�çš„å¿ƒç�†å’Œç¤¾äº¤ä¼¤å®³ã€‚    å»ºè®®é�µå®ˆç›¸å…³çš„æ³•å¾‹æ³•è§„å’Œç¤¾ä¼šé�“å¾·è§„èŒƒï¼Œå¹¶å¯»æ‰¾å…¶ä»–æœ‰ç›Šå’Œå�¥åº·çš„å¨±ä¹�æ–¹å¼�ã€‚"""Test for llm generate """res = llm.generate(prompts=["hillo?"])"""Test for llm aio generate"""async def run_aio_generate():    resp = await llm.agenerate(prompts=["Write a 20-word article about rivers."])    print(resp)await run_aio_generate()"""Test for llm stream"""for res in llm.stream("write a joke."):    print(res)"""Test for llm aio stream"""async def run_aio_stream():    async for res in llm.astream("Write a 20-word article about mountains"):        print(res)await run_aio_stream()    [INFO] [09-15 20:23:26] logging.py:55 [t:140708023539520]: requesting llm api endpoint: /chat/eb-instant    [INFO] [09-15 20:23:27] logging.py:55 [t:140708023539520]: async requesting llm api endpoint: