fixing type error

This commit is contained in:
Brandon Hancock
2025-01-06 10:13:34 -05:00
parent 0aae59dc1d
commit e253789865

View File

@@ -68,10 +68,7 @@ def create_llm(
api_key=api_key, api_key=api_key,
base_url=base_url, base_url=base_url,
) )
print( print("LLM created with extracted parameters; " f"model='{model}'")
"LLM created with extracted parameters; "
f"model='{model}'"
)
return created_llm return created_llm
except Exception as e: except Exception as e:
print(f"Error instantiating LLM from unknown object type: {e}") print(f"Error instantiating LLM from unknown object type: {e}")
@@ -186,8 +183,7 @@ def _llm_via_environment_or_fallback() -> Optional[LLM]:
if env_var.get("default", False): if env_var.get("default", False):
for key, value in env_var.items(): for key, value in env_var.items():
if key not in ["prompt", "key_name", "default"]: if key not in ["prompt", "key_name", "default"]:
if key in os.environ: llm_params[key.lower()] = value
llm_params[key] = os.environ[key]
else: else:
print(f"Expected env_var to be a dictionary, but got {type(env_var)}") print(f"Expected env_var to be a dictionary, but got {type(env_var)}")
@@ -200,7 +196,9 @@ def _llm_via_environment_or_fallback() -> Optional[LLM]:
print(f"LLM created with model='{model_name}'") print(f"LLM created with model='{model_name}'")
return new_llm return new_llm
except Exception as e: except Exception as e:
print(f"Error instantiating LLM from environment/fallback: {type(e).__name__}: {e}") print(
f"Error instantiating LLM from environment/fallback: {type(e).__name__}: {e}"
)
return None return None