SimplerLLM 0.1.0__tar.gz → 0.1.2__tar.gz
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-0.1.0 → SimplerLLM-0.1.2}/PKG-INFO +2 -2
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/langauge/llm.py +9 -9
- SimplerLLM-0.1.0/SimplerLLM/langauge/llm_providers/gemeni_llm.py → SimplerLLM-0.1.2/SimplerLLM/langauge/llm_providers/gemini_llm.py +4 -4
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM.egg-info/PKG-INFO +2 -2
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM.egg-info/SOURCES.txt +1 -1
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/setup.py +1 -1
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/__init__.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/langauge/__init__.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/langauge/llm_addons.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/langauge/llm_providers/__init__.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/langauge/llm_providers/openai_llm.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/prompts/__init__.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/prompts/prompt_builder.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/tools/__init__.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/tools/generic_text_loader.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/tools/json_helpers.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/tools/rapid_api.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM/tools/serp.py +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM.egg-info/dependency_links.txt +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM.egg-info/requires.txt +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/SimplerLLM.egg-info/top_level.txt +0 -0
- {SimplerLLM-0.1.0 → SimplerLLM-0.1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SimplerLLM
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: An easy-to-use Library for interacting with language models.
|
|
5
5
|
Home-page: https://github.com/hassancs91/SimplerLLM
|
|
6
6
|
Author: Hasan Aboul Hasan
|
|
@@ -56,7 +56,7 @@ from SimplerLLM import LLM, LLMProvider
|
|
|
56
56
|
# For OpenAI
|
|
57
57
|
llm_instance = LLM.create(provider=LLMProvider.OPENAI)
|
|
58
58
|
# For Google Gemini
|
|
59
|
-
gemini_instance = LLM.create(provider=LLMProvider.
|
|
59
|
+
gemini_instance = LLM.create(provider=LLMProvider.GEMINI, model_name="gemini-pro")
|
|
60
60
|
|
|
61
61
|
response = llm_instance.generate_text(user_prompt="generate a 5 words sentence")
|
|
62
62
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import SimplerLLM.langauge.llm_providers.openai_llm as openai_llm
|
|
2
|
-
import SimplerLLM.langauge.llm_providers.
|
|
2
|
+
import SimplerLLM.langauge.llm_providers.gemini_llm as gemini_llm
|
|
3
3
|
from enum import Enum
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class LLMProvider(Enum):
|
|
7
7
|
OPENAI = 1
|
|
8
|
-
|
|
8
|
+
Gemini = 2
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class LLM:
|
|
@@ -21,8 +21,8 @@ class LLM:
|
|
|
21
21
|
def create(provider=LLMProvider.OPENAI, model_name="gpt-3.5-turbo", temperature=0.7,top_p=1.0):
|
|
22
22
|
if provider == LLMProvider.OPENAI:
|
|
23
23
|
return OpenAILLM(provider, model_name, temperature, top_p)
|
|
24
|
-
if provider == LLMProvider.
|
|
25
|
-
return
|
|
24
|
+
if provider == LLMProvider.Gemini:
|
|
25
|
+
return GeminiLLM(provider, model_name, temperature,top_p)
|
|
26
26
|
else:
|
|
27
27
|
return LLM(provider, model_name, temperature)
|
|
28
28
|
|
|
@@ -35,8 +35,8 @@ class LLM:
|
|
|
35
35
|
def generate_text(self, input_text):
|
|
36
36
|
if self.provider == LLMProvider.OPENAI:
|
|
37
37
|
return openai_llm.generate(input_text)
|
|
38
|
-
elif self.provider == LLMProvider.
|
|
39
|
-
return "generated with
|
|
38
|
+
elif self.provider == LLMProvider.gemini:
|
|
39
|
+
return "generated with gemini"
|
|
40
40
|
else:
|
|
41
41
|
raise ValueError("Unsupported model")
|
|
42
42
|
|
|
@@ -102,7 +102,7 @@ class OpenAILLM(LLM):
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
class
|
|
105
|
+
class GeminiLLM(LLM):
|
|
106
106
|
def __init__(self, model, model_name, temperature,top_p):
|
|
107
107
|
super().__init__(model, model_name, temperature,top_p)
|
|
108
108
|
|
|
@@ -111,7 +111,7 @@ class GemeniLLM(LLM):
|
|
|
111
111
|
model_name = model_name if model_name is not None else self.model_name
|
|
112
112
|
temperature = temperature if temperature is not None else self.temperature
|
|
113
113
|
top_p = top_p if top_p is not None else self.top_p
|
|
114
|
-
return
|
|
114
|
+
return gemini_llm.generate_text(user_prompt=user_prompt,
|
|
115
115
|
model=model_name,temperature=temperature,
|
|
116
116
|
top_p=top_p, max_tokens=max_tokens)
|
|
117
117
|
|
|
@@ -121,7 +121,7 @@ class GemeniLLM(LLM):
|
|
|
121
121
|
temperature = temperature if temperature is not None else self.temperature
|
|
122
122
|
top_p = top_p if top_p is not None else self.top_p
|
|
123
123
|
|
|
124
|
-
return
|
|
124
|
+
return gemini_llm.generate_full_response(user_prompt=user_prompt,
|
|
125
125
|
model=model_name, temperature=temperature,
|
|
126
126
|
top_p=top_p, max_tokens=max_tokens)
|
|
127
127
|
|
|
@@ -9,9 +9,9 @@ import time
|
|
|
9
9
|
load_dotenv()
|
|
10
10
|
|
|
11
11
|
# Constants
|
|
12
|
-
|
|
13
|
-
if
|
|
14
|
-
raise ValueError("Please set the
|
|
12
|
+
GEMINI_API_KEY = os.getenv('GEMINI_API_KEY')
|
|
13
|
+
if GEMINI_API_KEY is None:
|
|
14
|
+
raise ValueError("Please set the GEMINI_API_KEY in .env file.")
|
|
15
15
|
|
|
16
16
|
MAX_RETRIES = os.getenv('MAX_RETRIES')
|
|
17
17
|
if MAX_RETRIES is not None:
|
|
@@ -34,7 +34,7 @@ else:
|
|
|
34
34
|
STREAMING_DELAY = 0.1 # Default value
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
genai.configure(api_key=
|
|
37
|
+
genai.configure(api_key=GEMINI_API_KEY)
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def generate_text_basic(user_prompt, model):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SimplerLLM
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: An easy-to-use Library for interacting with language models.
|
|
5
5
|
Home-page: https://github.com/hassancs91/SimplerLLM
|
|
6
6
|
Author: Hasan Aboul Hasan
|
|
@@ -56,7 +56,7 @@ from SimplerLLM import LLM, LLMProvider
|
|
|
56
56
|
# For OpenAI
|
|
57
57
|
llm_instance = LLM.create(provider=LLMProvider.OPENAI)
|
|
58
58
|
# For Google Gemini
|
|
59
|
-
gemini_instance = LLM.create(provider=LLMProvider.
|
|
59
|
+
gemini_instance = LLM.create(provider=LLMProvider.GEMINI, model_name="gemini-pro")
|
|
60
60
|
|
|
61
61
|
response = llm_instance.generate_text(user_prompt="generate a 5 words sentence")
|
|
62
62
|
|
|
@@ -9,7 +9,7 @@ SimplerLLM/langauge/__init__.py
|
|
|
9
9
|
SimplerLLM/langauge/llm.py
|
|
10
10
|
SimplerLLM/langauge/llm_addons.py
|
|
11
11
|
SimplerLLM/langauge/llm_providers/__init__.py
|
|
12
|
-
SimplerLLM/langauge/llm_providers/
|
|
12
|
+
SimplerLLM/langauge/llm_providers/gemini_llm.py
|
|
13
13
|
SimplerLLM/langauge/llm_providers/openai_llm.py
|
|
14
14
|
SimplerLLM/prompts/__init__.py
|
|
15
15
|
SimplerLLM/prompts/prompt_builder.py
|
|
@@ -10,7 +10,7 @@ with open('README.md', encoding='utf-8') as f:
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name='SimplerLLM',
|
|
13
|
-
version='0.1.
|
|
13
|
+
version='0.1.2',
|
|
14
14
|
author='Hasan Aboul Hasan',
|
|
15
15
|
author_email='hasan@learnwithhasan.com',
|
|
16
16
|
description='An easy-to-use Library for interacting with language models.',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|