LangChainLangChain 1.4 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
43 small wins to finish your pathNext lesson

The desk on a hosted model

Every answer so far came from rules you wrote. init_chat_model loads a hosted model from a provider:model string, and the desk around it does not change.

init_chat_model takes a string naming the provider and the model, imports the matching package, and hands back a chat model with the same invoke, stream and bind_tools as DeskModel.

Examplethe only new lines
from langchain.chat_models import init_chat_model

model = init_chat_model("groq:openai/gpt-oss-120b")

In desk.py, that model goes where DeskModel() was. The tools, the four middleware, the context and the checkpointer stay where they are, because each was written against the base class. create_agent accepts the string directly too, as create_agent("groq:openai/gpt-oss-120b", ...).

What happens with no key set

Example
from langchain.chat_models import init_chat_model

init_chat_model("groq:openai/gpt-oss-120b")

The model cannot be built, and the error names the variable to fill in. Set it and the same desk runs against a hosted model.

A hosted model also behaves differently from the rules you wrote. It may put a sentence and a tool call in one message, word the same answer differently twice, or ask the customer a question back. The five tests keep checking your own code either way, which is why they were worth writing.

Try it yourself
  • Set a Groq key and run the desk's three tickets against the hosted model.
  • Change the string to "google_genai:gemini-2.5-flash" after installing langchain-google-genai.
  • Watch the call limit from lesson 20 with a hosted model and count the model calls.

This is what real progress feels like.