From ffbe5b2106d31da6aea5d534d0d48d3f33b6f6fb Mon Sep 17 00:00:00 2001 From: dabzr <128552152+dabzr@users.noreply.github.com> Date: Thu, 26 Dec 2024 18:43:34 -0300 Subject: [PATCH] partners: fix default value for stop_sequences in ChatGroq (#28924) - **Description:** This PR addresses an issue with the `stop_sequences` field in the `ChatGroq` class. Currently, the field is defined as: ```python stop: Optional[Union[List[str], str]] = Field(None, alias="stop_sequences") ``` This causes the language server (LSP) to raise an error indicating that the `stop_sequences` parameter must be implemented. The issue occurs because `Field(None, alias="stop_sequences")` is different compared to `Field(default=None, alias="stop_sequences")`. ![image](https://github.com/user-attachments/assets/bfc34cb1-c664-4c31-b856-8f18419c7350) To resolve the issue, the field is updated to: ```python stop: Optional[Union[List[str], str]] = Field(default=None, alias="stop_sequences") ``` While this issue does not affect runtime behavior, it ensures compatibility with LSPs and improves the development experience. - **Issue:** N/A - **Dependencies:** None --- libs/partners/groq/langchain_groq/chat_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/partners/groq/langchain_groq/chat_models.py b/libs/partners/groq/langchain_groq/chat_models.py index f8e518cc4fe21..5868e9cc6a3a4 100644 --- a/libs/partners/groq/langchain_groq/chat_models.py +++ b/libs/partners/groq/langchain_groq/chat_models.py @@ -305,7 +305,7 @@ class Joke(BaseModel): """Model name to use.""" temperature: float = 0.7 """What sampling temperature to use.""" - stop: Optional[Union[List[str], str]] = Field(None, alias="stop_sequences") + stop: Optional[Union[List[str], str]] = Field(default=None, alias="stop_sequences") """Default stop sequences.""" model_kwargs: Dict[str, Any] = Field(default_factory=dict) """Holds any model parameters valid for `create` call not explicitly specified."""