mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-30 00:04:19 +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
|
||||
|
||||
def test_model_param_name(self) -> None:
|
||||
"""Tests model initialization with a ``model=`` parameter. This should pass for all
|
||||
integrations.
|
||||
"""Tests model initialization with a ``model=`` parameter. This should pass for
|
||||
all integrations.
|
||||
|
||||
.. dropdown:: Troubleshooting
|
||||
|
||||
@ -851,7 +851,7 @@ class ChatModelUnitTests(ChatModelTests):
|
||||
``model_config`` class attribute to your model class:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
||||
class MyChatModel(BaseChatModel):
|
||||
model: str = Field(alias="model_name")
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
@ -873,7 +873,7 @@ class ChatModelUnitTests(ChatModelTests):
|
||||
|
||||
model = self.chat_model_class(**params)
|
||||
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:
|
||||
"""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
|
||||
response_metadata={ # Use for response metadata
|
||||
"time_in_seconds": 3,
|
||||
"model_name": self.model_name,
|
||||
"model_name": self.model,
|
||||
},
|
||||
usage_metadata={
|
||||
"input_tokens": ct_input_tokens,
|
||||
@ -146,7 +146,7 @@ class ChatParrotLink(BaseChatModel):
|
||||
chunk = ChatGenerationChunk(
|
||||
message=AIMessageChunk(
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user