About

Building your AI app with LangChain? Supercharge your app with immediate access to real-time data, spanning news, entertainment, finance, market data, weather, and more.

1. Create Dappier API Key

Before getting started, you will need a Dappier API key first, please visit Dappier API Key on how to obtain your own key.

2. Import ChatDappierAI in LangChain

To work with our LangChain Dappier Chat Model you can pass the key directly through the parameter named dappier_api_key when initiating the class or set as an environment variable.

export DAPPIER_API_KEY="..."
from langchain_community.chat_models.dappier import ChatDappierAI
from langchain_core.messages import HumanMessage

3. Instantiate ChatDappierAI setting the dappier_model and api_key

chat = ChatDappierAI(
    dappier_endpoint="https://api.dappier.com/app/datamodelconversation",
    dappier_model="dm_01hpsxyfm2fwdt2zet9cg6fdxt",
    dappier_api_key="...",
)
messages = [HumanMessage(content="Who won the super bowl in 2024?")]
chat.invoke(messages)
AIMessage(content='Hey there! The Kansas City Chiefs won Super Bowl LVIII in 2024. They beat the San Francisco 49ers in overtime with a final score of 25-22. It was quite the game! 🏈')
await chat.ainvoke(messages)
AIMessage(content='The Kansas City Chiefs won Super Bowl LVIII in 2024! 🏈')