SimplerLLM 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- SimplerLLM/__init__.py +0 -0
- SimplerLLM/langauge/__init__.py +0 -0
- SimplerLLM/langauge/llm.py +136 -0
- SimplerLLM/langauge/llm_addons.py +56 -0
- SimplerLLM/langauge/llm_providers/__init__.py +0 -0
- SimplerLLM/langauge/llm_providers/gemeni_llm.py +125 -0
- SimplerLLM/langauge/llm_providers/openai_llm.py +341 -0
- SimplerLLM/prompts/__init__.py +0 -0
- SimplerLLM/prompts/prompt_builder.py +86 -0
- SimplerLLM/tools/__init__.py +0 -0
- SimplerLLM/tools/generic_text_loader.py +160 -0
- SimplerLLM/tools/json_helpers.py +130 -0
- SimplerLLM/tools/rapid_api.py +109 -0
- SimplerLLM/tools/serp.py +79 -0
- SimplerLLM-0.1.0.dist-info/METADATA +166 -0
- SimplerLLM-0.1.0.dist-info/RECORD +18 -0
- SimplerLLM-0.1.0.dist-info/WHEEL +5 -0
- SimplerLLM-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: SimplerLLM
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: An easy-to-use Library for interacting with language models.
|
|
5
|
+
Home-page: https://github.com/hassancs91/SimplerLLM
|
|
6
|
+
Author: Hasan Aboul Hasan
|
|
7
|
+
Author-email: hasan@learnwithhasan.com
|
|
8
|
+
Keywords: text generation,openai,LLM,RAG
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.6
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: python-dotenv
|
|
22
|
+
Requires-Dist: openai
|
|
23
|
+
Requires-Dist: google-generativeai
|
|
24
|
+
Requires-Dist: instructor
|
|
25
|
+
Requires-Dist: newspaper3k
|
|
26
|
+
Requires-Dist: youtube-transcript-api
|
|
27
|
+
Requires-Dist: duckduckgo-search
|
|
28
|
+
Requires-Dist: aiohttp
|
|
29
|
+
Requires-Dist: python-docx
|
|
30
|
+
Requires-Dist: PyPDF2
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# ⚪ SimplerLLM (Beta)
|
|
34
|
+
|
|
35
|
+
⚡ Your Easy Pass to Advanced AI ⚡
|
|
36
|
+
|
|
37
|
+
[](https://opensource.org/licenses/MIT)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## 🤔 What is SimplerLLM?
|
|
41
|
+
|
|
42
|
+
SimplerLLM is an open-source Python library designed to simplify interactions with Large Language Models (LLMs) for researchers and beginners. It offers a unified interface for different LLM providers and a suite of tools to enhance language model capabilities and make it Super easy for anyone to develop AI-powered tools and apps.
|
|
43
|
+
|
|
44
|
+
## Easy Installation
|
|
45
|
+
With pip:
|
|
46
|
+
```bash
|
|
47
|
+
pip install simplerllm
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Features
|
|
52
|
+
|
|
53
|
+
- **Unified LLM Interface**: Define an LLM instance in one line for providers like OpenAI and Google Gemini. Future versions will support more APIs and LLM providers.
|
|
54
|
+
- **Generic Text Loader**: Load text from various sources like DOCX, PDF, TXT files, YouTube scripts, or blog posts.
|
|
55
|
+
- **RapidAPI Connector**: Connect with AI services on RapidAPI.
|
|
56
|
+
- **SERP Integration**: Perform searches using DuckDuckGo, with more search engines coming soon.
|
|
57
|
+
- **Prompt Template Builder**: Easily create and manage prompt templates.
|
|
58
|
+
And Much More Coming Soon!
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Creating an LLM Instance
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from SimplerLLM import LLM, LLMProvider
|
|
65
|
+
|
|
66
|
+
# For OpenAI
|
|
67
|
+
llm_instance = LLM.create(provider=LLMProvider.OPENAI)
|
|
68
|
+
# For Google Gemini
|
|
69
|
+
gemini_instance = LLM.create(provider=LLMProvider.GEMENI, model_name="gemini-pro")
|
|
70
|
+
|
|
71
|
+
response = llm_instance.generate_text(user_prompt="generate a 5 words sentence")
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Using Tools
|
|
76
|
+
|
|
77
|
+
#### SERP
|
|
78
|
+
```python
|
|
79
|
+
from SimplerLLM.tools.serp import search_with_duck_duck_go
|
|
80
|
+
|
|
81
|
+
search_results = search_with_duck_duck_go("penut",3)
|
|
82
|
+
|
|
83
|
+
# use the search results the way you want!
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Generic Text Loader
|
|
88
|
+
```python
|
|
89
|
+
from SimplerLLM.tools.generic_text_loader import load_text
|
|
90
|
+
|
|
91
|
+
text_file = load_text("file.txt")
|
|
92
|
+
|
|
93
|
+
print(text_file.content)
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
#### Calling any RapidAPI API
|
|
98
|
+
```python
|
|
99
|
+
from SimplerLLM.tools.rapid_api import RapidAPIClient
|
|
100
|
+
|
|
101
|
+
api_url = "https://domain-authority1.p.rapidapi.com/seo/get-domain-info"
|
|
102
|
+
api_params = {
|
|
103
|
+
'domain': 'learnwithhasan.com',
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
api_client = RapidAPIClient() # API key read from environment variable
|
|
107
|
+
response = api_client.call_api(api_url, method='GET', params=api_params)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
#### Prompt Template Builder
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from SimplerLLM.prompts.prompt_builder import create_multi_value_prompts,create_prompt_template
|
|
117
|
+
|
|
118
|
+
basic_prompt = "Generate 5 titles for a blog about {topic} and {style}"
|
|
119
|
+
|
|
120
|
+
prompt_template = pr.create_prompt_template(basic_prompt)
|
|
121
|
+
|
|
122
|
+
prompt_template.assign_parms(topic = "marketing",style = "catchy")
|
|
123
|
+
|
|
124
|
+
print(prompt_template.content)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## working with multiple value prompts
|
|
128
|
+
multi_value_prompt_template = """Hello {name}, your next meeting is on {date}.
|
|
129
|
+
and bring a {object} wit you"""
|
|
130
|
+
|
|
131
|
+
params_list = [
|
|
132
|
+
{"name": "Alice", "date": "January 10th", "object" : "dog"},
|
|
133
|
+
{"name": "Bob", "date": "January 12th", "object" : "bag"},
|
|
134
|
+
{"name": "Charlie", "date": "January 15th", "object" : "pen"}
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
multi_value_prompt = create_multi_value_prompts(multi_value_prompt_template)
|
|
139
|
+
generated_prompts = multi_value_prompt.generate_prompts(params_list)
|
|
140
|
+
|
|
141
|
+
print(generated_prompts[0])
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
### Next Updates
|
|
148
|
+
- Adding More Tools
|
|
149
|
+
- Interacting With Local LLMs
|
|
150
|
+
- Prompt Optimization
|
|
151
|
+
- Response Evaluation
|
|
152
|
+
- GPT Trainer
|
|
153
|
+
- Document Chunker
|
|
154
|
+
- Advanced Document Loader
|
|
155
|
+
- Integration With More Providers
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
### MIT
|
|
161
|
+
|
|
162
|
+
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:
|
|
163
|
+
|
|
164
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
165
|
+
|
|
166
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
SimplerLLM/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
SimplerLLM/langauge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
SimplerLLM/langauge/llm.py,sha256=DCMlwcE0GxKmbzUYEBrxCT1aOqWE13CnV77J2hS-_3c,6296
|
|
4
|
+
SimplerLLM/langauge/llm_addons.py,sha256=fD86nYtOl-LI7c6RP7GqoRfSe1i_dGVX0iE7W3hjyTc,2485
|
|
5
|
+
SimplerLLM/langauge/llm_providers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
SimplerLLM/langauge/llm_providers/gemeni_llm.py,sha256=cBRl7mllFcA3UrW4mtH4YZ2W0CQ0DJZfqYO1Z-_FYLA,4123
|
|
7
|
+
SimplerLLM/langauge/llm_providers/openai_llm.py,sha256=EE78-7ZBnFuRp_-pZOQJl_QCwst86zGKggLwosTKu28,13947
|
|
8
|
+
SimplerLLM/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
SimplerLLM/prompts/prompt_builder.py,sha256=tMk93xcguT1olaEer6wUMppPZMQoKnBkZYo4pM5RY2Y,3132
|
|
10
|
+
SimplerLLM/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
SimplerLLM/tools/generic_text_loader.py,sha256=ypt40-xzFhoIDDsXLmlrYiB51Z8mcprjHCQZYXTFD3I,5458
|
|
12
|
+
SimplerLLM/tools/json_helpers.py,sha256=EuLpO3ac1G591j4bxuY45lwNLaRTpegkz9t0HA0QVQE,4462
|
|
13
|
+
SimplerLLM/tools/rapid_api.py,sha256=GZFoCdq2SUU_5gHBkNVT0lNQz_m8O5XL0FvkhGSWK-c,4988
|
|
14
|
+
SimplerLLM/tools/serp.py,sha256=pv30XgoaWaGxTKvhUyQ-SZwdfg0CCcyLWxjipoABXHU,2814
|
|
15
|
+
SimplerLLM-0.1.0.dist-info/METADATA,sha256=I3-DDgtDWMCkNK6wNC4aOwVrZmuJiEuUiw4btHWC4GU,5731
|
|
16
|
+
SimplerLLM-0.1.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
17
|
+
SimplerLLM-0.1.0.dist-info/top_level.txt,sha256=ilSiRnF66Sld7FMCX4weovtb1RIqeVEplS79Y1XEcxk,11
|
|
18
|
+
SimplerLLM-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
SimplerLLM
|