PraisonAI 2.0.67__cp313-cp313-manylinux_2_39_x86_64.whl → 2.0.69__cp313-cp313-manylinux_2_39_x86_64.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==2.0.67 gunicorn markdown\n")
59
+ file.write("RUN pip install flask praisonai==2.0.69 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/train.py CHANGED
@@ -230,7 +230,9 @@ class TrainModel:
230
230
  lr_scheduler_type="linear",
231
231
  seed=3407,
232
232
  output_dir="outputs",
233
- report_to="none",
233
+ report_to="none" if not os.getenv("PRAISON_WANDB") else "wandb",
234
+ save_steps=100 if os.getenv("PRAISON_WANDB") else None,
235
+ run_name=os.getenv("PRAISON_WANDB_RUN_NAME", "praisonai-train") if os.getenv("PRAISON_WANDB") else None,
234
236
  remove_unused_columns=False,
235
237
  )
236
238
  # Since the dataset is pre-tokenized, we supply a dummy dataset_text_field.
@@ -312,42 +314,207 @@ class TrainModel:
312
314
 
313
315
  def prepare_modelfile_content(self):
314
316
  output_model = self.config["hf_model_name"]
315
- # Determine stop tokens from config or infer based on model name
316
317
  model_name = self.config["model_name"].lower()
