Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Aug 26, 2024
1 parent 534230b commit eff9353
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libs/cerebras/langchain_cerebras/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def validate_environment(cls, values: Dict) -> Dict:
raise ValueError("n must be 1 when streaming.")

values["cerebras_api_key"] = convert_to_secret_str(
get_from_dict_or_env(values, "cerebras_api_key", "CEREBRAS_API_KEY")
get_from_dict_or_env(values, "cerebras_api_key", "CEREBRAS_API_KEY", "")
)
values["cerebras_api_base"] = os.getenv(
"CEREBRAS_API_BASE", values["cerebras_api_base"]
Expand All @@ -353,9 +353,11 @@ def validate_environment(cls, values: Dict) -> Dict:
else None
),
# Ensure we always fallback to the Cerebras API url.
"base_url": values["cerebras_api_base"]
if values["cerebras_api_base"]
else CEREBRAS_BASE_URL,
"base_url": (
values["cerebras_api_base"]
if values["cerebras_api_base"]
else CEREBRAS_BASE_URL
),
"timeout": values["request_timeout"],
"max_retries": values["max_retries"],
"default_headers": values["default_headers"],
Expand Down

0 comments on commit eff9353

Please sign in to comment.