Sadiksmart0 commited on
Commit
aee11f6
·
verified ·
1 Parent(s): dbeb4f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -45,7 +45,7 @@ def fetch_doc():
45
 
46
  # # Define llm
47
  #hf_token = os.environ.get("HF_TOKEN").strip() # Ensure to set your Hugging Face token in the environment variable HF_TOKEN
48
- llm = OllamaLLM(model="mistral:instruct")
49
 
50
  pdf_files = fetch_doc() #Fetch Dataset
51
  chunks = None
@@ -107,6 +107,12 @@ class QueryRequest(BaseModel):
107
 
108
  @app.get("/")
109
  def home():
 
 
 
 
 
 
110
  return {"message": "Welcome to the Know The Law API. Use POST /query to ask legal questions."}
111
 
112
  @app.post("/query")
 
45
 
46
  # # Define llm
47
  #hf_token = os.environ.get("HF_TOKEN").strip() # Ensure to set your Hugging Face token in the environment variable HF_TOKEN
48
+ llm = OllamaLLM(model="mistral:instruct", base_url="http://localhost:11434")
49
 
50
  pdf_files = fetch_doc() #Fetch Dataset
51
  chunks = None
 
107
 
108
  @app.get("/")
109
  def home():
110
+ print("Testing Ollama LLM response...")
111
+ try:
112
+ response = llm.invoke("What is the capital of Nigeria?")
113
+ print("Response:", response)
114
+ except Exception as e:
115
+ print("Failed to invoke model:", e)
116
  return {"message": "Welcome to the Know The Law API. Use POST /query to ask legal questions."}
117
 
118
  @app.post("/query")