mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 14:50:00 +00:00
## Description make DashScope models support Partial Mode for text continuation. For text continuation in ChatTongYi, it supports text continuation with a prefix by adding a "partial" argument in AIMessage. The document is [Partial Mode ](https://help.aliyun.com/zh/model-studio/user-guide/partial-mode?spm=a2c4g.11186623.help-menu-2400256.d_1_0_0_8.211e5b77KMH5Pn&scm=20140722.H_2862210._.OR_help-T_cn~zh-V_1). The API example is: ```py import os import dashscope messages = [{ "role": "user", "content": "请对“春天来了,大地”这句话进行续写,来表达春天的美好和作者的喜悦之情" }, { "role": "assistant", "content": "春天来了,大地", "partial": True }] response = dashscope.Generation.call( api_key=os.getenv("DASHSCOPE_API_KEY"), model='qwen-plus', messages=messages, result_format='message', ) print(response.output.choices[0].message.content) ``` --------- Co-authored-by: Chester Curme <chester.curme@gmail.com> |
||
---|---|---|
.. | ||
__init__.py | ||
konko.py | ||
test_anthropic.py | ||
test_azureml_endpoint.py | ||
test_azureopenai.py | ||
test_baichuan.py | ||
test_bedrock.py | ||
test_cloudflare_workersai.py | ||
test_dappier.py | ||
test_deepinfra.py | ||
test_edenai.py | ||
test_ernie.py | ||
test_fireworks.py | ||
test_friendli.py | ||
test_google_palm.py | ||
test_huggingface.py | ||
test_hunyuan.py | ||
test_imports.py | ||
test_kinetica.py | ||
test_litellm.py | ||
test_llama_edge.py | ||
test_mlflow.py | ||
test_mlx.py | ||
test_naver.py | ||
test_oci_data_science.py | ||
test_oci_generative_ai.py | ||
test_oci_model_deployment_endpoint.py | ||
test_octoai.py | ||
test_ollama.py | ||
test_openai.py | ||
test_outlines.py | ||
test_perplexity.py | ||
test_premai.py | ||
test_reka.py | ||
test_snowflake.py | ||
test_sparkllm.py | ||
test_tongyi.py | ||
test_writer.py | ||
test_yandex.py | ||
test_yuan2.py | ||
test_zhipuai.py |