-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from langchain-ai/mattf/test-chat-serialization
add a serialization test of ChatNVIDIA using dumps/loads
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from langchain_core.load.dump import dumps | ||
from langchain_core.load.load import loads | ||
|
||
from langchain_nvidia_ai_endpoints import ChatNVIDIA | ||
|
||
|
||
def test_serialize_chatnvidia() -> None: | ||
secret = "a-bogus-key" | ||
x = ChatNVIDIA(nvidia_api_key=secret) | ||
y = loads( | ||
dumps(x), | ||
secrets_map={"NVIDIA_API_KEY": secret}, | ||
valid_namespaces=["langchain_nvidia_ai_endpoints"], | ||
) | ||
assert x == y | ||
assert isinstance(y, ChatNVIDIA) |