SimplerLLM 0.2.8__tar.gz → 0.3.0__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.2.8 → simplerllm-0.3.0}/PKG-INFO +1 -1
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/lwh_llm.py +2 -2
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/text_chunker.py +1 -1
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM.egg-info/PKG-INFO +1 -1
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM.egg-info/SOURCES.txt +0 -1
- {simplerllm-0.2.8 → simplerllm-0.3.0}/setup.py +1 -1
- simplerllm-0.2.8/tests/test_pydantic.py +0 -83
- {simplerllm-0.2.8 → simplerllm-0.3.0}/LICENSE +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_agent_in_team.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_human_in_loop_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_planning_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_rag_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_react_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_reflection_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/core_tool_calling_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/memory_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/pandas_agent_exp.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/agents/sql_agent_exp.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/image/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/image/img_helper_funcs.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/image/stability_ai.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/embeddings.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_addons.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/anthropic_llm.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/gemini_llm.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/llm_response_models.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/ollama_llm.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/openai_llm.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/transformers_llm.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/prompts/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/prompts/messages_template.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/prompts/prompt_builder.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/__init__.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/file_functions.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/file_loader.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/generic_loader.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/json_helpers.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/pandas_func.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/predefined_tools.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/python_func.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/rapid_api.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/serp.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/tools/web_crawler.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM.egg-info/dependency_links.txt +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM.egg-info/requires.txt +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM.egg-info/top_level.txt +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/setup.cfg +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_chunker.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_data_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_embed.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_generate.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_lwh.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_ollama.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_reAct_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_react_core_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_reflection_core_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_search_query.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_sql_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_tool.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_tool_agent.py +0 -0
- {simplerllm-0.2.8 → simplerllm-0.3.0}/tests/test_youtube_tool.py +0 -0
|
@@ -73,7 +73,7 @@ def generate_response(
|
|
|
73
73
|
|
|
74
74
|
if full_response:
|
|
75
75
|
return {
|
|
76
|
-
"generated_text": str(json.loads(response.text)["result"]).
|
|
76
|
+
"generated_text": str(json.loads(response.text)["result"]).strip('"'),
|
|
77
77
|
"model": model_name,
|
|
78
78
|
"process_time": time.time() - start_time,
|
|
79
79
|
"llm_provider_response": response.json(),
|
|
@@ -81,7 +81,7 @@ def generate_response(
|
|
|
81
81
|
|
|
82
82
|
else:
|
|
83
83
|
|
|
84
|
-
return str(json.loads(response.text)["result"]).
|
|
84
|
+
return str(json.loads(response.text)["result"]).strip('"')
|
|
85
85
|
|
|
86
86
|
except Exception as e:
|
|
87
87
|
print(f"Attempt {attempt + 1} failed: {e}")
|
|
@@ -6,7 +6,7 @@ import openai
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
8
|
from SimplerLLM.language.llm import LLM as llm_genetation_instance
|
|
9
|
-
from SimplerLLM.language.embeddings import
|
|
9
|
+
from SimplerLLM.language.embeddings import EmbeddingsLLM as llm_embeddings_instance
|
|
10
10
|
|
|
11
11
|
# from sklearn.metrics.pairwise import cosine_similarity
|
|
12
12
|
|
|
@@ -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.
|
|
14
|
+
version="0.3.0",
|
|
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,83 +0,0 @@
|
|
|
1
|
-
from SimplerLLM.language.llm_addons import generate_pydantic_json_model,generate_json_example_from_pydantic
|
|
2
|
-
from pydantic import BaseModel
|
|
3
|
-
from typing import List, Optional
|
|
4
|
-
from SimplerLLM.language.llm import (
|
|
5
|
-
LLM,
|
|
6
|
-
LLMProvider
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Email Subject Line Analyzer
|
|
11
|
-
class EffectivenessScore(BaseModel):
|
|
12
|
-
Score: int
|
|
13
|
-
Explanation: str
|
|
14
|
-
|
|
15
|
-
class ScannabilityScore(BaseModel):
|
|
16
|
-
Score: int
|
|
17
|
-
Explanation: str
|
|
18
|
-
|
|
19
|
-
class SentimentAnalysis(BaseModel):
|
|
20
|
-
Tone: str
|
|
21
|
-
Explanation: str
|
|
22
|
-
|
|
23
|
-
class SpamTriggers(BaseModel):
|
|
24
|
-
Triggers: List[str]
|
|
25
|
-
Explanation: str
|
|
26
|
-
|
|
27
|
-
class AllCapsWords(BaseModel):
|
|
28
|
-
Words: List[str]
|
|
29
|
-
Impact: str
|
|
30
|
-
|
|
31
|
-
class Emojis(BaseModel):
|
|
32
|
-
Recommendation: str
|
|
33
|
-
Explanation: str
|
|
34
|
-
|
|
35
|
-
class EmailSubjectLineAnalysis(BaseModel):
|
|
36
|
-
Effectiveness_Score: EffectivenessScore
|
|
37
|
-
Scannability_Score: ScannabilityScore
|
|
38
|
-
Sentiment_Analysis: SentimentAnalysis
|
|
39
|
-
Spam_Triggers: SpamTriggers
|
|
40
|
-
All_Caps_Words: AllCapsWords
|
|
41
|
-
Emojis: Emojis
|
|
42
|
-
Alternative_Subject_Lines: List[str]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
subject_line_analyzer_prompt = """As a professional email subject line copywriter, your task is to analyze and provide feedback on the given subject lines. You should evaluate each input subject line based on factors such as effectiveness, scannability, sentiment, spammy triggers, usage of all caps words, and emojis. After analyzing each aspect, provide a detailed report explaining what's wrong with the subject line and how it can be improved. Finally, offer a list of alternative subject lines that are more effective.
|
|
46
|
-
|
|
47
|
-
Input Subject Line: {subject}
|
|
48
|
-
|
|
49
|
-
For your analysis response, please follow this structure:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
1. Effectiveness Score (50-100): Provide an overall score for the effectiveness of the input subject line.
|
|
53
|
-
- Briefly explain your Effectiveness score here.
|
|
54
|
-
|
|
55
|
-
2. Scannability Score (1-10): Rate how easy it is for users to quickly understand the main message of the subject line.
|
|
56
|
-
- Briefly explain your Scannability score here.
|
|
57
|
-
|
|
58
|
-
3. Sentiment Analysis: Determine if the tone in the subject line is positive or negative.
|
|
59
|
-
- Briefly explain your Sentiment analysis here.
|
|
60
|
-
|
|
61
|
-
4. Spam Triggers: Identify any phrases or elements that might trigger spam filters and briefly discuss them.
|
|
62
|
-
|
|
63
|
-
5. All Caps Words: Note any words written in all capital letters and briefly discuss their impact on readers' perception of the email.
|
|
64
|
-
|
|
65
|
-
6. Emojis: Assess whether adding an emoji would enhance or detract from the effectiveness of the subject line and briefly explain why and suggest the best emoji to add.
|
|
66
|
-
|
|
67
|
-
7. Alternative Subject Lines:
|
|
68
|
-
Provide a list of 3-5 improved alternatives based on your analysis.
|
|
69
|
-
|
|
70
|
-
"""
|
|
71
|
-
|
|
72
|
-
llm=LLM.create(provider=LLMProvider.OPENAI,
|
|
73
|
-
model_name="gpt-4")
|
|
74
|
-
|
|
75
|
-
generated_prompt = subject_line_analyzer_prompt.format(subject="top 3 marketing tactics")
|
|
76
|
-
|
|
77
|
-
ai_response = generate_pydantic_json_model(model_class=EmailSubjectLineAnalysis, prompt=generated_prompt, llm_instance=llm,max_retries=1)
|
|
78
|
-
|
|
79
|
-
success = ai_response is not None and hasattr(ai_response, 'Effectiveness_Score')
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
#json_example = generate_json_example_from_pydantic(EmailSubjectLineAnalysis)
|
|
83
|
-
print(ai_response)
|
|
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
|
{simplerllm-0.2.8 → simplerllm-0.3.0}/SimplerLLM/language/llm_providers/llm_response_models.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
|