Fix bug when Perplexity key is missing

John Bollenbacher committed Jul 29, 2024 at 02:20 UTC b8217224d94a7145b61203d31b1f2a07e56e266f
1 file changed +3 -2
python/helpers/perplexity_search.py
+3 -2
@@ -94,7 +94,8 @@ def PerplexitySearchLLM(api_key,model_name="sonar-medium-online",base_url="https
94 return call_model
95
96
97 -call_llm = PerplexitySearchLLM(api_key=api_key_from_env,model_name="llama-3-sonar-large-32k-online")
97 +if api_key_from_env:
98 + call_llm = PerplexitySearchLLM(api_key=api_key_from_env,model_name="llama-3-sonar-large-32k-online")
99
100 def perplexity_search(search_query: str):
100 - return call_llm(search_query)
\ No newline at end of file
101 + return call_llm(search_query)