mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 08:33:49 +00:00
fireworks[patch]: fix api_key alias in Fireworks LLM (#23118)
Thank you for contributing to LangChain! **Description** The current code snippet for `Fireworks` had incorrect parameters. This PR fixes those parameters. --------- Co-authored-by: Chester Curme <chester.curme@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
1fcf875fe3
commit
7193634ae6
@ -90,7 +90,7 @@ class Fireworks(LLM):
|
||||
)
|
||||
return values
|
||||
|
||||
@root_validator(pre=True)
|
||||
@root_validator(pre=False, skip_on_failure=True)
|
||||
def validate_environment(cls, values: Dict) -> Dict:
|
||||
"""Validate that api key exists in environment."""
|
||||
values["fireworks_api_key"] = convert_to_secret_str(
|
||||
|
@ -18,6 +18,15 @@ def test_fireworks_api_key_is_secret_string() -> None:
|
||||
)
|
||||
assert isinstance(llm.fireworks_api_key, SecretStr)
|
||||
|
||||
# Test api_key alias
|
||||
llm = Fireworks(
|
||||
api_key="secret-api-key",
|
||||
model="accounts/fireworks/models/mixtral-8x7b-instruct",
|
||||
temperature=0.2,
|
||||
max_tokens=250,
|
||||
)
|
||||
assert isinstance(llm.fireworks_api_key, SecretStr)
|
||||
|
||||
|
||||
def test_fireworks_api_key_masked_when_passed_from_env(
|
||||
monkeypatch: MonkeyPatch, capsys: CaptureFixture
|
||||
|
Loading…
Reference in New Issue
Block a user