YanSte commited on
Commit
8423e50
·
1 Parent(s): 703be4e

clean comments and unused libs

Browse files
lightrag/llm/azure_openai.py CHANGED
@@ -1,46 +1,3 @@
1
- """
2
- Azure OpenAI LLM Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with aure openai's language models,
6
- including text generation and embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added async chat completion support
26
- * Added embedding generation
27
- * Added stream response capability
28
-
29
- Dependencies:
30
- - openai
31
- - numpy
32
- - pipmaster
33
- - Python >= 3.10
34
-
35
- Usage:
36
- from llm_interfaces.azure_openai import azure_openai_model_complete, azure_openai_embed
37
- """
38
-
39
- __version__ = "1.0.0"
40
- __author__ = "lightrag Team"
41
- __status__ = "Production"
42
-
43
-
44
  import os
45
  import pipmaster as pm # Pipmaster for dynamic library install
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  import pipmaster as pm # Pipmaster for dynamic library install
3
 
lightrag/llm/bedrock.py CHANGED
@@ -1,46 +1,3 @@
1
- """
2
- Bedrock LLM Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with Bedrock's language models,
6
- including text generation and embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added async chat completion support
26
- * Added embedding generation
27
- * Added stream response capability
28
-
29
- Dependencies:
30
- - aioboto3, tenacity
31
- - numpy
32
- - pipmaster
33
- - Python >= 3.10
34
-
35
- Usage:
36
- from llm_interfaces.bebrock import bebrock_model_complete, bebrock_embed
37
- """
38
-
39
- __version__ = "1.0.0"
40
- __author__ = "lightrag Team"
41
- __status__ = "Production"
42
-
43
-
44
  import copy
45
  import os
46
  import json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import copy
2
  import os
3
  import json
lightrag/llm/jina.py CHANGED
@@ -1,43 +1,3 @@
1
- """
2
- Jina Embedding Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with jina system,
6
- including embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added embedding generation
26
-
27
- Dependencies:
28
- - tenacity
29
- - numpy
30
- - pipmaster
31
- - Python >= 3.10
32
-
33
- Usage:
34
- from llm_interfaces.jina import jina_embed
35
- """
36
-
37
- __version__ = "1.0.0"
38
- __author__ = "lightrag Team"
39
- __status__ = "Production"
40
-
41
  import os
42
  import pipmaster as pm # Pipmaster for dynamic library install
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  import pipmaster as pm # Pipmaster for dynamic library install
3
 
lightrag/llm/lmdeploy.py CHANGED
@@ -1,45 +1,3 @@
1
- """
2
- LMDeploy LLM Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with LMDeploy's language models,
6
- including text generation and embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added async chat completion support
26
- * Added embedding generation
27
- * Added stream response capability
28
-
29
- Dependencies:
30
- - tenacity
31
- - numpy
32
- - pipmaster
33
- - Python >= 3.10
34
-
35
- Usage:
36
- from llm_interfaces.lmdeploy import lmdeploy_model_complete, lmdeploy_embed
37
- """
38
-
39
- __version__ = "1.0.0"
40
- __author__ = "lightrag Team"
41
- __status__ = "Production"
42
-
43
  import pipmaster as pm # Pipmaster for dynamic library install
44
 
45
  # install specific modules
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import pipmaster as pm # Pipmaster for dynamic library install
2
 
3
  # install specific modules
