refactor(xai): remove redundant lc_attributes override (#35791)

Remove the redundant `lc_attributes` override from `ChatXAI`. The
`xai_api_base` field is a declared Pydantic `Field`, so
`Serializable.to_json()` already picks it up via its standard field
iteration loop (line 225-232 in `serializable.py`). The override was a
no-op — it re-inserted the same key with the same value that the base
serialization already included.
This commit is contained in:
Mason Daugherty
2026-03-12 11:23:22 -04:00
committed by GitHub
parent 6b9b4c6546
commit cee6430b1c

View File

@@ -448,19 +448,6 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override]
"""
return ["langchain_xai", "chat_models"]
@property
def lc_attributes(self) -> dict[str, Any]:
"""List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
"""
attributes: dict[str, Any] = {}
if self.xai_api_base:
attributes["xai_api_base"] = self.xai_api_base
return attributes
@classmethod
def is_lc_serializable(cls) -> bool:
"""Return whether this model can be serialized by LangChain."""