317
- if "phi" in model_name:
318
- inferred_stop_tokens = ["<|end|>", "<|user|>", "<|assistant|>"]
319
- elif "llava" in model_name:
320
- inferred_stop_tokens = ["</s>", "USER:", "ASSSISTANT:"]
321
- elif "mistral" in model_name:
322
- inferred_stop_tokens = ["[INST]", "[/INST]"]
323
- elif "qwen" in model_name:
324
- inferred_stop_tokens = ["<|endoftext|>"]
325
- elif "deepseek" in model_name:
326
- inferred_stop_tokens = ["<|begin▁of▁sentence|>", "<|end▁of▁sentence|>", "<|User|>", "<|Assistant|>"]
327
- else:
328
- inferred_stop_tokens = ["<|start_header_id|>", "<|end_header_id|>", "<|eot_id|>"]
329
- # Use stop_tokens from config if provided, otherwise use inferred
330
- model_stop_tokens = self.config.get("stop_tokens", inferred_stop_tokens)
331
-
332
- gguf_path = f"{output_model}/unsloth.Q4_K_M.gguf"
333
- if not os.path.exists(gguf_path):
334
- self.model, self.hf_tokenizer = self.load_model()
335
- self.save_model_gguf()
336
- stop_parameters = "\n".join([f'PARAMETER stop "{token}"' for token in model_stop_tokens])
337
- return f"""FROM {output_model}/unsloth.Q4_K_M.gguf
338
-
339
- TEMPLATE \"\"\"Below are some instructions that describe some tasks. Write responses that appropriately complete each request.{{{{ if .Prompt }}}}
340
-
341
- ### Instruction:
342
- {{{{ .Prompt }}}}
343
-
344
- {{{{ end }}}}### Response:
345
- {{{{ .Response }}}}\"\"\"
346
-
347
- {stop_parameters}
318
+ # Mapping from model name keywords to their default TEMPLATE and stop tokens (and optional SYSTEM/num_ctx)
319
+ mapping = {
320
+ "llama": {
321
+ "template": """<|start_header_id|>system<|end_header_id|>
322
+ Cutting Knowledge Date: December 2023
323
+ {{ if .System }}{{ .System }}
324
+ {{- end }}
325
+ {{- if .Tools }}When you receive a tool call response, use the output to format an answer to the orginal user question.
326
+ You are a helpful assistant with tool calling capabilities.
327
+ {{- end }}<|eot_id|>
328
+ {{- range $i, $_ := .Messages }}
329
+ {{- $last := eq (len (slice $.Messages $i)) 1 }}
330
+ {{- if eq .Role "user" }}<|start_header_id|>user<|end_header_id|>
331
+ {{- if and $.Tools $last }}
332
+ Given the following functions, please respond with a JSON for a function call with its proper arguments that best answers the given prompt.
333
+ Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}. Do not use variables.
334
+ {{ range $.Tools }}
335
+ {{- . }}
336
+ {{ end }}
337
+ {{ .Content }}<|eot_id|>
338
+ {{- else }}
339
+ {{ .Content }}<|eot_id|>
340
+ {{- end }}{{ if $last }}<|start_header_id|>assistant<|end_header_id|>
341
+ {{ end }}
342
+ {{- else if eq .Role "assistant" }}<|start_header_id|>assistant<|end_header_id|>
343
+ {{- if .ToolCalls }}
344
+ {{ range .ToolCalls }}
345
+ {"name": "{{ .Function.Name }}", "parameters": {{ .Function.Arguments }}}{{ end }}
346
+ {{- else }}
347
+ {{ .Content }}
348
+ {{- end }}{{ if not $last }}<|eot_id|>{{ end }}
349
+ {{- else if eq .Role "tool" }}<|start_header_id|>ipython<|end_header_id|>
350
+ {{ .Content }}<|eot_id|>{{ if $last }}<|start_header_id|>assistant<|end_header_id|>
351
+ {{ end }}
352
+ {{- end }}
353
+ {{- end }}""",
354
+ "stop_tokens": ["<|start_header_id|>", "<|end_header_id|>", "<|eot_id|>"]
355
+ },
356
+ "qwen": {
357
+ "template": """{{- if .Suffix }}<|fim_prefix|>{{ .Prompt }}<|fim_suffix|>{{ .Suffix }}<|fim_middle|>
358
+ {{- else if .Messages }}
359
+ {{- if or .System .Tools }}<|im_start|>system
360
+ {{- if .System }}
361
+ {{ .System }}
362
+ {{- end }}
363
+ {{- if .Tools }}
364
+ # Tools
365
+ You may call one or more functions to assist with the user query.
366
+ You are provided with function signatures within <tools></tools> XML tags:
367
+ <tools>
368
+ {{- range .Tools }}
369
+ {"type": "function", "function": {{ .Function }}}
370
+ {{- end }}
371
+ </tools>
372
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
373
+ <tool_call>
374
+ {"name": <function-name>, "arguments": <args-json-object>}
375
+ </tool_call>
376
+ {{- end }}<|im_end|>
377
+ {{ end }}
378
+ {{- range $i, $_ := .Messages }}
379
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
380
+ {{- if eq .Role "user" }}<|im_start|>user
381
+ {{ .Content }}<|im_end|>
382
+ {{ else if eq .Role "assistant" }}<|im_start|>assistant
383
+ {{ if .Content }}{{ .Content }}
384
+ {{- else if .ToolCalls }}<tool_call>
385
+ {{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
386
+ {{ end }}</tool_call>
387
+ {{- end }}{{ if not $last }}<|im_end|>
388
+ {{ end }}
389
+ {{- else if eq .Role "tool" }}<|im_start|>user
390
+ <tool_response>
391
+ {{ .Content }}
392
+ </tool_response><|im_end|>
393
+ {{ end }}
394
+ {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
395
+ {{ end }}
396
+ {{- end }}
397
+ {{- else }}
398
+ {{- if .System }}<|im_start|>system
399
+ {{ .System }}<|im_end|>
400
+ {{ end }}{{ if .Prompt }}<|im_start|>user
401
+ {{ .Prompt }}<|im_end|>
402
+ {{ end }}<|im_start|>assistant
403
+ {{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}""",
404
+ "system": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
405
+ "num_ctx": 32768,
406
+ "stop_tokens": ["<|endoftext|>"]
407
+ },
408
+ "mistral": {
409
+ "template": "[INST] {{ if .System }}{{ .System }} {{ end }}{{ .Prompt }} [/INST]",
410
+ "stop_tokens": ["[INST]", "[/INST]"]
411
+ },
412
+ "phi": {
413
+ "template": """{{- range $i, $_ := .Messages }}
414
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
415
+ <|im_start|>{{ .Role }}<|im_sep|>
416
+ {{ .Content }}{{ if not $last }}<|im_end|>
417
+ {{ end }}
418
+ {{- if and (ne .Role "assistant") $last }}<|im_end|>
419
+ <|im_start|>assistant<|im_sep|>
420
+ {{ end }}
421
+ {{- end }}""",
422
+ "stop_tokens": ["<|im_start|>", "<|im_end|>", "<|im_sep|>"]
423
+ },
424
+ "deepseek": {
425
+ "template": """{{- if .System }}{{ .System }}{{ end }}
426
+ {{- range $i, $_ := .Messages }}
427
+ {{- $last := eq (len (slice $.Messages $i)) 1}}
428
+ {{- if eq .Role "user" }}<|User|>{{ .Content }}
429
+ {{- else if eq .Role "assistant" }}<|Assistant|>{{ .Content }}{{- if not $last }}<|end▁of▁sentence|>{{- end }}
430
+ {{- end }}
431
+ {{- if and $last (ne .Role "assistant") }}<|Assistant|>{{- end }}
432
+ {{- end }}""",
433
+ "stop_tokens": ["<|begin▁of▁sentence|>", "<|end▁of▁sentence|>", "<|User|>", "<|Assistant|>"]
434
+ },
435
+ "llava": {
436
+ "template": """{{- if .Suffix }}<|fim_prefix|>{{ .Prompt }}<|fim_suffix|>{{ .Suffix }}<|fim_middle|>
437
+ {{- else if .Messages }}
438
+ {{- if or .System .Tools }}<|im_start|>system
439
+ {{- if .System }}
440
+ {{ .System }}
441
+ {{- end }}
442
+ {{- if .Tools }}
443
+ # Tools
444
+ You may call one or more functions to assist with the user query.
445
+ You are provided with function signatures within <tools></tools> XML tags:
446
+ <tools>
447
+ {{- range .Tools }}
448
+ {"type": "function", "function": {{ .Function }}}
449
+ {{- end }}
450
+ </tools>
451
+ For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
452
+ <tool_call>
453
+ {"name": <function-name>, "arguments": <args-json-object>}
454
+ </tool_call>
455
+ {{- end }}<|im_end|>
456
+ {{ end }}
457
+ {{- range $i, $_ := .Messages }}
458
+ {{- $last := eq (len (slice $.Messages $i)) 1 -}}
459
+ {{- if eq .Role "user" }}<|im_start|>user
460
+ {{ .Content }}<|im_end|>
461
+ {{ else if eq .Role "assistant" }}<|im_start|>assistant
462
+ {{ if .Content }}{{ .Content }}
463
+ {{- else if .ToolCalls }}<tool_call>
464
+ {{ range .ToolCalls }}{"name": "{{ .Function.Name }}", "arguments": {{ .Function.Arguments }}}
465
+ {{ end }}</tool_call>
466
+ {{- end }}{{ if not $last }}<|im_end|>
467
+ {{ end }}
468
+ {{- else if eq .Role "tool" }}<|im_start|>user
469
+ <tool_response>
470
+ {{ .Content }}
471
+ </tool_response><|im_end|>
472
+ {{ end }}
473
+ {{- if and (ne .Role "assistant") $last }}<|im_start|>assistant
474
+ {{ end }}
475
+ {{- end }}
476
+ {{- else }}
477
+ {{- if .System }}<|im_start|>system
478
+ {{ .System }}<|im_end|>
479
+ {{ end }}{{ if .Prompt }}<|im_start|>user
480
+ {{ .Prompt }}<|im_end|>
481
+ {{ end }}<|im_start|>assistant
482
+ {{ end }}{{ .Response }}{{ if .Response }}<|im_end|>{{ end }}""",
483
+ "stop_tokens": ["</s>", "USER:", "ASSSISTANT:"]
484
+ }
485
+ }
486
+ # Select mapping by checking if any key is in the model_name.
487
+ chosen = None
488
+ for key, settings in mapping.items():
489
+ if key in model_name:
490
+ chosen = settings
491
+ break
492
+ if chosen is None:
493
+ # Fallback default
494
+ chosen = {
495
+ "template": """{{ if .System }}<|start_header_id|>system<|end_header_id|>
496
+ {{ .System }}<|eot_id|>{{ end }}{{ if .Prompt }}<|start_header_id|>user<|end_header_id|>
497
+ {{ .Prompt }}<|eot_id|>{{ end }}<|start_header_id|>assistant<|end_header_id|>
498
+ {{ .Response }}<|eot_id|>""",
499
+ "stop_tokens": ["<|start_header_id|>", "<|end_header_id|>", "<|eot_id|>"]
500
+ }
501
+ # Build the stop parameter lines.
502
+ stop_params = "\n".join([f"PARAMETER stop {token}" for token in chosen["stop_tokens"]])
503
+ # Optionally include a SYSTEM line and num_ctx if defined in the mapping.
504
+ system_line = ""
505
+ if "system" in chosen:
506
+ system_line = f"SYSTEM {chosen['system']}\n"
507
+ num_ctx_line = ""
508
+ if "num_ctx" in chosen:
509
+ num_ctx_line = f"PARAMETER num_ctx {chosen['num_ctx']}\n"
510
+ # Assemble and return the modelfile content.
511
+ return f"""FROM {output_model}
512
+ TEMPLATE \"\"\"{chosen['template']}\"\"\"
513
+ {system_line}{num_ctx_line}{stop_params}
348
514
  """
349
515
 
350
516
 
517
+
351
518
  def create_and_push_ollama_model(self):
352
519
  modelfile_content = self.prepare_modelfile_content()
353
520
  with open("Modelfile", "w") as file:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: PraisonAI
3
- Version: 2.0.67
3
+ Version: 2.0.69
4
4
  Summary: PraisonAI is an AI Agents Framework with Self Reflection. PraisonAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration.
5
5
  Author: Mervin Praison
6
6
  Requires-Python: >=3.10,<3.13
@@ -5,7 +5,7 @@ praisonai/api/call.py,sha256=krOfTCZM_bdbsNuWQ1PijzCHECkDvEi9jIvvZaDQUUU,11035
5
5
  praisonai/auto.py,sha256=uLDm8CU3L_3amZsd55yzf9RdBF1uW-BGSx7nl9ctNZ4,8680
6
6
  praisonai/chainlit_ui.py,sha256=bNR7s509lp0I9JlJNvwCZRUZosC64qdvlFCt8NmFamQ,12216
7
7
  praisonai/cli.py,sha256=wKf17OzAmDhCWXtP_HDF4UrULCiWV1CI5yTEtCPUi28,24898
8
- praisonai/deploy.py,sha256=Txysvn5rP7d-pqpUoIvGGSJtFHeleQU1nbcUrSP5Hlc,6028
8
+ praisonai/deploy.py,sha256=pIf-k_LB-2I6-cTS1xzvgEvBXzAgoKIW1RrWqq7GFas,6028
9
9
  praisonai/inbuilt_tools/__init__.py,sha256=fai4ZJIKz7-iOnGZv5jJX0wmT77PKa4x2jqyaJddKFA,569
10
10
  praisonai/inbuilt_tools/autogen_tools.py,sha256=kJdEv61BTYvdHOaURNEpBcWq8Rs-oC03loNFTIjT-ak,4687
11
11
  praisonai/inc/__init__.py,sha256=sPDlYBBwdk0VlWzaaM_lG0_LD07lS2HRGvPdxXJFiYg,62
@@ -33,7 +33,7 @@ praisonai/setup/setup_conda_env.py,sha256=4QiWrqgEObivzOMwfJgWaCPpUEpB68cQ6lFwVw
33
33
  praisonai/setup/setup_conda_env.sh,sha256=aD5Tb_T4UeVtJD5ibYTBB50YWCKh7INdiei2LN1fBig,4081
34
34
  praisonai/setup.py,sha256=0jHgKnIPCtBZiGYaYyTz3PzrJI6nBy55VXk2UctXlDo,373
35
35
  praisonai/test.py,sha256=OL-wesjA5JTohr8rtr6kWoaS4ImkJg2l0GXJ-dUUfRU,4090
36
- praisonai/train.py,sha256=5ZR3FAZELIwe8Fv2Rt4ID3bjVvuVQEd5fWZ-3n-KUpo,16534
36
+ praisonai/train.py,sha256=fDpoR3uz0ZYRAuQHqzmZalbcy0BKMK3BMI27t56wJqw,23604
37
37
  praisonai/ui/README.md,sha256=QG9yucvBieVjCjWFzu6hL9xNtYllkoqyJ_q1b0YYAco,1124
38
38
  praisonai/ui/agents.py,sha256=1qsWE2yCaQKhuc-1uLHdMfZJeOXzBtp4pe5q7bk2EuA,32813
39
39
  praisonai/ui/callbacks.py,sha256=V4_-GjxmjDFmugUZGfQHKtNSysx7rT6i1UblbM_8lIM,1968
@@ -82,8 +82,8 @@ praisonai/ui/realtimeclient/tools.py,sha256=IJOYwVOBW5Ocn5_iV9pFkmSKR3WU3YpX3kwF
82
82
  praisonai/ui/sql_alchemy.py,sha256=oekZOXlRGMJ2SuC-lmgMMIzAmvbMg2DWeGTSpOzbVBM,29674
83
83
  praisonai/ui/tools.md,sha256=Ad3YH_ZCLMWlz3mDXllQnQ_S5l55LWqLdcZSh-EXrHI,3956
84
84
  praisonai/version.py,sha256=ugyuFliEqtAwQmH4sTlc16YXKYbFWDmfyk87fErB8-8,21
85
- praisonai-2.0.67.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
86
- praisonai-2.0.67.dist-info/METADATA,sha256=Ocu8ITZ5PpCjQM23ILnYEnLqLukAGFIVMmhLzDmPvtI,21942
87
- praisonai-2.0.67.dist-info/WHEEL,sha256=OiNztsphQWM3l0xJ9BHQRElMnxzHbt1M68r2N60f8T8,110
88
- praisonai-2.0.67.dist-info/entry_points.txt,sha256=I_xc6a6MNTTfLxYmAxe0rgey0G-_hbY07oFW-ZDnkw4,135
89
- praisonai-2.0.67.dist-info/RECORD,,
85
+ praisonai-2.0.69.dist-info/LICENSE,sha256=kqvFysVlnFxYOu0HxCe2HlmZmJtdmNGOxWRRkT9TsWc,1035
86
+ praisonai-2.0.69.dist-info/METADATA,sha256=bjgay0w8WJriQBokXsuq53Uyoe0GMuPt2PJTAS8ZfdA,21942
87
+ praisonai-2.0.69.dist-info/WHEEL,sha256=OiNztsphQWM3l0xJ9BHQRElMnxzHbt1M68r2N60f8T8,110
88
+ praisonai-2.0.69.dist-info/entry_points.txt,sha256=I_xc6a6MNTTfLxYmAxe0rgey0G-_hbY07oFW-ZDnkw4,135
89
+ praisonai-2.0.69.dist-info/RECORD,,