lightrag/llm/lollms.py CHANGED
@@ -1,66 +1,3 @@
1
- """
2
- LoLLMs (Lord of Large Language Models) Interface Module
3
- =====================================================
4
-
5
- This module provides the official interface for interacting with LoLLMs (Lord of Large Language and multimodal Systems),
6
- a unified framework for AI model interaction and deployment.
7
-
8
- LoLLMs is designed as a "one tool to rule them all" solution, providing seamless integration
9
- with various AI models while maintaining high performance and user-friendly interfaces.
10
-
11
- Author: ParisNeo
12
- Created: 2024-01-24
13
- License: Apache 2.0
14
-
15
- Copyright (c) 2024 ParisNeo
16
-
17
- Licensed under the Apache License, Version 2.0 (the "License");
18
- you may not use this file except in compliance with the License.
19
- You may obtain a copy of the License at
20
-
21
- http://www.apache.org/licenses/LICENSE-2.0
22
-
23
- Unless required by applicable law or agreed to in writing, software
24
- distributed under the License is distributed on an "AS IS" BASIS,
25
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- See the License for the specific language governing permissions and
27
- limitations under the License.
28
-
29
- Version: 2.0.0
30
-
31
- Change Log:
32
- - 2.0.0 (2024-01-24):
33
- * Added async support for model inference
34
- * Implemented streaming capabilities
35
- * Added embedding generation functionality
36
- * Enhanced parameter handling
37
- * Improved error handling and timeout management
38
-
39
- Dependencies:
40
- - aiohttp
41
- - numpy
42
- - Python >= 3.10
43
-
44
- Features:
45
- - Async text generation with streaming support
46
- - Embedding generation
47
- - Configurable model parameters
48
- - System prompt and chat history support
49
- - Timeout handling
50
- - API key authentication
51
-
52
- Usage:
53
- from llm_interfaces.lollms import lollms_model_complete, lollms_embed
54
-
55
- Project Repository: https://github.com/ParisNeo/lollms
56
- Documentation: https://github.com/ParisNeo/lollms/docs
57
- """
58
-
59
- __version__ = "1.0.0"
60
- __author__ = "ParisNeo"
61
- __status__ = "Production"
62
- __project_url__ = "https://github.com/ParisNeo/lollms"
63
- __doc_url__ = "https://github.com/ParisNeo/lollms/docs"
64
  import sys
65
 
66
  if sys.version_info < (3, 9):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import sys
2
 
3
  if sys.version_info < (3, 9):
lightrag/llm/nvidia_openai.py CHANGED
@@ -1,46 +1,3 @@
1
- """
2
- OpenAI LLM Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with openai's language models,
6
- including text generation and embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added async chat completion support
26
- * Added embedding generation
27
- * Added stream response capability
28
-
29
- Dependencies:
30
- - openai
31
- - numpy
32
- - pipmaster
33
- - Python >= 3.10
34
-
35
- Usage:
36
- from llm_interfaces.nvidia_openai import nvidia_openai_model_complete, nvidia_openai_embed
37
- """
38
-
39
- __version__ = "1.0.0"
40
- __author__ = "lightrag Team"
41
- __status__ = "Production"
42
-
43
-
44
  import sys
45
  import os
46
 
@@ -48,6 +5,7 @@ if sys.version_info < (3, 9):
48
  pass
49
  else:
50
  pass
 
51
  import pipmaster as pm # Pipmaster for dynamic library install
52
 
53
  # install specific modules
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import sys
2
  import os
3
 
 
5
  pass
6
  else:
7
  pass
8
+
9
  import pipmaster as pm # Pipmaster for dynamic library install
10
 
11
  # install specific modules
lightrag/llm/openai.py CHANGED
@@ -1,45 +1,3 @@
1
- """
2
- OpenAI LLM Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with openai's language models,
6
- including text generation and embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added async chat completion support
26
- * Added embedding generation
27
- * Added stream response capability
28
-
29
- Dependencies:
30
- - openai
31
- - numpy
32
- - pipmaster
33
- - Python >= 3.10
34
-
35
- Usage:
36
- from llm_interfaces.openai import openai_model_complete, openai_embed
37
- """
38
-
39
- __version__ = "1.0.0"
40
- __author__ = "lightrag Team"
41
- __status__ = "Production"
42
-
43
  from ..utils import verbose_debug, VERBOSE_DEBUG
44
  import sys
45
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from ..utils import verbose_debug, VERBOSE_DEBUG
2
  import sys
3
  import os
