PraisonAI 0.0.57__py3-none-any.whl → 0.0.58__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.

Potentially problematic release.


This version of PraisonAI might be problematic. Click here for more details.

praisonai/deploy.py CHANGED
@@ -56,7 +56,7 @@ class CloudDeployer:
56
56
  file.write("FROM python:3.11-slim\n")
57
57
  file.write("WORKDIR /app\n")
58
58
  file.write("COPY . .\n")
59
- file.write("RUN pip install flask praisonai==0.0.57 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==0.0.58 gunicorn markdown\n")
60
60
  file.write("EXPOSE 8080\n")
61
61
  file.write('CMD ["gunicorn", "-b", "0.0.0.0:8080", "api:app"]\n')
62
62
 
praisonai/ui/context.py CHANGED
@@ -97,17 +97,36 @@ class ContextGatherer:
97
97
  return modified_ignore_patterns
98
98
 
99
99
  def get_include_paths(self):
100
+ """
101
+ Loads include paths from:
102
+ 1. .praisoninclude (includes ONLY files/directories listed)
103
+ 2. .praisoncontext (if .praisoninclude doesn't exist, this is used
104
+ to include all other relevant files, excluding ignore patterns)
105
+ """
100
106
  include_paths = []
101
-
102
- # 1. Load from .praisoninclude
103
- include_file = os.path.join(self.directory, '.praisoninclude')
107
+ include_all = False # Flag to indicate if we need to include all files
108
+
109
+ include_file = os.path.join(self.directory, '.praisoncontext')
104
110
  if os.path.exists(include_file):
105
111
  with open(include_file, 'r') as f:
106
112
  include_paths.extend(
107
113
  line.strip() for line in f
108
114
  if line.strip() and not line.startswith('#')
109
115
  )
110
- return include_paths
116
+
117
+ # If .praisoncontext doesn't exist, fall back to .praisoninclude
118
+ # for including all relevant files
119
+ if not include_paths:
120
+ include_file = os.path.join(self.directory, '.praisoninclude')
121
+ if os.path.exists(include_file):
122
+ with open(include_file, 'r') as f:
123
+ include_paths.extend(
124
+ line.strip() for line in f
125
+ if line.strip() and not line.startswith('#')
126
+ )
127
+ include_all = True # Include all files along with specified paths
128
+
129
+ return include_paths, include_all
111
130
 
112
131
  def should_ignore(self, file_path):
