Skip to content

Agent Zero AI framework

Fix bug when Perplexity key is missing

John Bollenbacherb8217224d94a
diff --git a/python/helpers/perplexity_search.py b/python/helpers/perplexity_search.py
index ee5c4aaf3..b044bc60e 100644
--- a/python/helpers/perplexity_search.py
+++ b/python/helpers/perplexity_search.py
@@ -94,7 +94,8 @@ def PerplexitySearchLLM(api_key,model_name="sonar-medium-online",base_url="https
return call_model
-call_llm = PerplexitySearchLLM(api_key=api_key_from_env,model_name="llama-3-sonar-large-32k-online")
+if api_key_from_env:
+ call_llm = PerplexitySearchLLM(api_key=api_key_from_env,model_name="llama-3-sonar-large-32k-online")
def perplexity_search(search_query: str):
- return call_llm(search_query)
\ No newline at end of file
+ return call_llm(search_query)