lightrag/llm/siliconcloud.py CHANGED
@@ -1,43 +1,3 @@
1
- """
2
- SiliconCloud Embedding Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with SiliconCloud system,
6
- including embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added embedding generation
26
-
27
- Dependencies:
28
- - tenacity
29
- - numpy
30
- - pipmaster
31
- - Python >= 3.10
32
-
33
- Usage:
34
- from llm_interfaces.siliconcloud import siliconcloud_model_complete, siliconcloud_embed
35
- """
36
-
37
- __version__ = "1.0.0"
38
- __author__ = "lightrag Team"
39
- __status__ = "Production"
40
-
41
  import sys
42
 
43
  if sys.version_info < (3, 9):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import sys
2
 
3
  if sys.version_info < (3, 9):
lightrag/llm/zhipu.py CHANGED
@@ -1,45 +1,3 @@
1
- """
2
- Zhipu LLM Interface Module
3
- ==========================
4
-
5
- This module provides interfaces for interacting with LMDeploy's language models,
6
- including text generation and embedding capabilities.
7
-
8
- Author: Lightrag team
9
- Created: 2024-01-24
10
- License: MIT License
11
-
12
- Copyright (c) 2024 Lightrag
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- Version: 1.0.0
22
-
23
- Change Log:
24
- - 1.0.0 (2024-01-24): Initial release
25
- * Added async chat completion support
26
- * Added embedding generation
27
- * Added stream response capability
28
-
29
- Dependencies:
30
- - tenacity
31
- - numpy
32
- - pipmaster
33
- - Python >= 3.10
34
-
35
- Usage:
36
- from llm_interfaces.zhipu import zhipu_model_complete, zhipu_embed
37
- """
38
-
39
- __version__ = "1.0.0"
40
- __author__ = "lightrag Team"
41
- __status__ = "Production"
42
-
43
  import sys
44
  import re
45
  import json
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import sys
2
  import re
3
  import json
lightrag/prompt.py CHANGED
@@ -1,8 +1,9 @@
1
  from __future__ import annotations
 
2
 
3
  GRAPH_FIELD_SEP = "<SEP>"
4
 
5
- PROMPTS = {}
6
 
7
  PROMPTS["DEFAULT_LANGUAGE"] = "English"
8
  PROMPTS["DEFAULT_TUPLE_DELIMITER"] = "<|>"
 
1
  from __future__ import annotations
2
+ from typing import Any
3
 
4
  GRAPH_FIELD_SEP = "<SEP>"
5
 
6
+ PROMPTS: dict[str, Any] = {}
7
 
8
  PROMPTS["DEFAULT_LANGUAGE"] = "English"
9
  PROMPTS["DEFAULT_TUPLE_DELIMITER"] = "<|>"
lightrag/tools/lightrag_visualizer/graph_visualizer.py CHANGED
@@ -1,10 +1,3 @@
1
- """
2
- 3D GraphML Viewer using Dear ImGui and ModernGL
3
- Author: ParisNeo, ArnoChen
4
- Description: An interactive 3D GraphML viewer using imgui_bundle and ModernGL
5
- Version: 2.0
6
- """
7
-
8
  from typing import Optional, Tuple, Dict, List
9
  import numpy as np
10
  import networkx as nx
 
 
 
 
 
 
 
 
1
  from typing import Optional, Tuple, Dict, List
2
  import numpy as np
3
  import networkx as nx
requirements.txt CHANGED
@@ -13,9 +13,7 @@ python-dotenv
13
  setuptools
14
  tenacity
15
 
16
-
17
  # LLM packages
18
  tiktoken
19
- xxhash
20
 
21
  # Extra libraries are installed when needed using pipmaster
 
13
  setuptools
14
  tenacity
15
 
 
16
  # LLM packages
17
  tiktoken
 
18
 
19
  # Extra libraries are installed when needed using pipmaster
test_lightrag_ollama_chat.py → tests/test_lightrag_ollama_chat.py RENAMED
File without changes