113
132
  """
@@ -130,61 +149,78 @@ class ContextGatherer:
130
149
  any(file_path.endswith(ext) for ext in self.relevant_extensions)
131
150
 
132
151
  def gather_context(self):
133
- """Gather context from relevant files, respecting ignore patterns and include paths."""
152
+ """
153
+ Gather context from relevant files, respecting ignore patterns
154
+ and include options from .praisoninclude and .praisoncontext.
155
+ """
134
156
  context = []
135
157
  total_files = 0
136
158
  processed_files = 0
159
+ self.include_paths, include_all = self.get_include_paths()
137
160
 
138
- if not self.include_paths:
139
- # No include paths specified, process the entire directory
140
- for root, dirs, files in os.walk(self.directory):
141
- total_files += len(files)
142
- dirs[:] = [d for d in dirs if not self.should_ignore(os.path.join(root, d))]
143
- for file in files:
144
- file_path = os.path.join(root, file)
145
- if not self.should_ignore(file_path) and self.is_relevant_file(file_path):
146
- try:
147
- with open(file_path, 'r', encoding='utf-8') as f:
148
- content = f.read()
149
- context.append(f"File: {file_path}\n\n{content}\n\n{'='*50}\n")
150
- self.included_files.append(Path(file_path).relative_to(self.directory))
151
- except Exception as e:
152
- logger.error(f"Error reading {file_path}: {e}")
153
- processed_files += 1
154
- print(f"\rProcessed {processed_files}/{total_files} files", end="", flush=True)
155
- else:
156
- # Process specified include paths
161
+ def add_file_content(file_path):
162
+ """Helper function to add file content to context."""
163
+ try:
164
+ with open(file_path, 'r', encoding='utf-8') as f:
165
+ content = f.read()
166
+ context.append(
167
+ f"File: {file_path}\n\n{content}\n\n{'=' * 50}\n"
168
+ )
169
+ self.included_files.append(
170
+ Path(file_path).relative_to(self.directory)
171
+ )
172
+ except Exception as e:
173
+ logger.error(f"Error reading {file_path}: {e}")
174
+
175
+ def process_path(path):
176
+ """Helper function to process a single path (file or directory)."""
177
+ nonlocal total_files, processed_files
178
+ if os.path.isdir(path):
179
+ for root, dirs, files in os.walk(path):
180
+ total_files += len(files)
181
+ dirs[:] = [
182
+ d
183
+ for d in dirs
184
+ if not self.should_ignore(os.path.join(root, d))
185
+ ]
186
+ for file in files:
187
+ file_path = os.path.join(root, file)
188
+ if not self.should_ignore(file_path) and self.is_relevant_file(file_path):
189
+ add_file_content(file_path)
190
+ processed_files += 1
191
+ print(
192
+ f"\rProcessed {processed_files}/{total_files} files",
193
+ end="",
194
+ flush=True,
195
+ )
196
+ elif os.path.isfile(path) and self.is_relevant_file(path):
197
+ add_file_content(path)
198
+ processed_files += 1
199
+ print(
200
+ f"\rProcessed {processed_files}/1 files",
201
+ end="",
202
+ flush=True,
203
+ )
204
+
205
+ if include_all:
206
+ # Include ALL relevant files from the entire directory
207
+ process_path(self.directory)
208
+
209
+ # Include files from .praisoninclude specifically
210
+ for include_path in self.include_paths:
211
+ full_path = os.path.join(self.directory, include_path)
212
+ process_path(full_path)
213
+ elif self.include_paths:
214
+ # Include only files specified in .praisoncontext
157
215
  for include_path in self.include_paths:
158
216
  full_path = os.path.join(self.directory, include_path)
159
- if os.path.isdir(full_path):
160
- for root, dirs, files in os.walk(full_path):
161
- total_files += len(files)
162
- dirs[:] = [d for d in dirs if not self.should_ignore(os.path.join(root, d))]
163
- for file in files:
164
- file_path = os.path.join(root, file)
165
- if not self.should_ignore(file_path) and self.is_relevant_file(file_path):
166
- try:
167
- with open(file_path, 'r', encoding='utf-8') as f:
168
- content = f.read()
169
- context.append(f"File: {file_path}\n\n{content}\n\n{'='*50}\n")
170
- self.included_files.append(Path(file_path).relative_to(self.directory))
171
- except Exception as e:
172
- logger.error(f"Error reading {file_path}: {e}")
173
- processed_files += 1
174
- print(f"\rProcessed {processed_files}/{total_files} files", end="", flush=True)
175
- elif os.path.isfile(full_path) and self.is_relevant_file(full_path):
176
- try:
177
- with open(full_path, 'r', encoding='utf-8') as f:
178
- content = f.read()
179
- context.append(f"File: {full_path}\n\n{content}\n\n{'='*50}\n")
180
- self.included_files.append(Path(full_path).relative_to(self.directory))
181
- except Exception as e:
182
- logger.error(f"Error reading {full_path}: {e}")
183
- processed_files += 1
184
- print(f"\rProcessed {processed_files}/{total_files} files", end="", flush=True)
217
+ process_path(full_path)
218
+ else:
219
+ # No include options, process the entire directory
220
+ process_path(self.directory)
185
221
 
186
222
  print() # New line after progress indicator
187
- return '\n'.join(context)
223
+ return "\n".join(context)
188
224
 
189
225
  def count_tokens(self, text):
190
226
  """Count tokens using a simple whitespace-based tokenizer."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PraisonAI
3
- Version: 0.0.57
3
+ Version: 0.0.58
4
4
  Summary: PraisonAI application combines AutoGen and CrewAI or similar frameworks into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customization, and efficient human-agent collaboration.
5
5
  Author: Mervin Praison
6
6
  Requires-Python: >=3.10,<3.13
@@ -4,7 +4,7 @@ praisonai/agents_generator.py,sha256=8d1WRbubvEkBrW1HZ7_xnGyqgJi0yxmXa3MgTIqef1c
4
4
  praisonai/auto.py,sha256=9spTXqj47Hmmqv5QHRYE_RzSVHH_KoPbaZjskUj2UcE,7895
