langchain.llms.tongyi.Tongyi¶
class langchain.llms.tongyi.Tongyi[source]¶
Bases: LLM
Tongyi Qwen large language models.
To use, you should have the dashscope python package installed, and the
environment variable DASHSCOPE_API_KEY set with your API key, or pass
it as a named parameter to the constructor.
Example
from langchain.llms import Tongyi
Tongyi = tongyi()
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
param cache: Optional[bool] = None¶
param callback_manager: Optional[BaseCallbackManager] = None¶
param callbacks: Callbacks = None¶
param dashscope_api_key: Optional[str] = None¶
Dashscope api key provide by alicloud.
param max_retries: int = 10¶
Maximum number of retries to make when generating.
param metadata: Optional[Dict[str, Any]] = None¶
Metadata to add to the run trace.
param model_kwargs: Dict[str, Any] [Optional]¶
param model_name: str = 'qwen-plus-v1'¶
Model name to use.
param n: int = 1¶
How many completions to generate for each prompt.
param prefix_messages: List [Optional]¶
Series of messages for Chat input.
param streaming: bool = False¶
Whether to stream the results or not.
param tags: Optional[List[str]] = None¶
Tags to add to the run trace.
param top_p: float = 0.8¶
Total probability mass of tokens to consider at each step.
param verbose: bool [Optional]¶
Whether to print out response text.