pm bs4 when ollama
This commit is contained in:
@@ -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
|
import sys
|
||||||
|
|
||||||
if sys.version_info < (3, 9):
|
if sys.version_info < (3, 9):
|
||||||
from typing import AsyncIterator
|
from typing import AsyncIterator
|
||||||
else:
|
else:
|
||||||
from collections.abc import AsyncIterator
|
from collections.abc import AsyncIterator
|
||||||
|
|
||||||
import pipmaster as pm # Pipmaster for dynamic library install
|
import pipmaster as pm # Pipmaster for dynamic library install
|
||||||
|
|
||||||
# install specific modules
|
# install specific modules
|
||||||
|
@@ -13,13 +13,19 @@ from functools import wraps
|
|||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
import bs4
|
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import tiktoken
|
import tiktoken
|
||||||
|
|
||||||
from lightrag.prompt import PROMPTS
|
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"
|
VERBOSE_DEBUG = os.getenv("VERBOSE", "false").lower() == "true"
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user