diff --git a/lightrag/llm/ollama.py b/lightrag/llm/ollama.py index 296e263e..f62386e4 100644 --- a/lightrag/llm/ollama.py +++ b/lightrag/llm/ollama.py @@ -1,51 +1,10 @@ -""" -Ollama LLM Interface Module -========================== - -This module provides interfaces for interacting with Ollama's language models, -including text generation and embedding capabilities. - -Author: Lightrag team -Created: 2024-01-24 -License: MIT License - -Copyright (c) 2024 Lightrag - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -Version: 1.0.0 - -Change Log: -- 1.0.0 (2024-01-24): Initial release - * Added async chat completion support - * Added embedding generation - * Added stream response capability - -Dependencies: - - ollama - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.ollama_interface import ollama_model_complete, ollama_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - import sys if sys.version_info < (3, 9): from typing import AsyncIterator else: from collections.abc import AsyncIterator + import pipmaster as pm # Pipmaster for dynamic library install # install specific modules diff --git a/lightrag/utils.py b/lightrag/utils.py index e5d29824..680adf7a 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -13,13 +13,19 @@ from functools import wraps from hashlib import md5 from typing import Any, Callable import xml.etree.ElementTree as ET -import bs4 - import numpy as np import tiktoken from lightrag.prompt import PROMPTS +import pipmaster as pm # Pipmaster for dynamic library install + +# install specific modules +if not pm.is_installed("bs4"): + pm.install("bs4") + +import bs4 + VERBOSE_DEBUG = os.getenv("VERBOSE", "false").lower() == "true"