5
5
  praisonai/chainlit_ui.py,sha256=bNR7s509lp0I9JlJNvwCZRUZosC64qdvlFCt8NmFamQ,12216
6
6
  praisonai/cli.py,sha256=VaVEJlc8c_aE2SBY6xN7WIbHrqNcXGR2xrDzFAsD2B8,14504
7
- praisonai/deploy.py,sha256=qypJw8aLvCp82T9UD5DV4v8wgaHjMqeCaruAKzjYCag,6028
7
+ praisonai/deploy.py,sha256=cC-uc11Q3CFOxmk9F5vsFIviKEFe8o3IBCz78k7Xl_w,6028
8
8
  praisonai/inbuilt_tools/__init__.py,sha256=mUKnbL6Gram9c9f2m8wJwEzURBLmPEOcHzwySBH89YA,74
9
9
  praisonai/inbuilt_tools/autogen_tools.py,sha256=svYkM2N7DVFvbiwgoAS7U_MqTOD8rHf8VD3BaFUV5_Y,14907
10
10
  praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
@@ -24,7 +24,7 @@ praisonai/public/thriller.svg,sha256=2dYY72EcgbEyTxS4QzjAm37Y4srtPWEW4vCMFki98ZI
24
24
  praisonai/test.py,sha256=OL-wesjA5JTohr8rtr6kWoaS4ImkJg2l0GXJ-dUUfRU,4090
25
25
  praisonai/ui/chat.py,sha256=B4F1R7qP-0c-elg8WcRsYlr6-FkmHWtdunGIzU7WrDM,9321
26
26
  praisonai/ui/code.py,sha256=GcOr8lNah4AgI2RcIKmgjehzSl-KNu7x6UHrghixeaM,10095
27
- praisonai/ui/context.py,sha256=xLVyRa8UDy1HJyMa7RSFz0Lkq4qQ-E4pPLfgzP51_k8,11281
27
+ praisonai/ui/context.py,sha256=oWO2I_WBZb7kZnuXItf18EJX0ZQv-1nAd8rxhwhuuDU,11871
28
28
  praisonai/ui/public/fantasy.svg,sha256=4Gs3kIOux-pjGtw6ogI_rv5_viVJxnE5gRwGilsSg0o,1553
29
29
  praisonai/ui/public/game.svg,sha256=y2QMaA01m8XzuDjTOBWzupOC3-TpnUl9ah89mIhviUw,2406
30
30
  praisonai/ui/public/logo_dark.png,sha256=frHz1zkrnivGssJgk9iy1cabojkVgm8B4MllFwL_CnI,17050
@@ -33,8 +33,8 @@ praisonai/ui/public/movie.svg,sha256=aJ2EQ8vXZusVsF2SeuAVxP4RFJzQ14T26ejrGYdBgzk
33
33
  praisonai/ui/public/thriller.svg,sha256=2dYY72EcgbEyTxS4QzjAm37Y4srtPWEW4vCMFki98ZI,3163
34
34
  praisonai/ui/sql_alchemy.py,sha256=HsyeRq-G9qbQobHWpTJHHKQiT4FvYw_7iuv-2PNh0IU,27419
35
35
  praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
36
- praisonai-0.0.57.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
37
- praisonai-0.0.57.dist-info/METADATA,sha256=GpM64zyjRG9J-mF9JMJeCLPQz2STlzAE92cT9Q-9HUU,11126
38
- praisonai-0.0.57.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
39
- praisonai-0.0.57.dist-info/entry_points.txt,sha256=Qg41eW3A1-dvdV5tF7LqChfYof8Rihk2rN1fiEE3vnk,53
40
- praisonai-0.0.57.dist-info/RECORD,,
36
+ praisonai-0.0.58.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
37
+ praisonai-0.0.58.dist-info/METADATA,sha256=J2s1lws01jHcyUE3tcex4SkDKfys2BoyJT84GTM0iTc,11126
38
+ praisonai-0.0.58.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
39
+ praisonai-0.0.58.dist-info/entry_points.txt,sha256=Qg41eW3A1-dvdV5tF7LqChfYof8Rihk2rN1fiEE3vnk,53
40
+ praisonai-0.0.58.dist-info/RECORD,,