mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-02 17:54:23 +00:00
fix: update response_metadata
to use correct model
attribute
This commit is contained in:
parent
d28db771d4
commit
8b40258e72
@ -837,8 +837,8 @@ class ChatModelUnitTests(ChatModelTests):
|
|||||||
assert model is not None
|
assert model is not None
|
||||||
|
|
||||||
def test_model_param_name(self) -> None:
|
def test_model_param_name(self) -> None:
|
||||||
"""Tests model initialization with a ``model=`` parameter. This should pass for all
|
"""Tests model initialization with a ``model=`` parameter. This should pass for
|
||||||
integrations.
|
all integrations.
|
||||||
|
|
||||||
.. dropdown:: Troubleshooting
|
.. dropdown:: Troubleshooting
|
||||||
|
|
||||||
@ -851,7 +851,7 @@ class ChatModelUnitTests(ChatModelTests):
|
|||||||
``model_config`` class attribute to your model class:
|
``model_config`` class attribute to your model class:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
class MyChatModel(BaseChatModel):
|
class MyChatModel(BaseChatModel):
|
||||||
model: str = Field(alias="model_name")
|
model: str = Field(alias="model_name")
|
||||||
model_config = ConfigDict(populate_by_name=True)
|
model_config = ConfigDict(populate_by_name=True)
|
||||||
@ -873,7 +873,7 @@ class ChatModelUnitTests(ChatModelTests):
|
|||||||
|
|
||||||
model = self.chat_model_class(**params)
|
model = self.chat_model_class(**params)
|
||||||
assert model is not None
|
assert model is not None
|
||||||
assert model.model == params["model"]
|
assert model.model == params["model"] # type: ignore[attr-defined]
|
||||||
|
|
||||||
def test_init_from_env(self) -> None:
|
def test_init_from_env(self) -> None:
|
||||||
"""Test initialization from environment variables. Relies on the
|
"""Test initialization from environment variables. Relies on the
|
||||||
|
@ -81,7 +81,7 @@ class ChatParrotLink(BaseChatModel):
|
|||||||
additional_kwargs={}, # Used to add additional payload to the message
|
additional_kwargs={}, # Used to add additional payload to the message
|
||||||
response_metadata={ # Use for response metadata
|
response_metadata={ # Use for response metadata
|
||||||
"time_in_seconds": 3,
|
"time_in_seconds": 3,
|
||||||
"model_name": self.model_name,
|
"model_name": self.model,
|
||||||
},
|
},
|
||||||
usage_metadata={
|
usage_metadata={
|
||||||
"input_tokens": ct_input_tokens,
|
"input_tokens": ct_input_tokens,
|
||||||
@ -146,7 +146,7 @@ class ChatParrotLink(BaseChatModel):
|
|||||||
chunk = ChatGenerationChunk(
|
chunk = ChatGenerationChunk(
|
||||||
message=AIMessageChunk(
|
message=AIMessageChunk(
|
||||||
content="",
|
content="",
|
||||||
response_metadata={"time_in_sec": 3, "model_name": self.model_name},
|
response_metadata={"time_in_sec": 3, "model_name": self.model},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if run_manager:
|
if run_manager:
|
||||||
|
Loading…
Reference in New Issue
Block a user