diff --git a/lightrag/llm/azure_openai.py b/lightrag/llm/azure_openai.py index 4d15a674..84e45cfb 100644 --- a/lightrag/llm/azure_openai.py +++ b/lightrag/llm/azure_openai.py @@ -1,46 +1,3 @@ -""" -Azure OpenAI LLM Interface Module -========================== - -This module provides interfaces for interacting with aure openai'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: - - openai - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.azure_openai import azure_openai_model_complete, azure_openai_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - - import os import pipmaster as pm # Pipmaster for dynamic library install diff --git a/lightrag/llm/bedrock.py b/lightrag/llm/bedrock.py index f3b2143c..615d3453 100644 --- a/lightrag/llm/bedrock.py +++ b/lightrag/llm/bedrock.py @@ -1,46 +1,3 @@ -""" -Bedrock LLM Interface Module -========================== - -This module provides interfaces for interacting with Bedrock'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: - - aioboto3, tenacity - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.bebrock import bebrock_model_complete, bebrock_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - - import copy import os import json diff --git a/lightrag/llm/jina.py b/lightrag/llm/jina.py index 62404dde..c3484b39 100644 --- a/lightrag/llm/jina.py +++ b/lightrag/llm/jina.py @@ -1,43 +1,3 @@ -""" -Jina Embedding Interface Module -========================== - -This module provides interfaces for interacting with jina system, -including 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 embedding generation - -Dependencies: - - tenacity - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.jina import jina_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - import os import pipmaster as pm # Pipmaster for dynamic library install diff --git a/lightrag/llm/lmdeploy.py b/lightrag/llm/lmdeploy.py index 99d1c807..acf51c23 100644 --- a/lightrag/llm/lmdeploy.py +++ b/lightrag/llm/lmdeploy.py @@ -1,45 +1,3 @@ -""" -LMDeploy LLM Interface Module -========================== - -This module provides interfaces for interacting with LMDeploy'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: - - tenacity - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.lmdeploy import lmdeploy_model_complete, lmdeploy_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - import pipmaster as pm # Pipmaster for dynamic library install # install specific modules diff --git a/lightrag/llm/lollms.py b/lightrag/llm/lollms.py index 00dd1da9..93d7e155 100644 --- a/lightrag/llm/lollms.py +++ b/lightrag/llm/lollms.py @@ -1,66 +1,3 @@ -""" -LoLLMs (Lord of Large Language Models) Interface Module -===================================================== - -This module provides the official interface for interacting with LoLLMs (Lord of Large Language and multimodal Systems), -a unified framework for AI model interaction and deployment. - -LoLLMs is designed as a "one tool to rule them all" solution, providing seamless integration -with various AI models while maintaining high performance and user-friendly interfaces. - -Author: ParisNeo -Created: 2024-01-24 -License: Apache 2.0 - -Copyright (c) 2024 ParisNeo - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -Version: 2.0.0 - -Change Log: -- 2.0.0 (2024-01-24): - * Added async support for model inference - * Implemented streaming capabilities - * Added embedding generation functionality - * Enhanced parameter handling - * Improved error handling and timeout management - -Dependencies: - - aiohttp - - numpy - - Python >= 3.10 - -Features: - - Async text generation with streaming support - - Embedding generation - - Configurable model parameters - - System prompt and chat history support - - Timeout handling - - API key authentication - -Usage: - from llm_interfaces.lollms import lollms_model_complete, lollms_embed - -Project Repository: https://github.com/ParisNeo/lollms -Documentation: https://github.com/ParisNeo/lollms/docs -""" - -__version__ = "1.0.0" -__author__ = "ParisNeo" -__status__ = "Production" -__project_url__ = "https://github.com/ParisNeo/lollms" -__doc_url__ = "https://github.com/ParisNeo/lollms/docs" import sys if sys.version_info < (3, 9): diff --git a/lightrag/llm/nvidia_openai.py b/lightrag/llm/nvidia_openai.py index f298039d..e711c4ac 100644 --- a/lightrag/llm/nvidia_openai.py +++ b/lightrag/llm/nvidia_openai.py @@ -1,46 +1,3 @@ -""" -OpenAI LLM Interface Module -========================== - -This module provides interfaces for interacting with openai'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: - - openai - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.nvidia_openai import nvidia_openai_model_complete, nvidia_openai_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - - import sys import os @@ -48,6 +5,7 @@ if sys.version_info < (3, 9): pass else: pass + import pipmaster as pm # Pipmaster for dynamic library install # install specific modules diff --git a/lightrag/llm/openai.py b/lightrag/llm/openai.py index aaaaf406..70aa0ceb 100644 --- a/lightrag/llm/openai.py +++ b/lightrag/llm/openai.py @@ -1,45 +1,3 @@ -""" -OpenAI LLM Interface Module -========================== - -This module provides interfaces for interacting with openai'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: - - openai - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.openai import openai_model_complete, openai_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - from ..utils import verbose_debug, VERBOSE_DEBUG import sys import os diff --git a/lightrag/llm/siliconcloud.py b/lightrag/llm/siliconcloud.py index 4aaaf7e7..41adb96e 100644 --- a/lightrag/llm/siliconcloud.py +++ b/lightrag/llm/siliconcloud.py @@ -1,43 +1,3 @@ -""" -SiliconCloud Embedding Interface Module -========================== - -This module provides interfaces for interacting with SiliconCloud system, -including 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 embedding generation - -Dependencies: - - tenacity - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.siliconcloud import siliconcloud_model_complete, siliconcloud_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - import sys if sys.version_info < (3, 9): diff --git a/lightrag/llm/zhipu.py b/lightrag/llm/zhipu.py index 5a73f41d..dede42dc 100644 --- a/lightrag/llm/zhipu.py +++ b/lightrag/llm/zhipu.py @@ -1,45 +1,3 @@ -""" -Zhipu LLM Interface Module -========================== - -This module provides interfaces for interacting with LMDeploy'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: - - tenacity - - numpy - - pipmaster - - Python >= 3.10 - -Usage: - from llm_interfaces.zhipu import zhipu_model_complete, zhipu_embed -""" - -__version__ = "1.0.0" -__author__ = "lightrag Team" -__status__ = "Production" - import sys import re import json diff --git a/lightrag/prompt.py b/lightrag/prompt.py index f4f5e38a..a25ab672 100644 --- a/lightrag/prompt.py +++ b/lightrag/prompt.py @@ -1,8 +1,9 @@ from __future__ import annotations +from typing import Any GRAPH_FIELD_SEP = "" -PROMPTS = {} +PROMPTS: dict[str, Any] = {} PROMPTS["DEFAULT_LANGUAGE"] = "English" PROMPTS["DEFAULT_TUPLE_DELIMITER"] = "<|>" diff --git a/lightrag/tools/lightrag_visualizer/graph_visualizer.py b/lightrag/tools/lightrag_visualizer/graph_visualizer.py index ad449f91..8a6f0976 100644 --- a/lightrag/tools/lightrag_visualizer/graph_visualizer.py +++ b/lightrag/tools/lightrag_visualizer/graph_visualizer.py @@ -1,10 +1,3 @@ -""" -3D GraphML Viewer using Dear ImGui and ModernGL -Author: ParisNeo, ArnoChen -Description: An interactive 3D GraphML viewer using imgui_bundle and ModernGL -Version: 2.0 -""" - from typing import Optional, Tuple, Dict, List import numpy as np import networkx as nx diff --git a/requirements.txt b/requirements.txt index 26f5655d..03d93aa3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,9 +13,7 @@ python-dotenv setuptools tenacity - # LLM packages tiktoken -xxhash # Extra libraries are installed when needed using pipmaster diff --git a/test_lightrag_ollama_chat.py b/tests/test_lightrag_ollama_chat.py similarity index 100% rename from test_lightrag_ollama_chat.py rename to tests/test_lightrag_ollama_chat.py