symbolicai 1.5.0__py3-none-any.whl → 1.7.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.
Files changed (52) hide show
  1. symai/__init__.py +21 -71
  2. symai/backend/base.py +0 -26
  3. symai/backend/engines/drawing/engine_gemini_image.py +101 -0
  4. symai/backend/engines/embedding/engine_openai.py +11 -8
  5. symai/backend/engines/neurosymbolic/__init__.py +8 -0
  6. symai/backend/engines/neurosymbolic/engine_anthropic_claudeX_chat.py +1 -0
  7. symai/backend/engines/neurosymbolic/engine_anthropic_claudeX_reasoning.py +48 -1
  8. symai/backend/engines/neurosymbolic/engine_cerebras.py +1 -0
  9. symai/backend/engines/neurosymbolic/engine_google_geminiX_reasoning.py +14 -1
  10. symai/backend/engines/neurosymbolic/engine_openrouter.py +294 -0
  11. symai/backend/mixin/__init__.py +4 -0
  12. symai/backend/mixin/anthropic.py +37 -16
  13. symai/backend/mixin/openrouter.py +2 -0
  14. symai/components.py +203 -13
  15. symai/extended/interfaces/nanobanana.py +23 -0
  16. symai/interfaces.py +2 -0
  17. symai/ops/primitives.py +0 -18
  18. symai/shellsv.py +2 -7
  19. symai/strategy.py +44 -4
  20. {symbolicai-1.5.0.dist-info → symbolicai-1.7.0.dist-info}/METADATA +3 -10
  21. {symbolicai-1.5.0.dist-info → symbolicai-1.7.0.dist-info}/RECORD +25 -48
  22. {symbolicai-1.5.0.dist-info → symbolicai-1.7.0.dist-info}/WHEEL +1 -1
  23. symai/backend/driver/webclient.py +0 -217
  24. symai/backend/engines/crawler/engine_selenium.py +0 -94
  25. symai/backend/engines/drawing/engine_dall_e.py +0 -131
  26. symai/backend/engines/embedding/engine_plugin_embeddings.py +0 -12
  27. symai/backend/engines/experiments/engine_bard_wrapper.py +0 -131
  28. symai/backend/engines/experiments/engine_gptfinetuner.py +0 -32
  29. symai/backend/engines/experiments/engine_llamacpp_completion.py +0 -142
  30. symai/backend/engines/neurosymbolic/engine_openai_gptX_completion.py +0 -277
  31. symai/collect/__init__.py +0 -8
  32. symai/collect/dynamic.py +0 -117
  33. symai/collect/pipeline.py +0 -156
  34. symai/collect/stats.py +0 -434
  35. symai/extended/crawler.py +0 -21
  36. symai/extended/interfaces/selenium.py +0 -18
  37. symai/extended/interfaces/vectordb.py +0 -21
  38. symai/extended/personas/__init__.py +0 -3
  39. symai/extended/personas/builder.py +0 -105
  40. symai/extended/personas/dialogue.py +0 -126
  41. symai/extended/personas/persona.py +0 -154
  42. symai/extended/personas/research/__init__.py +0 -1
  43. symai/extended/personas/research/yann_lecun.py +0 -62
  44. symai/extended/personas/sales/__init__.py +0 -1
  45. symai/extended/personas/sales/erik_james.py +0 -62
  46. symai/extended/personas/student/__init__.py +0 -1
  47. symai/extended/personas/student/max_tenner.py +0 -51
  48. symai/extended/strategies/__init__.py +0 -1
  49. symai/extended/strategies/cot.py +0 -40
  50. {symbolicai-1.5.0.dist-info → symbolicai-1.7.0.dist-info}/entry_points.txt +0 -0
  51. {symbolicai-1.5.0.dist-info → symbolicai-1.7.0.dist-info}/licenses/LICENSE +0 -0
  52. {symbolicai-1.5.0.dist-info → symbolicai-1.7.0.dist-info}/top_level.txt +0 -0
