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>
pull/23198/merge
shaunakgodbole 2 months ago committed by GitHub
parent 1fcf875fe3
commit 7193634ae6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save