From e4945c9653fff1b3b40ab20aeb17f6372157b517 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 20 Jan 2025 08:58:08 +0100 Subject: [PATCH] Update llm.py --- lightrag/llm.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lightrag/llm.py b/lightrag/llm.py index daba06dd..682c42f9 100644 --- a/lightrag/llm.py +++ b/lightrag/llm.py @@ -350,7 +350,10 @@ async def ollama_model_if_cache( timeout = kwargs.pop("timeout", None) kwargs.pop("hashing_kv", None) api_key = kwargs.pop("api_key", None) - headers = {"Authorization": f"Bearer {api_key}"} if api_key else {} + headers = { + "Content-Type": "application/json", + "Authorization": f"Bearer {api_key}" + } if api_key else {"Content-Type": "application/json"} ollama_client = ollama.AsyncClient(host=host, timeout=timeout, headers=headers) messages = [] if system_prompt: @@ -383,7 +386,10 @@ async def lollms_model_if_cache( stream = True if kwargs.get("stream") else False api_key = kwargs.pop("api_key", None) - headers = {"Authorization": f"Bearer {api_key}"} if api_key else {} + headers = { + "Content-Type": "application/json", + "Authorization": f"Bearer {api_key}" + } if api_key else {"Content-Type": "application/json"} # Extract lollms specific parameters request_data = {