swarms 7.8.0__tar.gz → 7.8.3__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.
- {swarms-7.8.0 → swarms-7.8.3}/PKG-INFO +1 -2
- {swarms-7.8.0 → swarms-7.8.3}/pyproject.toml +1 -2
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarm_router.py +11 -4
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/base_tool.py +0 -1
- swarms-7.8.3/swarms/utils/litellm_tokenizer.py +106 -0
- swarms-7.8.0/swarms/utils/litellm_tokenizer.py +0 -20
- {swarms-7.8.0 → swarms-7.8.3}/LICENSE +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/README.md +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/agent_judge.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/agent_print.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/ape_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/auto_generate_swarm_config.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/consistency_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/cort_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/create_agents_from_yaml.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/flexion_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/gkp_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/i_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/openai_assistant.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/react_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/reasoning_agents.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/reasoning_duo.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/self_agent_builder.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/agents/tool_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/artifacts/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/artifacts/main_artifact.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/cli/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/cli/create_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/cli/main.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/cli/onboarding_process.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/communication/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/communication/base_communication.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/communication/duckdb_wrap.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/communication/pulsar_struct.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/communication/redis_wrap.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/communication/sqlite_wrap.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/accountant_swarm_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/ag_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/aga.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/agent_judge_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/agent_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/agent_self_builder_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/agent_system_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/ai_research_team.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/aot_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/autobloggen.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/autoswarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/chat_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/code_interpreter.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/code_spawner.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/debate.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/documentation.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/education.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/finance_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/finance_agent_sys_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/growth_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/idea2img.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/legal_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/logistics.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/max_loop_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/meta_system_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/multi_agent_collab_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/multi_modal_autonomous_instruction_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/multi_modal_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/multi_modal_visual_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/operations_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/paper_idea_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/personal_stylist.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/product_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/programming.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/project_manager.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/prompt_generator.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/prompt_generator_optimizer.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/python.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/react.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/react_base_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/reasoning_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/refiner_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/safety_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/sales.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/sales_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/security_team.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/self_operating_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/sop_generator_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/summaries_prompts.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/support_agent_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/swarm_manager_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/task_assignment_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/tests.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/tools.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/urban_planning.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/visual_cot.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/worker_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/prompts/xray_swarm_prompt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/agent_class_schema.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/agent_mcp_errors.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/agent_step_schemas.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/agent_tool_schema.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/base_schemas.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/llm_agent_schema.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/schemas/mcp_schemas.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/agent_builder.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/agent_registry.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/agent_roles.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/agent_router.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/aop.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/auto_swarm_builder.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/base_structure.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/base_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/base_workflow.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/batch_agent_execution.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/concat.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/concurrent_workflow.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/conversation.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/council_judge.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/csv_to_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/de_hallucination_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/deep_research_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/dynamic_conversational_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/graph_workflow.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/groupchat.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/hiearchical_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/hybrid_hiearchical_peer_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/long_agent.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/ma_utils.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/majority_voting.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/malt.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/matrix_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/meme_agent_persona_generator.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/mixture_of_agents.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/model_router.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/multi_agent_collab.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/multi_agent_exec.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/multi_agent_router.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/multi_model_gpu_manager.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/omni_agent_types.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/output_types.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/rearrange.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/round_robin.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/safe_loading.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/sequential_workflow.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/spreadsheet_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/stopping_conditions.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarm_arange.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarm_eval.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarm_id_generator.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarm_matcher.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarm_registry.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/swarming_architectures.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/tree_swarm.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/utils.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/structs/various_alt_swarms.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/telemetry/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/telemetry/bootup.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/telemetry/main.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/cohere_func_call_schema.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/create_agent_tool.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/func_calling_utils.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/func_to_str.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/function_util.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/json_former.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/json_utils.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/logits_processor.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/mcp_client_call.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/openai_func_calling_schema_pydantic.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/openai_tool_creator_decorator.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/py_func_to_openai_func_str.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/pydantic_to_json.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/tool_parse_exec.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/tool_registry.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/tool_schema_base_model.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/tools/tool_utils.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/__init__.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/any_to_str.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/audio_processing.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/auto_download_check_packages.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/calculate_func_metrics.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/data_to_text.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/disable_logging.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/file_processing.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/formatter.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/function_caller_model.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/generate_keys.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/history_output_formatter.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/index.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/litellm_wrapper.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/loguru_logger.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/markdown_message.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/parse_code.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/pdf_to_text.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/str_to_dict.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/try_except_wrapper.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/visualizer.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/vllm_wrapper.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/wrapper_clusterop.py +0 -0
- {swarms-7.8.0 → swarms-7.8.3}/swarms/utils/xml_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: swarms
|
3
|
-
Version: 7.8.
|
3
|
+
Version: 7.8.3
|
4
4
|
Summary: Swarms - TGSC
|
5
5
|
License: MIT
|
6
6
|
Keywords: artificial intelligence,deep learning,optimizers,Prompt Engineering,swarms,agents,llms,transformers,multi-agent,swarms of agents,Enterprise-Grade Agents,Production-Grade Agents,Agents,Multi-Grade-Agents,Swarms,Transformers,LLMs,Prompt Engineering,Agents,Generative Agents,Generative AI,Agent Marketplace,Agent Store,quant,finance,algorithmic trading,portfolio optimization,risk management,financial modeling,machine learning for finance,natural language processing for finance
|
@@ -27,7 +27,6 @@ Requires-Dist: loguru
|
|
27
27
|
Requires-Dist: mcp
|
28
28
|
Requires-Dist: networkx
|
29
29
|
Requires-Dist: numpy
|
30
|
-
Requires-Dist: numpydoc
|
31
30
|
Requires-Dist: psutil
|
32
31
|
Requires-Dist: pydantic
|
33
32
|
Requires-Dist: pypdf (==5.1.0)
|
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
|
|
5
5
|
|
6
6
|
[tool.poetry]
|
7
7
|
name = "swarms"
|
8
|
-
version = "7.8.
|
8
|
+
version = "7.8.3"
|
9
9
|
description = "Swarms - TGSC"
|
10
10
|
license = "MIT"
|
11
11
|
authors = ["Kye Gomez <kye@apac.ai>"]
|
@@ -79,7 +79,6 @@ torch = "*"
|
|
79
79
|
httpx = "*"
|
80
80
|
mcp = "*"
|
81
81
|
aiohttp = "*"
|
82
|
-
numpydoc = "*"
|
83
82
|
|
84
83
|
[tool.poetry.scripts]
|
85
84
|
swarms = "swarms.cli.main:main"
|
@@ -538,8 +538,8 @@ class SwarmRouter:
|
|
538
538
|
def _run(
|
539
539
|
self,
|
540
540
|
task: str,
|
541
|
-
img: str,
|
542
|
-
model_response: str,
|
541
|
+
img: Optional[str] = None,
|
542
|
+
model_response: Optional[str] = None,
|
543
543
|
*args,
|
544
544
|
**kwargs,
|
545
545
|
) -> Any:
|
@@ -591,7 +591,8 @@ class SwarmRouter:
|
|
591
591
|
def run(
|
592
592
|
self,
|
593
593
|
task: str,
|
594
|
-
img: str = None,
|
594
|
+
img: Optional[str] = None,
|
595
|
+
model_response: Optional[str] = None,
|
595
596
|
*args,
|
596
597
|
**kwargs,
|
597
598
|
) -> Any:
|
@@ -613,7 +614,13 @@ class SwarmRouter:
|
|
613
614
|
Exception: If an error occurs during task execution.
|
614
615
|
"""
|
615
616
|
try:
|
616
|
-
return self._run(
|
617
|
+
return self._run(
|
618
|
+
task=task,
|
619
|
+
img=img,
|
620
|
+
model_response=model_response,
|
621
|
+
*args,
|
622
|
+
**kwargs,
|
623
|
+
)
|
617
624
|
except Exception as e:
|
618
625
|
logger.error(f"Error executing task on swarm: {str(e)}")
|
619
626
|
raise
|
@@ -2,7 +2,6 @@ import json
|
|
2
2
|
from typing import Any, Callable, Dict, List, Optional, Union
|
3
3
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
4
4
|
|
5
|
-
# from litellm.utils import function_to_dict
|
6
5
|
from pydantic import BaseModel, Field
|
7
6
|
|
8
7
|
from swarms.tools.func_to_str import function_to_str, functions_to_str
|
@@ -0,0 +1,106 @@
|
|
1
|
+
from litellm import encode, model_list
|
2
|
+
from loguru import logger
|
3
|
+
from typing import Optional
|
4
|
+
from functools import lru_cache
|
5
|
+
|
6
|
+
# Use consistent default model
|
7
|
+
DEFAULT_MODEL = "gpt-4o-mini"
|
8
|
+
|
9
|
+
|
10
|
+
def count_tokens(
|
11
|
+
text: str,
|
12
|
+
model: str = DEFAULT_MODEL,
|
13
|
+
default_encoder: Optional[str] = DEFAULT_MODEL,
|
14
|
+
) -> int:
|
15
|
+
"""
|
16
|
+
Count the number of tokens in the given text using the specified model.
|
17
|
+
|
18
|
+
Args:
|
19
|
+
text: The text to tokenize
|
20
|
+
model: The model to use for tokenization (defaults to gpt-4o-mini)
|
21
|
+
default_encoder: Fallback encoder if the primary model fails (defaults to DEFAULT_MODEL)
|
22
|
+
|
23
|
+
Returns:
|
24
|
+
int: Number of tokens in the text
|
25
|
+
|
26
|
+
Raises:
|
27
|
+
ValueError: If text is empty or if both primary and fallback models fail
|
28
|
+
"""
|
29
|
+
if not text or not text.strip():
|
30
|
+
logger.warning("Empty or whitespace-only text provided")
|
31
|
+
return 0
|
32
|
+
|
33
|
+
# Set fallback encoder
|
34
|
+
fallback_model = default_encoder or DEFAULT_MODEL
|
35
|
+
|
36
|
+
# First attempt with the requested model
|
37
|
+
try:
|
38
|
+
tokens = encode(model=model, text=text)
|
39
|
+
return len(tokens)
|
40
|
+
|
41
|
+
except Exception as e:
|
42
|
+
logger.warning(
|
43
|
+
f"Failed to tokenize with model '{model}': {e} using fallback model '{fallback_model}'"
|
44
|
+
)
|
45
|
+
|
46
|
+
logger.info(f"Using fallback model '{fallback_model}'")
|
47
|
+
|
48
|
+
# Only try fallback if it's different from the original model
|
49
|
+
if fallback_model != model:
|
50
|
+
try:
|
51
|
+
logger.info(
|
52
|
+
f"Falling back to default encoder: {fallback_model}"
|
53
|
+
)
|
54
|
+
tokens = encode(model=fallback_model, text=text)
|
55
|
+
return len(tokens)
|
56
|
+
|
57
|
+
except Exception as fallback_error:
|
58
|
+
logger.error(
|
59
|
+
f"Fallback encoder '{fallback_model}' also failed: {fallback_error}"
|
60
|
+
)
|
61
|
+
raise ValueError(
|
62
|
+
f"Both primary model '{model}' and fallback '{fallback_model}' failed to tokenize text"
|
63
|
+
)
|
64
|
+
else:
|
65
|
+
logger.error(
|
66
|
+
f"Primary model '{model}' failed and no different fallback available"
|
67
|
+
)
|
68
|
+
raise ValueError(
|
69
|
+
f"Model '{model}' failed to tokenize text: {e}"
|
70
|
+
)
|
71
|
+
|
72
|
+
|
73
|
+
@lru_cache(maxsize=100)
|
74
|
+
def get_supported_models() -> list:
|
75
|
+
"""Get list of supported models from litellm."""
|
76
|
+
try:
|
77
|
+
return model_list
|
78
|
+
except Exception as e:
|
79
|
+
logger.warning(f"Could not retrieve model list: {e}")
|
80
|
+
return []
|
81
|
+
|
82
|
+
|
83
|
+
# if __name__ == "__main__":
|
84
|
+
# # Test with different scenarios
|
85
|
+
# test_text = "Hello, how are you?"
|
86
|
+
|
87
|
+
# # # Test with Claude model
|
88
|
+
# # try:
|
89
|
+
# # tokens = count_tokens(test_text, model="claude-3-5-sonnet-20240620")
|
90
|
+
# # print(f"Claude tokens: {tokens}")
|
91
|
+
# # except Exception as e:
|
92
|
+
# # print(f"Claude test failed: {e}")
|
93
|
+
|
94
|
+
# # # Test with default model
|
95
|
+
# # try:
|
96
|
+
# # tokens = count_tokens(test_text)
|
97
|
+
# # print(f"Default model tokens: {tokens}")
|
98
|
+
# # except Exception as e:
|
99
|
+
# # print(f"Default test failed: {e}")
|
100
|
+
|
101
|
+
# # Test with explicit fallback
|
102
|
+
# try:
|
103
|
+
# tokens = count_tokens(test_text, model="some-invalid-model", default_encoder="gpt-4o-mini")
|
104
|
+
# print(f"Fallback test tokens: {tokens}")
|
105
|
+
# except Exception as e:
|
106
|
+
# print(f"Fallback test failed: {e}")
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import subprocess
|
2
|
-
|
3
|
-
|
4
|
-
def count_tokens(text: str, model: str = "gpt-4o") -> int:
|
5
|
-
"""Count the number of tokens in the given text."""
|
6
|
-
try:
|
7
|
-
from litellm import encode
|
8
|
-
except ImportError:
|
9
|
-
import sys
|
10
|
-
|
11
|
-
subprocess.run(
|
12
|
-
[sys.executable, "-m", "pip", "install", "litellm"]
|
13
|
-
)
|
14
|
-
from litellm import encode
|
15
|
-
|
16
|
-
return len(encode(model=model, text=text))
|
17
|
-
|
18
|
-
|
19
|
-
# if __name__ == "__main__":
|
20
|
-
# print(count_tokens("Hello, how are you?"))
|
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
|
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
|
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
|