ChatXAI
features and configurations, head to the API reference.
xAI offers an API to interact with Grok models.
Class | Package | Local | Serializable | JS support | Package downloads | Package latest |
---|---|---|---|---|---|---|
ChatXAI | langchain-xai | ❌ | beta | ✅ |
Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
---|---|---|---|---|---|---|---|---|---|
✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ |
langchain-xai
integration package.
XAI_API_KEY
environment variable:
langchain-xai
package:
ChatXAI.bind_tools
, we can easily pass in Pydantic classes, dict schemas, LangChain tools, or even functions as tools to the model. Under the hood, these are converted to an OpenAI tool schema, which looks like:
ChatXAI
features and configurations, head to the API reference.