Skip to main content
Ctrl+K
🦜🔗 LangChain  documentation - Home
  • Reference
  • Legacy reference
Ctrl+K
Docs
  • GitHub
  • X / Twitter
Ctrl+K
  • Reference
  • Legacy reference
Docs
  • GitHub
  • X / Twitter

Section Navigation

Base packages

  • Core
  • Langchain
  • Text Splitters
  • Community
    • adapters
    • agent_toolkits
    • agents
    • cache
    • callbacks
    • chains
    • chat_loaders
    • chat_message_histories
    • chat_models
      • ChatAnyscale
      • AzureMLChatOnlineEndpoint
      • CustomOpenAIChatContentFormatter
      • LlamaChatContentFormatter
      • LlamaContentFormatter
      • MistralChatContentFormatter
      • ChatBaichuan
      • QianfanChatEndpoint
      • ChatPromptAdapter
      • ChatCoze
      • ChatDappierAI
      • ChatDatabricks
      • ChatDeepInfra
      • ChatDeepInfraException
      • ChatEdenAI
      • ChatEverlyAI
      • FakeListChatModel
      • FakeMessagesListChatModel
      • ChatFriendli
      • GigaChat
      • ChatGooglePalm
      • ChatGooglePalmError
      • GPTRouter
      • GPTRouterException
      • GPTRouterModel
      • HumanInputChatModel
      • ChatHunyuan
      • ChatJavelinAIGateway
      • ChatParams
      • JinaChat
      • ChatKinetica
      • KineticaSqlOutputParser
      • KineticaSqlResponse
      • KineticaUtil
      • ChatKonko
      • ChatLiteLLM
      • ChatLiteLLMException
      • ChatLiteLLMRouter
      • LlamaEdgeChatService
      • ChatLlamaCpp
      • ChatMaritalk
      • MaritalkHTTPError
      • MiniMaxChat
      • ChatMlflow
      • ChatMLflowAIGateway
      • ChatParams
      • ChatMLX
      • MoonshotChat
      • ChatOCIGenAI
      • CohereProvider
      • MetaProvider
      • Provider
      • ChatOctoAI
      • ChatOllama
      • PaiEasChatEndpoint
      • ChatPerplexity
      • ChatPremAI
      • ChatPremAPIError
      • PromptLayerChatOpenAI
      • ChatSnowflakeCortex
      • ChatSnowflakeCortexError
      • ChatSparkLLM
      • ChatTongyi
      • VolcEngineMaasChat
      • ChatYandexGPT
      • ChatYi
      • ChatYuan2
      • ChatZhipuAI
      • convert_messages_to_prompt_anthropic
      • aconnect_httpx_sse
      • convert_message_to_dict
      • convert_messages_to_prompt_mistral
      • get_cohere_chat_request
      • get_role
      • acompletion_with_retry
      • acompletion_with_retry_streaming
      • completion_with_retry
      • conditional_decorator
      • convert_dict_to_message
      • get_chat_request
      • get_role
      • achat_with_retry
      • chat_with_retry
      • acompletion_with_retry
      • completion_with_retry
      • get_ordered_generation_requests
      • acompletion_with_retry
      • acompletion_with_retry
      • get_llm_output
      • convert_messages_to_prompt_llama
      • aconnect_httpx_sse
      • connect_httpx_sse
      • acompletion_with_retry
      • chat_with_retry
      • create_prem_retry_decorator
      • convert_dict_to_message
      • convert_message_chunk_to_message
      • convert_message_to_dict
      • convert_dict_to_message
      • acompletion_with_retry
      • completion_with_retry
      • aconnect_httpx_sse
      • acompletion_with_retry
      • aconnect_sse
      • connect_sse
      • ChatAnthropic
      • AzureChatOpenAI
      • BedrockChat
      • ChatCohere
      • ErnieBotChat
      • ChatFireworks
      • ChatHuggingFace
      • ChatOpenAI
      • SolarChat
      • ChatVertexAI
    • cross_encoders
    • docstore
    • document_compressors
    • document_loaders
    • document_transformers
    • embeddings
    • example_selectors
    • graph_vectorstores
    • graphs
    • indexes
    • llms
    • memory
    • output_parsers
    • query_constructors
    • retrievers
    • storage
    • tools
    • utilities
    • utils
    • vectorstores
  • Experimental

Integrations

  • AI21
  • Airbyte
  • Anthropic
  • AstraDB
  • AWS
  • Azure Dynamic Sessions
  • Chroma
  • Cohere
  • Couchbase
  • Elasticsearch
  • Exa
  • Fireworks
  • Google Community
  • Google GenAI
  • Google VertexAI
  • Groq
  • Huggingface
  • Milvus
  • MistralAI
  • MongoDB
  • Nomic
  • Nvidia Ai Endpoints
  • Ollama
  • OpenAI
  • Pinecone
  • Postgres
  • Prompty
  • Qdrant
  • Robocorp
  • Together
  • Unstructured
  • VoyageAI
  • Weaviate
  • LangChain Python API Reference
  • chat_models
  • convert_dict...

convert_dict_to_message#

langchain_community.chat_models.tongyi.convert_dict_to_message(_dict: Mapping[str, Any], is_chunk: bool = False) → BaseMessage | BaseMessageChunk[source]#

Convert a dict to a message.

Parameters:
  • _dict (Mapping[str, Any]) –

  • is_chunk (bool) –

Return type:

BaseMessage | BaseMessageChunk

On this page
  • convert_dict_to_message()

© Copyright 2023, LangChain Inc.