Skip to main content

Overview

Contextual AI’s Grounded Language Model (GLM) is the most grounded language model in the world, making it the best language model to use for RAG and agentic use cases for which minimizing hallucinations is critical.

Global Variables & Examples

First, we will set up the global variables and examples we’ll use with each different implementation method.

Direct API implementation

Python SDK

Langchain

LLamaIndex

Multi-Turn Conversations

The GLM supports multi-turn conversations, but with an important consideration: the model is stateless and knowledge does not automatically persist between turns. This means:
  • To continue a conversation using the same knowledge: You must provide your knowledge array again with each new request.
  • To continue a conversation with additional information: You must combine your existing knowledge array with the new information and provide the complete updated array.
Remember that the GLM relies entirely on the knowledge you explicitly provide in each request, as it prioritizes these facts over its parametric knowledge.

Additional Resources