SimplerLLM 0.3.1.10__tar.gz → 0.3.1.11__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.3.1.10 → simplerllm-0.3.1.11}/PKG-INFO +1 -1
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_addons.py +22 -10
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM.egg-info/PKG-INFO +1 -1
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM.egg-info/SOURCES.txt +0 -1
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/setup.py +1 -1
- simplerllm-0.3.1.10/tests/test_reliable_json.py +0 -118
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/LICENSE +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_agent_in_team.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_human_in_loop_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_planning_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_rag_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_react_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_reflection_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_tool_calling_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/memory_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/pandas_agent_exp.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/sql_agent_exp.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/image/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/image/img_helper_funcs.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/image/stability_ai.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/embeddings.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/base.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/reliable.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/anthropic_wrapper.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/deepseek_wrapper.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/gemini_wrapper.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/ollama_wrapper.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/openai_wrapper.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/anthropic_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/deepseek_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/gemini_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/llm_response_models.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/ollama_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/openai_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/transformers_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_router/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_router/models.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_router/router.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/prompts/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/prompts/messages_template.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/prompts/prompt_builder.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/file_functions.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/file_loader.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/generic_loader.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/json_helpers.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/pandas_func.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/predefined_tools.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/python_func.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/rapid_api.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/serp.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/text_chunker.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/web_crawler.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/tools/youtube.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/utils/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/utils/custom_verbose.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/vectors/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/vectors/vector_storage.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/workflow/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/workflow/builder.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/workflow/test_helpers.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM.egg-info/dependency_links.txt +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM.egg-info/requires.txt +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM.egg-info/top_level.txt +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/setup.cfg +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/NewWorkFlowTest.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/WorkflowBuidler1.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/__init__.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/generate_text.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/lib_test.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/local_llm.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/serp_results.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_chat_with_text_linked.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_chat_youtube.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_chat_youtube_no_embed.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_chunker.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_complex_json.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_data_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_embed.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_generate.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_helpers.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_llm_router.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_lwh.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_ollama.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_pydantic.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_reAct_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_react_core_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_reflection_core_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_reliable.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_search_query.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_sql_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_token_count.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_tool.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_tool_agent.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_vector_chat.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_youtube_chat_adv.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/test_youtube_tool.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/tweet_generator.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/vb_ui.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/vd_full_test.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/vd_test.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/workflow.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/workflow_import_test.py +0 -0
- {simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/tests/workflow_test.py +0 -0
|
@@ -124,7 +124,7 @@ def generate_pydantic_json_model_reliable(
|
|
|
124
124
|
custom_prompt_suffix: str = None,
|
|
125
125
|
system_prompt: str = "The Output is a VALID Structured JSON",
|
|
126
126
|
full_response: bool = False,
|
|
127
|
-
) -> Union[Tuple[BaseModel, LLMProvider], Tuple[BaseModel, LLMFullResponse, LLMProvider]]:
|
|
127
|
+
) -> Union[Tuple[BaseModel, LLMProvider, str], Tuple[BaseModel, LLMFullResponse, LLMProvider, str]]:
|
|
128
128
|
"""
|
|
129
129
|
Generates a model instance using ReliableLLM with fallback capability.
|
|
130
130
|
|
|
@@ -132,10 +132,16 @@ def generate_pydantic_json_model_reliable(
|
|
|
132
132
|
:param prompt: The fully formatted prompt including the topic.
|
|
133
133
|
:param reliable_llm: Instance of ReliableLLM with primary and secondary providers.
|
|
134
134
|
:param max_retries: Maximum number of retries on validation errors.
|
|
135
|
+
:param max_tokens: Maximum number of tokens to generate.
|
|
135
136
|
:param initial_delay: Initial delay in seconds before the first retry.
|
|
136
137
|
:param custom_prompt_suffix: Optional string to customize or override the generated prompt extension.
|
|
138
|
+
:param system_prompt: System prompt to set the context for the LLM.
|
|
139
|
+
:param full_response: If True, returns the full API response.
|
|
137
140
|
|
|
138
|
-
:return:
|
|
141
|
+
:return:
|
|
142
|
+
- If full_response=False: Tuple of (model_object, provider, model_name)
|
|
143
|
+
- If full_response=True: Tuple of (model_object, full_response, provider, model_name)
|
|
144
|
+
- Error message string if unsuccessful
|
|
139
145
|
"""
|
|
140
146
|
optimized_prompt = create_optimized_prompt(prompt, model_class, custom_prompt_suffix)
|
|
141
147
|
backoff_delays = [initial_delay * (2**attempt) for attempt in range(max_retries + 1)]
|
|
@@ -152,10 +158,10 @@ def generate_pydantic_json_model_reliable(
|
|
|
152
158
|
)
|
|
153
159
|
|
|
154
160
|
if full_response:
|
|
155
|
-
ai_response, provider = result
|
|
161
|
+
ai_response, provider, model_name = result
|
|
156
162
|
response_text = ai_response.generated_text
|
|
157
163
|
else:
|
|
158
|
-
response_text, provider = result
|
|
164
|
+
response_text, provider, model_name = result
|
|
159
165
|
|
|
160
166
|
if response_text:
|
|
161
167
|
json_object = extract_json_from_text(response_text)
|
|
@@ -168,7 +174,7 @@ def generate_pydantic_json_model_reliable(
|
|
|
168
174
|
model_object = convert_json_to_pydantic_model(
|
|
169
175
|
model_class, json_object[0]
|
|
170
176
|
)
|
|
171
|
-
return (model_object, ai_response, provider) if full_response else (model_object, provider)
|
|
177
|
+
return (model_object, ai_response, provider, model_name) if full_response else (model_object, provider, model_name)
|
|
172
178
|
|
|
173
179
|
except Exception as e:
|
|
174
180
|
return f"Exception occurred: {e}"
|
|
@@ -190,7 +196,7 @@ async def generate_pydantic_json_model_reliable_async(
|
|
|
190
196
|
custom_prompt_suffix: str = None,
|
|
191
197
|
system_prompt: str = "The Output is a VALID Structured JSON",
|
|
192
198
|
full_response: bool = False,
|
|
193
|
-
) -> Union[Tuple[BaseModel, LLMProvider], Tuple[BaseModel, LLMFullResponse, LLMProvider]]:
|
|
199
|
+
) -> Union[Tuple[BaseModel, LLMProvider, str], Tuple[BaseModel, LLMFullResponse, LLMProvider, str]]:
|
|
194
200
|
"""
|
|
195
201
|
Asynchronously generates a model instance using ReliableLLM with fallback capability.
|
|
196
202
|
|
|
@@ -198,10 +204,16 @@ async def generate_pydantic_json_model_reliable_async(
|
|
|
198
204
|
:param prompt: The fully formatted prompt including the topic.
|
|
199
205
|
:param reliable_llm: Instance of ReliableLLM with primary and secondary providers.
|
|
200
206
|
:param max_retries: Maximum number of retries on validation errors.
|
|
207
|
+
:param max_tokens: Maximum number of tokens to generate.
|
|
201
208
|
:param initial_delay: Initial delay in seconds before the first retry.
|
|
202
209
|
:param custom_prompt_suffix: Optional string to customize or override the generated prompt extension.
|
|
210
|
+
:param system_prompt: System prompt to set the context for the LLM.
|
|
211
|
+
:param full_response: If True, returns the full API response.
|
|
203
212
|
|
|
204
|
-
:return:
|
|
213
|
+
:return:
|
|
214
|
+
- If full_response=False: Tuple of (model_object, provider, model_name)
|
|
215
|
+
- If full_response=True: Tuple of (model_object, full_response, provider, model_name)
|
|
216
|
+
- Error message string if unsuccessful
|
|
205
217
|
"""
|
|
206
218
|
optimized_prompt = create_optimized_prompt(prompt, model_class, custom_prompt_suffix)
|
|
207
219
|
backoff_delays = [initial_delay * (2**attempt) for attempt in range(max_retries + 1)]
|
|
@@ -218,10 +230,10 @@ async def generate_pydantic_json_model_reliable_async(
|
|
|
218
230
|
)
|
|
219
231
|
|
|
220
232
|
if full_response:
|
|
221
|
-
ai_response, provider = result
|
|
233
|
+
ai_response, provider, model_name = result
|
|
222
234
|
response_text = ai_response.generated_text
|
|
223
235
|
else:
|
|
224
|
-
response_text, provider = result
|
|
236
|
+
response_text, provider, model_name = result
|
|
225
237
|
|
|
226
238
|
if response_text:
|
|
227
239
|
json_object = extract_json_from_text(response_text)
|
|
@@ -234,7 +246,7 @@ async def generate_pydantic_json_model_reliable_async(
|
|
|
234
246
|
model_object = convert_json_to_pydantic_model(
|
|
235
247
|
model_class, json_object[0]
|
|
236
248
|
)
|
|
237
|
-
return (model_object, ai_response, provider) if full_response else (model_object, provider)
|
|
249
|
+
return (model_object, ai_response, provider, model_name) if full_response else (model_object, provider, model_name)
|
|
238
250
|
|
|
239
251
|
except Exception as e:
|
|
240
252
|
return f"Exception occurred: {e}"
|
|
@@ -11,7 +11,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
11
11
|
|
|
12
12
|
setup(
|
|
13
13
|
name="SimplerLLM",
|
|
14
|
-
version="0.3.1.
|
|
14
|
+
version="0.3.1.11",
|
|
15
15
|
author="Hasan Aboul Hasan",
|
|
16
16
|
author_email="hasan@learnwithhasan.com",
|
|
17
17
|
description="An easy-to-use Library for interacting with language models.",
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
from pydantic import BaseModel
|
|
3
|
-
from SimplerLLM.language.llm import LLM, LLMProvider
|
|
4
|
-
from SimplerLLM.language.llm.reliable import ReliableLLM
|
|
5
|
-
from SimplerLLM.language.llm_addons import generate_pydantic_json_model_reliable
|
|
6
|
-
|
|
7
|
-
# Using the same model from test_complex_json.py for consistency
|
|
8
|
-
class EffectivenessScore(BaseModel):
|
|
9
|
-
Score: int
|
|
10
|
-
Explanation: str
|
|
11
|
-
|
|
12
|
-
class ScannabilityScore(BaseModel):
|
|
13
|
-
Score: int
|
|
14
|
-
Explanation: str
|
|
15
|
-
|
|
16
|
-
class SentimentAnalysis(BaseModel):
|
|
17
|
-
Tone: str
|
|
18
|
-
Explanation: str
|
|
19
|
-
|
|
20
|
-
class LengthAnalysis(BaseModel):
|
|
21
|
-
number_of_chars: str
|
|
22
|
-
Explanation: str
|
|
23
|
-
|
|
24
|
-
class SpamTriggers(BaseModel):
|
|
25
|
-
Triggers: List[str]
|
|
26
|
-
Explanation: str
|
|
27
|
-
|
|
28
|
-
class AllCapsWords(BaseModel):
|
|
29
|
-
Words: List[str]
|
|
30
|
-
Impact: str
|
|
31
|
-
|
|
32
|
-
class Emojis(BaseModel):
|
|
33
|
-
Recommendation: str
|
|
34
|
-
Explanation: str
|
|
35
|
-
|
|
36
|
-
class EmailSubjectLineAnalysis(BaseModel):
|
|
37
|
-
Effectiveness_Score: EffectivenessScore
|
|
38
|
-
Scannability_Score: ScannabilityScore
|
|
39
|
-
Sentiment_Analysis: SentimentAnalysis
|
|
40
|
-
Length_Analysis: LengthAnalysis
|
|
41
|
-
Spam_Triggers: SpamTriggers
|
|
42
|
-
All_Caps_Words: AllCapsWords
|
|
43
|
-
Emojis: Emojis
|
|
44
|
-
Suggested_Preview_Text: List[str]
|
|
45
|
-
Alternative_Subject_Lines: List[str]
|
|
46
|
-
|
|
47
|
-
# Create primary and secondary LLM instances
|
|
48
|
-
primary_llm = LLM.create(
|
|
49
|
-
provider=LLMProvider.ANTHROPIC,
|
|
50
|
-
model_name="claude-3-opus-latest",
|
|
51
|
-
verbose=True
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
secondary_llm = LLM.create(
|
|
55
|
-
provider=LLMProvider.OPENAI,
|
|
56
|
-
model_name="gpt-4o",
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
# Create ReliableLLM instance
|
|
60
|
-
reliable_llm = ReliableLLM(primary_llm=primary_llm, secondary_llm=secondary_llm, verbose=True)
|
|
61
|
-
|
|
62
|
-
# Test prompt
|
|
63
|
-
subject_line_grader_prompt = """
|
|
64
|
-
You are a professional email subject line copywriter tasked with analyzing and providing feedback on a given subject line. Your analysis should be thorough, considering multiple factors to ensure the best possible subject line optimization.
|
|
65
|
-
|
|
66
|
-
Here is the information you need to analyze:
|
|
67
|
-
|
|
68
|
-
<subject_line>
|
|
69
|
-
{subject_line}
|
|
70
|
-
</subject_line>
|
|
71
|
-
|
|
72
|
-
<email_type>
|
|
73
|
-
{email_type}
|
|
74
|
-
</email_type>
|
|
75
|
-
|
|
76
|
-
<is_time_sensitive>
|
|
77
|
-
{is_time_sensitive}
|
|
78
|
-
</is_time_sensitive>
|
|
79
|
-
|
|
80
|
-
<is_followup>
|
|
81
|
-
{is_followup}
|
|
82
|
-
</is_followup>
|
|
83
|
-
|
|
84
|
-
<is_series>
|
|
85
|
-
{is_series}
|
|
86
|
-
</is_series>
|
|
87
|
-
|
|
88
|
-
Please analyze the subject line considering the following aspects:
|
|
89
|
-
1. Effectiveness
|
|
90
|
-
2. Scannability
|
|
91
|
-
3. Sentiment
|
|
92
|
-
4. Length
|
|
93
|
-
5. Spam Triggers
|
|
94
|
-
6. All Caps Words
|
|
95
|
-
7. Emoji Usage
|
|
96
|
-
"""
|
|
97
|
-
|
|
98
|
-
# Format the prompt with test data
|
|
99
|
-
generated_prompt = subject_line_grader_prompt.format(
|
|
100
|
-
subject_line="3 seo tips",
|
|
101
|
-
email_type="Newsletter",
|
|
102
|
-
is_time_sensitive="No",
|
|
103
|
-
is_followup="No",
|
|
104
|
-
is_series="No"
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
# Generate model using ReliableLLM
|
|
108
|
-
model_response, used_provider = generate_pydantic_json_model_reliable(
|
|
109
|
-
model_class=EmailSubjectLineAnalysis,
|
|
110
|
-
prompt=generated_prompt,
|
|
111
|
-
reliable_llm=reliable_llm,
|
|
112
|
-
max_retries=2,
|
|
113
|
-
max_tokens=4096,
|
|
114
|
-
system_prompt="Generate in English Language"
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
print("Response from ReliableLLM using provider:", used_provider)
|
|
118
|
-
print(model_response)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_agent_in_team.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_human_in_loop_agent.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_planning_agent.py
RENAMED
|
File without changes
|
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_react_agent.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_reflection_agent.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/core_tool_calling_agent.py
RENAMED
|
File without changes
|
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/agents_deprecated/pandas_agent_exp.py
RENAMED
|
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
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/anthropic_wrapper.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/deepseek_wrapper.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/gemini_wrapper.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/ollama_wrapper.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm/wrappers/openai_wrapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/anthropic_llm.py
RENAMED
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/deepseek_llm.py
RENAMED
|
File without changes
|
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/llm_response_models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simplerllm-0.3.1.10 → simplerllm-0.3.1.11}/SimplerLLM/language/llm_providers/transformers_llm.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|