mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 04:49:17 +00:00
core[minor],community[minor]: Upgrade all @root_validator() to @pre_init (#23841)
This PR introduces a @pre_init decorator that's a @root_validator(pre=True) but with all the defaults populated!
This commit is contained in:
@@ -9,7 +9,7 @@ from langchain_community.llms.aleph_alpha import AlephAlpha
|
||||
|
||||
@pytest.mark.requires("aleph_alpha_client")
|
||||
def test_api_key_is_secret_string() -> None:
|
||||
llm = AlephAlpha(aleph_alpha_api_key="secret-api-key") # type: ignore[call-arg]
|
||||
llm = AlephAlpha(aleph_alpha_api_key="secret-api-key") # type: ignore
|
||||
assert isinstance(llm.aleph_alpha_api_key, SecretStr)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_api_key_is_secret_string() -> None:
|
||||
def test_api_key_masked_when_passed_via_constructor(
|
||||
capsys: CaptureFixture,
|
||||
) -> None:
|
||||
llm = AlephAlpha(aleph_alpha_api_key="secret-api-key") # type: ignore[call-arg]
|
||||
llm = AlephAlpha(aleph_alpha_api_key="secret-api-key") # type: ignore
|
||||
print(llm.aleph_alpha_api_key, end="") # noqa: T201
|
||||
captured = capsys.readouterr()
|
||||
|
||||
|
@@ -277,9 +277,12 @@ async def async_gen_mock_streaming_response() -> AsyncGenerator[Dict, None]:
|
||||
async def test_bedrock_async_streaming_call() -> None:
|
||||
# Mock boto3 import
|
||||
mock_boto3 = MagicMock()
|
||||
session = MagicMock()
|
||||
session.region_name = "region"
|
||||
mock_boto3.Session.return_value = session
|
||||
mock_boto3.Session.return_value.client.return_value = (
|
||||
MagicMock()
|
||||
) # Mocking the client method of the Session object
|
||||
session # Mocking the client method of the Session object
|
||||
)
|
||||
|
||||
with patch.dict(
|
||||
"sys.modules", {"boto3": mock_boto3}
|
||||
|
@@ -139,7 +139,7 @@
|
||||
"model_name": "davinci",
|
||||
"temperature": 0.5,
|
||||
"max_tokens": 256,
|
||||
"top_p": 1,
|
||||
"top_p": 1.0,
|
||||
"n": 1,
|
||||
"best_of": 1,
|
||||
"openai_api_key": {
|
||||
@@ -655,7 +655,7 @@
|
||||
"model_name": "davinci",
|
||||
"temperature": 0.5,
|
||||
"max_tokens": 256,
|
||||
"top_p": 1,
|
||||
"top_p": 1.0,
|
||||
"n": 1,
|
||||
"best_of": 1,
|
||||
"openai_api_key": {
|
||||
@@ -817,7 +817,7 @@
|
||||
"model_name": "davinci",
|
||||
"temperature": 0.7,
|
||||
"max_tokens": 256,
|
||||
"top_p": 1,
|
||||
"top_p": 1.0,
|
||||
"n": 1,
|
||||
"best_of": 1,
|
||||
"openai_api_key": {
|
||||
|
Reference in New Issue
Block a user