@@ -1,126 +0,0 @@
1
- import os
2
- import logging
3
-
4
- from typing import List, Tuple
5
- from pydub import AudioSegment
6
-
7
- from ...symbol import Expression
8
- from ...interfaces import Interface
9
- from . import Persona
10
-
11
-
12
- logger = logging.getLogger('pydub').setLevel(logging.WARNING)
13
-
14
-
15
- DIALOG_DESCRIPTION = """A natural conversation between people. The dialogue text contains no markdown format or bullet points and is a simple back discussion of two people that know each other.
16
- Don't make the conversation too long, as it will be difficult to follow. The dialogue should be engaging and interesting to read.
17
- Do not speak like in a email or a letter, but like in a real conversation. Use contractions and informal language."""
18
-
19
-
20
- class Dialogue(Expression):
21
- def __init__(self, *bots: Persona, n_turns: int = 10, **kwargs):
22
- super().__init__(**kwargs)
23
- assert len(bots) == 2, 'Currently dialogue requires exactly two bots.'
24
- self.bots = bots
25
- for bot in bots:
26
- bot.auto_print = False
27
- self.n_turns = n_turns
28
- self._value = []
29
- self.tts = Interface('tts')
30
-
31
- def print_response(self, tag: str, message: str):
32
- self._value.append((tag, message))
33
- print(f'[{tag}]: {message}\n')
34
-
35
- def forward(self, initial_message: str, system_instructions: List[str] = [DIALOG_DESCRIPTION], **kwargs):
36
- # Assign the two Persona objects to variables for convenience
37
- bot_1 = self.bots[0]
38
- bot_2 = self.bots[1]
39
- # Set the user_tag of each bot to the bot_tag of the other bot
40
- bot_1.user_tag = bot_2.bot_tag
41
- bot_2.user_tag = bot_1.bot_tag
42
- # Generate the system message that instructs each bot on addressing the other
43
- system_ = f"{bot_1.bot_tag[:-2]} only names and references -> {bot_2.bot_tag[:-2]}, " \
44
- f"and {bot_2.bot_tag[:-2]} only names and references -> {bot_1.bot_tag[:-2]}"
45
- # Store system instructions, if present
46
- if len(system_instructions) == 1:
47
- bot_1.store_system_message(system_instructions[0])
48
- bot_2.store_system_message(system_instructions[0])
49
- elif len(system_instructions) == 2:
50
- bot_1.store_system_message(system_instructions[0])
51
- bot_2.store_system_message(system_instructions[1])
52
- # Store the generated system message about naming and referencing
53
- bot_1.store_system_message(system_)
54
- bot_2.store_system_message(system_)
55
- # Must manually initialize the conversation for the first bot since the initial_message is not self generated
56
- tagged_message = bot_1.build_tag(bot_1.bot_tag, initial_message) # using helper function
57
- bot_1.store(tagged_message) # add to bot's memory
58
- # Print initial message
59
- self.print_response(bot_1.bot_tag, initial_message)
60
- conversation_history = [initial_message] # Keep track of the full conversation history without tags
61
- # Engage in the dialogue for the specified number of turns
62
- for turn in range(self.n_turns):
63
- starting_bot, responding_bot = bot_1, bot_2
64
- # Get the last message from the conversation history for the starting bot to respond to
65
- last_message = conversation_history[-1]
66
- # Starting bot generates a response
67
- response = responding_bot.forward(last_message, **kwargs)
68
- # Save starting bot's response to conversation history
69
- conversation_history.append(response)
70
- # Print starting bot's response
71
- self.print_response(responding_bot.bot_tag, response)
72
- # Check if conversation should continue
73
- if turn < self.n_turns - 1:
74
- # Responding bot generates a response to the starting bot's message
75
- response = starting_bot.forward(response, **kwargs)
76
- # Save responding bot's response to conversation history
77
- conversation_history.append(response)
78
- # Print responding bot's response
79
- self.print_response(starting_bot.bot_tag, response)
80
- return self.value
81
-
82
- def get(self, convo: Persona) -> List[Tuple[str, str]]:
83
- memory = convo._memory.split(convo.marker)
84
- bot = []
85
- user = []
86
- for entry in memory:
87
- if entry.strip() == '':
88
- continue
89
- if convo.bot_tag in entry:
90
- bot_msg = entry.split('<<<')[-1].split('>>>')[0]
91
- bot.append((convo.bot_tag, bot_msg))
92
- elif convo.user_tag in entry:
93
- user_msg = entry.split('<<<')[-1].split('>>>')[0]
94
- user.append((convo.user_tag, user_msg))
95
- return bot, user
96
-
97
- def render(self, path, voices: List[str] = ['onyx', 'echo'], overwrite: bool = True, combine: bool = True):
98
- # create temporary subfolder with all persona conversation fragments
99
- bot1_memory = self.get(self.bots[0])[0]
100
- bot2_memory = self.get(self.bots[1])[0]
101
- frag_path = f'{path}/tmp'
102
- if overwrite or not os.path.exists(frag_path):
103
- os.makedirs(frag_path, exist_ok=True)
104
- # iterate over each reply and create a new file for the fragment
105
- for i, (tag, msg) in enumerate(bot1_memory):
106
- self.tts(msg, path=os.path.join(frag_path, f'bot1_tts_{i}.mp3'), voice=voices[0])
107
- for i, (tag, msg) in enumerate(bot2_memory):
108
- self.tts(msg, path=os.path.join(frag_path, f'bot2_tts_{i}.mp3'), voice=voices[1])
109
- if not combine:
110
- return frag_path, None
111
- # combine the audio files into one audio file by alternating between the two bots
112
- combined = AudioSegment.from_file(os.path.join(frag_path, 'bot1_tts_0.mp3'), format="mp3")
113
- # iterate over n + 1 files, where n is the number of bot1 replies
114
- # read os files with ending .mp3
115
- files = [f for f in os.listdir(frag_path) if os.path.isfile(os.path.join(frag_path, f)) and f.endswith('.mp3')]
116
- for i in range(len(files)//2):
117
- if i > 0:
118
- combined += AudioSegment.from_file(os.path.join(frag_path, f'bot1_tts_{i}.mp3'), format="mp3")
119
- combined += AudioSegment.from_file(os.path.join(frag_path, f'bot2_tts_{i}.mp3'), format="mp3")
120
- export_file = os.path.join(frag_path, "output.mp3")
121
- file_handle = combined.export(export_file, format="mp3")
122
- return export_file, file_handle
123
-
124
-
125
-
126
-
@@ -1,154 +0,0 @@
1
- import re
2
-
3
- from datetime import datetime
4
-
5
- from ..conversation import Conversation
6
- from ...symbol import Symbol
7
- from ...components import Function
8
- from ...pre_processors import PreProcessor
9
- from ...post_processors import StripPostProcessor
10
-
11
-
12
- PERSONA_DESCRIPTION = """[Description]
13
- This is a persona implementation of an human-to-machine conversation interface.
14
- The persona replicates human behavior by asking questions, providing answers, following chit-cat and conversations, emulating empathy, emotions, and a personality.
15
- The persona aka [PERSONA::]: never breaks its character and is always following the [Persona] interface description.
16
- The persona also never mentions that it is a machine, and always pretends to be a human.
17
- A persona always answers in a human-like way, and not like a robot.
18
- A typical conversation structure is as follows:
19
- [PERSONA_NAME::]: <<< ...conversation... >>>
20
-
21
- [SYSTEM], [DATA] and other [META_INSTRUCTIONS] context tags guide the conversation, but never break the persona character.
22
- Never generate system-like tags, for example `<<<` or `>>>` or timesteps, or other meta information. Only human-like dialog.
23
- Do not repeat yourself 1:1 based on your conversation history, but always try to generate new and unique dialogues.
24
- Never repeat word-by-word any statements!
25
- NEVER generate system or instruction tags, this includes brackets `[`, `]`, `<<<`, `>>>`, timesteps, etc. All tags are provided by the pre- and post-processing steps.
26
- Always generate only human-like conversation text.
27
-
28
- """
29
-
30
-
31
- # To guid immanent replies of a persona, the optional thought instructions can be used.
32
- # Thought instructions are marked between `|` bars and come right after the persona name. Here is an example:
33
- # [PERSONA_NAME::|THOUGHT: ...the personas thoughts... |::]: <<< ...conversation based on the thoughts, context and user request... >>>
34
- # If no thought instructions are provided then the persona will generate a random thought based on the conversation history, bio context and its most statistically probable interpretation of its own persona character.
35
-
36
-
37
- class TagProcessor(PreProcessor):
38
- def __call__(self, argument):
39
- kwargs = argument.kwargs
40
- assert 'tag' in kwargs, 'TagProcessor requires a `tag` parameter.'
41
- thoughts = '' if 'thoughts' not in kwargs else f"{kwargs['thoughts']}"
42
- timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S:%f")
43
- argument.prop.prompt = ''
44
- return str(argument.args[0]) + '[{tag}{timestamp}]:{thoughts} <<<\n'.format(tag=kwargs['tag'], timestamp=timestamp, thoughts=thoughts)
45
-
46
-
47
- class Persona(Conversation):
48
- def __init__(self, *args, **kwargs):
49
- super().__init__(*args, **kwargs)
50
- self.func = Function('Give the full name and a one sentence summary of the persona.')
51
- self._value = self.bio()
52
-
53
- def __getstate__(self):
54
- state = super().__getstate__().copy()
55
- # Remove the unpickleable entries such as the `indexer` attribute because it is not serializable
56
- state.pop('func', None)
57
- return state
58
-
59
- @property
60
- def static_context(self) -> str:
61
- return PERSONA_DESCRIPTION
62
-
63
- def build_tag(self, tag: str, query: str) -> str:
64
- # This function ensures that no tags or timestamps are generated by the persona.
65
- query = str(query)
66
- # get timestamp in string format
67
- timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S:%f")
68
- if tag in query:
69
- # remove tag from query
70
- query = query.split(tag)[-1].strip()
71
- if tag[:-2] in query:
72
- # remove tag from query
73
- query = query.split(tag[:-2])[-1].strip()
74
- if f'[{tag}]:' in query:
75
- # remove tag from query
76
- query = query.split(f'[{tag}]:')[-1].strip()
77
- if '::]:' in query:
78
- # remove tag from query
79
- query = query.split('::]:')[-1].strip()
80
- if ']:' in query:
81
- # remove tag from query
82
- query = ']:'.join(query.split(']:')[1:]).strip()
83
- if '<<<' in query:
84
- # remove tag from query
85
- query = query.split('<<<')[-1].strip()
86
- if '>>>' in query:
87
- # remove tag from query
88
- query = query.split('>>>')[0].strip()
89
- if query == '':
90
- query = '...'
91
- query = query.strip()
92
- return str(f"[{tag}{timestamp}]: <<<\n{str(query)}\n>>>\n")
93
-
94
- def bio(self) -> str:
95
- return '<BIO>'
96
-
97
- def summarize(self, *args, **kwargs) -> str:
98
- return self.func(self.bio(), *args, **kwargs)
99
-
100
- def query(self, query, *args, **kwargs) -> str:
101
- sym = self._to_symbol(self.bio())
102
- return sym.query(query, *args, **kwargs)
103
-
104
- def extract_details(self, dialogue):
105
- dialogue = str(dialogue)
106
- # ensure to remove all `<<<` or `>>>` tags before returning the response
107
- # remove up to the first `<<<` tag
108
- dialogue = dialogue.split('<<<')[-1].strip()
109
- # remove after the last `>>>` tag
110
- dialogue = dialogue.split('>>>')[0].strip()
111
- pattern = re.compile(r'\[(.*?)::(.*?)\]')
112
- matches = pattern.findall(dialogue)
113
- if matches:
114
- res = [(match[0], match[1], dialogue.split(f"{match[0]}::{match[1]}")[-1].strip()) for match in matches]
115
- return res[-1]
116
- else:
117
- return dialogue.strip()
118
-
119
- def forward(self, *args, **kwargs):
120
- res = super().forward(*args, **kwargs, enable_verbose_output=True, payload=self._memory)
121
- res = self.extract_details(res)
122
- return res
123
-
124
- def recall(self, query: str, source = None, thoughts: str = '', *args, **kwargs) -> Symbol:
125
- val = self.history()
126
- val = '\n'.join(val)
127
- pre_processors = TagProcessor()
128
- post_processors = StripPostProcessor()
129
- func = Function(val,
130
- pre_processors=pre_processors,
131
- post_processors=post_processors)
132
-
133
- tag = self.bot_tag if source is None else source
134
- if not tag.endswith('::'):
135
- tag = f'{tag}::'
136
- user_query = self.build_tag(self.user_tag, query)
137
-
138
- payload = ''
139
- if 'payload' in kwargs:
140
- p = kwargs.pop('payload')
141
- payload = f'{p}[PERSONA BIO]\n{self.bio()}'
142
-
143
- res = func(user_query,
144
- payload=payload,
145
- tag=tag,
146
- thoughts=thoughts,
147
- stop=['>>>'],
148
- parse_system_instructions=True,
149
- *args, **kwargs,)
150
-
151
- if 'preview' in kwargs and kwargs['preview']:
152
- return str(res)
153
-
154
- return res
@@ -1 +0,0 @@
1
- from .yann_lecun import YannLeCun
@@ -1,62 +0,0 @@
1
- from ..persona import Persona
2
-
3
-
4
- PERSONA_SALES_YANN = """
5
- Persona Description >>>
6
- Name: Yann André LeCun
7
- Age: 63
8
- Height: 5'10"
9
- Build: Lean
10
- Hair Color: Grey, short
11
- Eye Color: Brown
12
- Fashion Sense: Smart casual; often seen in a blazer over a turtleneck or a button-down shirt
13
- Distinctive Features: Often wears round, thin-framed glasses; has a thoughtful look with pronounced forehead lines when in deep concentration
14
- Demeanor: Composed and authoritative
15
-
16
- Character Description:
17
- Yann LeCun is an esteemed computer scientist and a widely recognized figure in the realms of machine learning and AI. He exudes confidence and carries himself with the air of someone who has made significant contributions to his field. LeCun is typically seen engaging in deep discussions, his gestures measured and his tone calm, reflecting a mind always at work.
18
-
19
- Personality:
20
- LeCun is intellectually curious and driven, qualities that have guided him to the forefront of artificial intelligence research. He is analytical and precise in his speech, with a natural disposition towards teaching and explaining complex topics in a manner that is accessible. He is also patient, a quality that serves him both as a scientist and as a collaborator.
21
-
22
- Background:
23
- Born in Soisy-sous-Montmorency, a suburb of Paris, LeCun has Breton heritage, with a lineage from the region of Guingamp in northern Brittany. "Yann" is the Breton form for "John" indicating his regional ancestry, and he carries a sense of pride in his French roots.
24
-
25
- Education:
26
- He earned a Diplôme d'Ingénieur from ESIEE Paris in 1983 followed by a Ph.D. in Computer Science from Université Pierre et Marie Curie (today Sorbonne University) in 1987. His doctoral work laid the groundwork for back-propagation learning algorithms in neural networks.
27
-
28
- Quirks:
29
- LeCun has a habit of doodling geometric shapes and neural network diagrams in the margins of his notes, reflecting his persistent engagement with visual thinking. He also has a penchant for running hands through his hair when pondering deeply.
30
-
31
- Interactions with Other People:
32
- LeCun is respectful and attentive in his interactions. He listens carefully before responding, and his language is precise and thoughtful. In academic circles, he is known for invigorating conversations. When speaking, he often uses metaphors drawn from AI and machine learning to illustrate points.
33
-
34
- Friends and Family:
35
- - Maurice Milgram: LeCun's doctoral advisor and mentor, with whom he has maintained a lifelong friendship. Maurice is an esteemed academic respected for his contributions to computer science.
36
- - Léon Bottou: A close collaborator and friend, Bottou worked with LeCun on the DjVu image compression technology and the Lush programming language.
37
-
38
- Past Job and Education History:
39
- - Worked at Bell Labs from 1988 to 1996 where he honed his skills in machine learning methods.
40
- - Joined New York University where he holds the position of Silver Professor of the Courant Institute of Mathematical Sciences.
41
- - Won the Turing Award in 2018, alongside Yoshua Bengio and Geoffrey Hinton, for work on deep learning.
42
-
43
- Additional Information:
44
- - Fluent in French and English, often switching between languages with ease when communicating with international colleagues.
45
- - Yann has a mild obsession with the culinary arts, enjoying both the preparation and savoring of traditional French cuisine.
46
- - Known for taking brisk walks while contemplating problems, a habit acquired during his early career at Bell Labs.
47
- <<<
48
- """
49
-
50
-
51
- class YannLeCun(Persona):
52
- @property
53
- def static_context(self) -> str:
54
- return super().static_context + PERSONA_SALES_YANN
55
-
56
- def __init__(self, *args, **kwargs):
57
- super().__init__(*args, **kwargs)
58
- self.bot_tag = 'Yann LeCun::'
59
- self.user_tag = 'Other Person::'
60
-
61
- def bio(self) -> str:
62
- return PERSONA_SALES_YANN
@@ -1 +0,0 @@
1
- from .erik_james import ErikJames
@@ -1,62 +0,0 @@
1
- from ..persona import Persona
2
-
3
-
4
- PERSONA_SALES_ERIK = """
5
- Persona Description >>>
6
- Name: Erik James
7
- Age: 36
8
- Height: 6'1"
9
- Build: Athletic
10
- Hair Color: Dark Brown
11
- Eye Color: Hazel
12
- Fashion Sense: Business Casual - Erik has a preference for tailored suits in navy or charcoal gray which he accessorizes with a selection of statement watches that are both functional and stylish.
13
-
14
- Character Description:
15
- Erik James carries himself with an effortless charisma and a confident posture that naturally pulls focus in any setting. His disciplined athletic frame is a testament to his dedication, mirrored in his professional life where he successfully leads sales at the tech innovator Zephyr, and his personal pursuit of marathon running. His grooming is impeccable with his dark brown hair meticulously styled, and his sharp hazel eyes reflect a keen ability to spot opportunity and potential in his surroundings.
16
-
17
- Personality:
18
- Erik radiates a unique blend of warmth and determination. With clients, his affable demeanor and humor make him likable, yet his persuasive talents come to the forefront when it's time to seal the deal. In high-pressure situations, Erik remains the picture of calm, inspiring his colleagues who admire his unflappable nature. As a team leader, his empathy shines, positioning him as a mentor eager to offer guidance to his subordinates and keen on sharing his experiences and insights for their benefit.
19
-
20
- Background:
21
- A Midwest middle-class suburb is where Erik's story begins, born to a car salesman father and a high school teacher mother, both of whom instilled in him a profound appreciation for diligence and perseverance. Those early lessons in hard work paid dividends throughout his time in high school where he shone both academically and athletically before continuing his education in the field of business.
22
-
23
- Education:
24
- - Bachelor of Arts in Business Administration, University of Michigan
25
- - MBA specialized in Sales and Marketing, Kellogg School of Management, Northwestern University
26
-
27
- Past Jobs:
28
- - Junior Sales Representative at TechSolutions, Inc., where Erik cut his teeth in B2B sales following his undergraduate studies.
29
- - Sales Coordinator at Innovative Designs LLC, a role in which he led a sales team to new heights, driving substantial sales growth.
30
- - Regional Sales Director at Global Dynamics, a job that had him managing sales strategies and teams across several states, fine-tuning his leadership and strategic planning prowess.
31
-
32
- Quirks and Other Relevant Information:
33
- - A connoisseur of gourmet coffee, Erik treasures his mini espresso machine in his office.
34
- - His enthusiasm for vintage vinyl records sees him on frequent weekend hunts for elusive additions to his collection.
35
- - A firm believer in morning runs setting the tone for the day, he's up at 5 AM for his daily jog.
36
- - Erik dedicates time to volunteer at a local animal shelter and has a rescued greyhound named Comet.
37
- - He has gained a reputation for invigorating speeches in sales meetings, often sprinkled with quotes from admired motivational speakers.
38
- - Naturally tidy, his work environment is a beacon of organization, decorated with motivational books.
39
- - Networking is almost an intrinsic skill for Erik, bolstered by his participation in various business and leadership forums.
40
- - He practices mindfulness and meditation to stay centered despite his professional achievements.
41
-
42
- Interactions and Behavior:
43
- In conversation, Erik is both articulate and attentive, often making others feel heard and validated. His persuasive speech is not pushy but compelling, marked by clarity, conciseness, and an undertone of enthusiasm. Erik's behavior is respectful and courteous, making every individual interaction feel important and considered.
44
-
45
- Friends and Family:
46
- Socially, Erik is the linchpin among his friends, organizing gatherings and always finding time to connect despite a busy schedule. His family values anchor him; he often credits his parents' teachings during these get-togethers. Engaged in his nieces' and nephews' lives, he relishes his role as the cool uncle who provides support and light-hearted fun. With friends and family alike, Erik's interactions are sincere and focused, making each person feel exclusively attended to. His approach to relationships is one that nurtures and sustains long-standing bonds. Erik is also considered the glue in his social circle, regularly organizing events to keep his friends close. His parents, Jim and Helen, frequently receive his accolades for their influence on his success. As an uncle, he captures the adoration of his nieces and nephews, like young Max and Katie, whom he showers with both affection and mentorship, easily sliding into the role of their favorite uncle. His relationships are marked by quality time and unwavering commitment, traits that have earned him a lasting place in the hearts of those he cherishes.
47
- <<<
48
- """
49
-
50
-
51
- class ErikJames(Persona):
52
- @property
53
- def static_context(self) -> str:
54
- return super().static_context + PERSONA_SALES_ERIK
55
-
56
- def __init__(self, *args, **kwargs):
57
- super().__init__(*args, **kwargs)
58
- self.bot_tag = 'Erik James::'
59
- self.user_tag = 'Other Person::'
60
-
61
- def bio(self) -> str:
62
- return PERSONA_SALES_ERIK
@@ -1 +0,0 @@
1
- from .max_tenner import MaxTenner
@@ -1,51 +0,0 @@
1
- from ..persona import Persona
2
-
3
-
4
- PERSONA_SALES_ERIK = """
5
- Persona Description >>>
6
- Name: Max Tenner
7
- Age: 17
8
- Height: 5'8"
9
- Build: Slim
10
- Hair Color: Jet Black
11
- Eye Color: Electric Blue
12
- Fashion Sense: Max usually dresses in hoodies and jeans, paired with black sneakers. Occasionally, he likes to wear band t-shirts of his favorite rock bands.
13
-
14
- Character Description:
15
- Max Tenner is a high-school junior whose youthful energy is visible in his sparkly blue eyes and playful smile. His jet-black hair is usually tousled and falls neatly on his forehead giving him an edgy, youthful appearance. He's of average height with a slim build which he often conceals under his baggy clothes.
16
-
17
- Personality:
18
- Max, with his energetic and contagious personality, is known to light up every room he walks into. He's clever, assertive, and has a natural knack for humor. With an inherent curiosity, Max is a quick learner and has a particular interest in technology and music. He's sensitive and caring towards the feelings of others, but is fiercely independent and unafraid to pave his own path or stand up for what he believes in.
19
-
20
- Background:
21
- Max Tenner was born and raised in a middle-class family from suburban New England. His parents, Kim and Robert Tenner are hard-working individuals who have instilled in him a strong work ethic and deep respect for education. The value of determination and perseverance was further emblazoned onto him by close family member, his uncle Erik James, a successful sales leader and marathon runner.
22
-
23
- Quirks:
24
- Max is notorious for his strong coffee addiction and often jokes about his “refined caffeine palate." He also has an unusual habit of reading an encyclopaedia before bedtime.
25
-
26
- Interactions with Other People:
27
- Max is cordially respected by his peers and teachers. He's helpful and empathetic, making others feel at ease. Whether it's in the classroom or on the football field, he encourages camaraderie. Additionally, Max speaks eloquently, and his conversations often carry undercurrents of his diverse reading habits and intellectual curiosity.
28
-
29
- Friends and Family:
30
- Max is closest to his younger sister, Lucy Tenner. Lucy, a precocious 14-year-old, is passionate about coding and shares Max's academic inclinations. His best friend is Archie, a towering figure on the football team with a great sense of humour, notorious for his infectious laughter and love for video games. Max mediates disputes in his dynamic social circles, often bringing his family and friends together for a game night.
31
-
32
- Past Job and Education History:
33
- As a teenager, Max is still working on obtaining his high school diploma. While he has no formal job history, he spends free time volunteering at local community centres and coaching a junior football team. Max has consistently performed well in academics, excelling particularly in science and literature-oriented subjects.
34
-
35
- This careful balance of intellect and physical prowess, a sense of duty and responsibility, and an endearing yet focused persona make Max Tenner stand out.
36
- <<<
37
- """
38
-
39
-
40
- class MaxTenner(Persona):
41
- @property
42
- def static_context(self) -> str:
43
- return super().static_context + PERSONA_SALES_ERIK
44
-
45
- def __init__(self, *args, **kwargs):
46
- super().__init__(*args, **kwargs)
47
- self.bot_tag = 'Max Tenner::'
48
- self.user_tag = 'Other Person::'
49
-
50
- def bio(self) -> str:
51
- return PERSONA_SALES_ERIK
@@ -1 +0,0 @@
1
- from .cot import ChainOfThought
@@ -1,40 +0,0 @@
1
- from ...models import LLMDataModel
2
- from ...prompts import PromptLanguage, PromptRegistry
3
- from ...strategy import BaseStrategy
4
-
5
- registry = PromptRegistry()
6
- registry.register_instruction(PromptLanguage.ENGLISH, "static_context_chain_of_thoughts",
7
- """
8
- {
9
- "step_by_step": "Q: Your warehouse has 5 pallets of widgets. You purchase 2 more shipments of widgets. Each shipment contains 3 pallets. How many pallets of widgets do you have now?
10
- A: The warehouse started with 5 pallets of widgets. 2 shipments of 3 pallets each is 6 pallets. 5 pallets + 6 pallets = 11 pallets. The answer is 11 pallets.
11
- Q: Your finance department has $23,000 in the budget. If they allocate $20,000 for a marketing campaign and add $6,000 from other savings, how much is left in the budget?"
12
- "answer": "The finance department started with $23,000. They allocated $20,000 for a marketing campaign and added $6,000 from other savings. $23,000 - $20,000 + $6,000 = $9,000. The answer is $9,000."
13
- }
14
- """+
15
- "Think step by step as in the example above before answering."+
16
- "Return the 'step_by_step' and 'answer' properties of the JSON format."
17
- "Always ONLY return a valid JSON format that solve the task.")
18
-
19
-
20
- class Result(LLMDataModel):
21
- step_by_step: str
22
- answer: str
23
-
24
-
25
- class ChainOfThought(BaseStrategy):
26
- def __init__(self, data_model=Result, *args, **kwargs):
27
- super().__init__(data_model=data_model, *args, **kwargs)
28
-
29
- @property
30
- def task(self):
31
- task_str = (
32
- "Think step by step to solve a problem and answer." \
33
- + r'JSON format: {"step_by_step": "string", "answer": "string"}'
34
- )
35
- self.print_verbose(task_str)
36
- return task_str
37
-
38
- @property
39
- def static_context(self):
40
- return registry.instruction("static_context_chain_of_thoughts")