fixed linting
Browse files- lightrag/llm.py +10 -8
lightrag/llm.py
CHANGED
@@ -350,10 +350,11 @@ async def ollama_model_if_cache(
|
|
350 |
timeout = kwargs.pop("timeout", None)
|
351 |
kwargs.pop("hashing_kv", None)
|
352 |
api_key = kwargs.pop("api_key", None)
|
353 |
-
headers =
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
357 |
ollama_client = ollama.AsyncClient(host=host, timeout=timeout, headers=headers)
|
358 |
messages = []
|
359 |
if system_prompt:
|
@@ -386,10 +387,11 @@ async def lollms_model_if_cache(
|
|
386 |
|
387 |
stream = True if kwargs.get("stream") else False
|
388 |
api_key = kwargs.pop("api_key", None)
|
389 |
-
headers =
|
390 |
-
|
391 |
-
|
392 |
-
|
|
|
393 |
|
394 |
# Extract lollms specific parameters
|
395 |
request_data = {
|
|
|
350 |
timeout = kwargs.pop("timeout", None)
|
351 |
kwargs.pop("hashing_kv", None)
|
352 |
api_key = kwargs.pop("api_key", None)
|
353 |
+
headers = (
|
354 |
+
{"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
|
355 |
+
if api_key
|
356 |
+
else {"Content-Type": "application/json"}
|
357 |
+
)
|
358 |
ollama_client = ollama.AsyncClient(host=host, timeout=timeout, headers=headers)
|
359 |
messages = []
|
360 |
if system_prompt:
|
|
|
387 |
|
388 |
stream = True if kwargs.get("stream") else False
|
389 |
api_key = kwargs.pop("api_key", None)
|
390 |
+
headers = (
|
391 |
+
{"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
|
392 |
+
if api_key
|
393 |
+
else {"Content-Type": "application/json"}
|
394 |
+
)
|
395 |
|
396 |
# Extract lollms specific parameters
|
397 |
request_data = {
|