camel-ai 0.2.21__tar.gz → 0.2.22__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.
Potentially problematic release.
This version of camel-ai might be problematic. Click here for more details.
- {camel_ai-0.2.21 → camel_ai-0.2.22}/PKG-INFO +1 -2
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/__init__.py +1 -1
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/self_instruct.py +1 -1
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/openai_embedding.py +10 -1
- camel_ai-0.2.22/camel/interpreters/docker/Dockerfile +12 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/docker_interpreter.py +19 -1
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/subprocess_interpreter.py +42 -17
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/__init__.py +2 -0
- camel_ai-0.2.22/camel/loaders/mineru_extractor.py +250 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/base_model.py +54 -1
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/deepseek_model.py +0 -18
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/__init__.py +5 -2
- camel_ai-0.2.22/camel/toolkits/mineru_toolkit.py +178 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/sympy_toolkit.py +38 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/pyproject.toml +1 -1
- {camel_ai-0.2.21 → camel_ai-0.2.22}/LICENSE +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/README.md +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/chat_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/critic_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/deductive_reasoner_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/embodied_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/knowledge_graph_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/multi_hop_generator_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/programmed_agent_instruction.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/role_assignment_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/search_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/task_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/tool_agents/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/tool_agents/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/agents/tool_agents/hugging_face_tool_agent.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/apibank.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/apibench.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/gaia.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/nexus.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/benchmarks/ragbench.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/discord/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/discord/discord_app.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/discord/discord_installation.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/discord/discord_store.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/slack/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/slack/models.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/slack/slack_app.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/bots/telegram_bot.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/aiml_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/anthropic_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/base_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/cohere_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/deepseek_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/gemini_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/groq_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/internlm_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/litellm_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/mistral_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/moonshot_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/nvidia_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/ollama_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/openai_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/qwen_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/reka_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/samba_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/sglang_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/siliconflow_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/togetherai_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/vllm_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/yi_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/configs/zhipuai_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/data_collector/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/data_collector/alpaca_collector.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/data_collector/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/data_collector/sharegpt_collector.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/cot_datagen.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_improving_cot.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/filter/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/filter/filter_function.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/filter/filter_registry.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/filter/instruction_filter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/self_instruct/templates.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/source2synth/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/source2synth/data_processor.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/source2synth/models.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datagen/source2synth/user_data_processor_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datahubs/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datahubs/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datahubs/huggingface.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/datahubs/models.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/jina_embedding.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/mistral_embedding.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/openai_compatible_embedding.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/sentence_transformers_embeddings.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/embeddings/vlm_embedding.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/generators.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/human.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/e2b_interpreter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/internal_python_interpreter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/interpreter_error.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/interpreters/ipython_interpreter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/apify_reader.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/base_io.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/chunkr_reader.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/firecrawl_reader.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/jina_url_reader.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/panda_reader.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/loaders/unstructured_io.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/logger.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/agent_memories.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/blocks/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/blocks/chat_history_block.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/blocks/vectordb_block.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/context_creators/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/context_creators/score_based.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/memories/records.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/alpaca.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/conversation_models.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/sharegpt/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/sharegpt/function_call_formatter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/sharegpt/hermes/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/conversion/sharegpt/hermes/hermes_function_formatter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/messages/func_message.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/aiml_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/anthropic_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/azure_openai_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/cohere_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/fish_audio_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/gemini_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/groq_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/internlm_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/litellm_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/mistral_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/model_factory.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/model_manager.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/moonshot_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/nemotron_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/nvidia_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/ollama_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/openai_audio_models.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/openai_compatible_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/openai_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/qwen_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/reka_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/reward/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/reward/base_reward_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/reward/evaluator.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/reward/nemotron_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/reward/skywork_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/samba_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/sglang_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/siliconflow_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/stub_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/togetherai_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/vllm_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/yi_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/models/zhipuai_model.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/personas/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/personas/persona.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/personas/persona_hub.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/ai_society.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/code.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/evaluation.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/generate_text_embedding_data.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/image_craft.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/misalignment.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/multi_condition_image_craft.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/object_recognition.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/persona_hub.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/prompt_templates.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/role_description_prompt_template.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/solution_extraction.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/task_prompt_template.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/translation.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/prompts/video_description_prompt.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/responses/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/responses/agent_responses.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/retrievers/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/retrievers/auto_retriever.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/retrievers/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/retrievers/bm25_retriever.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/retrievers/cohere_rerank_retriever.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/retrievers/vector_retriever.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/api.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/configs.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/docker_runtime.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/llm_guard_runtime.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/remote_http_runtime.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/utils/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/utils/function_risk_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/runtime/utils/ignore_risk_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/schemas/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/schemas/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/schemas/openai_converter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/schemas/outlines_converter.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/babyagi_playing.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/role_playing.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/prompts.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/role_playing_worker.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/single_agent_worker.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/task_channel.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/utils.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/worker.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/societies/workforce/workforce.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/graph_storages/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/graph_storages/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/graph_storages/graph_element.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/graph_storages/nebula_graph.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/graph_storages/neo4j_graph.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/key_value_storages/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/key_value_storages/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/key_value_storages/in_memory.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/key_value_storages/json.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/key_value_storages/redis.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/object_storages/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/object_storages/amazon_s3.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/object_storages/azure_blob.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/object_storages/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/object_storages/google_cloud.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/vectordb_storages/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/vectordb_storages/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/vectordb_storages/milvus.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/storages/vectordb_storages/qdrant.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/tasks/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/tasks/task.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/tasks/task_prompt.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/terminators/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/terminators/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/terminators/response_terminator.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/terminators/token_limit_terminator.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/arxiv_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/ask_news_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/base.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/code_execution.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/dalle_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/dappier_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/data_commons_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/function_tool.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/github_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/google_maps_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/google_scholar_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/human_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/linkedin_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/math_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/meshy_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/notion_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/biztoc/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/biztoc/ai-plugin.json +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/biztoc/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/coursera/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/coursera/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/create_qr_code/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/create_qr_code/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/klarna/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/klarna/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/nasa_apod/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/nasa_apod/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/outschool/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/outschool/ai-plugin.json +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/outschool/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/outschool/paths/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/outschool/paths/get_classes.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/outschool/paths/search_teachers.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/security_config.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/speak/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/speak/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/web_scraper/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/web_scraper/ai-plugin.json +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/web_scraper/openapi.yaml +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/web_scraper/paths/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_specs/web_scraper/paths/scraper.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/open_api_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/openbb_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/reddit_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/retrieval_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/search_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/semantic_scholar_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/slack_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/stripe_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/twitter_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/video_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/weather_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/toolkits/whatsapp_toolkit.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/types/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/types/enums.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/types/openai_types.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/types/unified_model_type.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/__init__.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/async_func.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/commons.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/constants.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/deduplication.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/response_format.py +0 -0
- {camel_ai-0.2.21 → camel_ai-0.2.22}/camel/utils/token_counting.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: camel-ai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.22
|
|
4
4
|
Summary: Communicative Agents for AI Society Study
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: communicative-ai,ai-societies,artificial-intelligence,deep-learning,multi-agent-systems,cooperative-ai,natural-language-processing,large-language-models
|
|
@@ -91,7 +91,6 @@ Requires-Dist: pymilvus (>=2.4.0,<3.0.0) ; extra == "rag" or extra == "storage"
|
|
|
91
91
|
Requires-Dist: pyowm (>=3.3.0,<4.0.0) ; extra == "web-tools" or extra == "all"
|
|
92
92
|
Requires-Dist: pytest (>=7,<8) ; extra == "test"
|
|
93
93
|
Requires-Dist: pytest-asyncio (>=0.23.0,<0.24.0) ; extra == "test"
|
|
94
|
-
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
95
94
|
Requires-Dist: qdrant-client (>=1.9.0,<2.0.0) ; extra == "rag" or extra == "storage" or extra == "all"
|
|
96
95
|
Requires-Dist: rank-bm25 (>=0.2.2,<0.3.0) ; extra == "rag" or extra == "all"
|
|
97
96
|
Requires-Dist: redis (>=5.0.6,<6.0.0) ; extra == "storage" or extra == "all"
|
|
@@ -361,7 +361,7 @@ class SelfInstructPipeline:
|
|
|
361
361
|
in JSON format.
|
|
362
362
|
"""
|
|
363
363
|
with open(self.data_output_path, 'w') as f:
|
|
364
|
-
json.dump(self.machine_tasks, f, indent=4)
|
|
364
|
+
json.dump(self.machine_tasks, f, indent=4, ensure_ascii=False)
|
|
365
365
|
|
|
366
366
|
def generate(self):
|
|
367
367
|
r"""Execute the entire pipeline to generate machine instructions
|
|
@@ -30,6 +30,8 @@ class OpenAIEmbedding(BaseEmbedding[str]):
|
|
|
30
30
|
model_type (EmbeddingModelType, optional): The model type to be
|
|
31
31
|
used for text embeddings.
|
|
32
32
|
(default: :obj:`TEXT_EMBEDDING_3_SMALL`)
|
|
33
|
+
url (Optional[str], optional): The url to the OpenAI service.
|
|
34
|
+
(default: :obj:`None`)
|
|
33
35
|
api_key (str, optional): The API key for authenticating with the
|
|
34
36
|
OpenAI service. (default: :obj:`None`)
|
|
35
37
|
dimensions (int, optional): The text embedding output dimensions.
|
|
@@ -49,6 +51,7 @@ class OpenAIEmbedding(BaseEmbedding[str]):
|
|
|
49
51
|
model_type: EmbeddingModelType = (
|
|
50
52
|
EmbeddingModelType.TEXT_EMBEDDING_3_SMALL
|
|
51
53
|
),
|
|
54
|
+
url: str | None = None,
|
|
52
55
|
api_key: str | None = None,
|
|
53
56
|
dimensions: int | NotGiven = NOT_GIVEN,
|
|
54
57
|
) -> None:
|
|
@@ -61,7 +64,13 @@ class OpenAIEmbedding(BaseEmbedding[str]):
|
|
|
61
64
|
assert isinstance(dimensions, int)
|
|
62
65
|
self.output_dim = dimensions
|
|
63
66
|
self._api_key = api_key or os.environ.get("OPENAI_API_KEY")
|
|
64
|
-
self.
|
|
67
|
+
self._url = url or os.environ.get("OPENAI_API_BASE_URL")
|
|
68
|
+
self.client = OpenAI(
|
|
69
|
+
timeout=180,
|
|
70
|
+
max_retries=3,
|
|
71
|
+
base_url=self._url,
|
|
72
|
+
api_key=self._api_key,
|
|
73
|
+
)
|
|
65
74
|
|
|
66
75
|
def embed_list(
|
|
67
76
|
self,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
FROM python:3.9-slim
|
|
2
|
+
|
|
3
|
+
# Install R and required dependencies
|
|
4
|
+
RUN apt-get update && apt-get install -y \
|
|
5
|
+
r-base \
|
|
6
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
7
|
+
|
|
8
|
+
# Set working directory
|
|
9
|
+
WORKDIR /workspace
|
|
10
|
+
|
|
11
|
+
# Keep container running
|
|
12
|
+
CMD ["tail", "-f", "/dev/null"]
|
|
@@ -52,11 +52,13 @@ class DockerInterpreter(BaseInterpreter):
|
|
|
52
52
|
_CODE_EXECUTE_CMD_MAPPING: ClassVar[Dict[str, str]] = {
|
|
53
53
|
"python": "python {file_name}",
|
|
54
54
|
"bash": "bash {file_name}",
|
|
55
|
+
"r": "Rscript {file_name}",
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
_CODE_EXTENSION_MAPPING: ClassVar[Dict[str, str]] = {
|
|
58
59
|
"python": "py",
|
|
59
60
|
"bash": "sh",
|
|
61
|
+
"r": "R",
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
_CODE_TYPE_MAPPING: ClassVar[Dict[str, str]] = {
|
|
@@ -67,6 +69,8 @@ class DockerInterpreter(BaseInterpreter):
|
|
|
67
69
|
"shell": "bash",
|
|
68
70
|
"bash": "bash",
|
|
69
71
|
"sh": "bash",
|
|
72
|
+
"r": "r",
|
|
73
|
+
"R": "r",
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
def __init__(
|
|
@@ -104,8 +108,22 @@ class DockerInterpreter(BaseInterpreter):
|
|
|
104
108
|
import docker
|
|
105
109
|
|
|
106
110
|
client = docker.from_env()
|
|
111
|
+
|
|
112
|
+
# Build custom image with Python and R
|
|
113
|
+
dockerfile_path = Path(__file__).parent / "docker"
|
|
114
|
+
image_tag = "camel-interpreter:latest"
|
|
115
|
+
try:
|
|
116
|
+
client.images.get(image_tag)
|
|
117
|
+
except docker.errors.ImageNotFound:
|
|
118
|
+
logger.info("Building custom interpreter image...")
|
|
119
|
+
client.images.build(
|
|
120
|
+
path=str(dockerfile_path),
|
|
121
|
+
tag=image_tag,
|
|
122
|
+
rm=True,
|
|
123
|
+
)
|
|
124
|
+
|
|
107
125
|
self._container = client.containers.run(
|
|
108
|
-
|
|
126
|
+
image_tag,
|
|
109
127
|
detach=True,
|
|
110
128
|
name=f"camel-interpreter-{uuid.uuid4()}",
|
|
111
129
|
command="tail -f /dev/null",
|
|
@@ -48,11 +48,13 @@ class SubprocessInterpreter(BaseInterpreter):
|
|
|
48
48
|
_CODE_EXECUTE_CMD_MAPPING: ClassVar[Dict[str, str]] = {
|
|
49
49
|
"python": "python {file_name}",
|
|
50
50
|
"bash": "bash {file_name}",
|
|
51
|
+
"r": "Rscript {file_name}",
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
_CODE_EXTENSION_MAPPING: ClassVar[Dict[str, str]] = {
|
|
54
55
|
"python": "py",
|
|
55
56
|
"bash": "sh",
|
|
57
|
+
"r": "R",
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
_CODE_TYPE_MAPPING: ClassVar[Dict[str, str]] = {
|
|
@@ -63,6 +65,8 @@ class SubprocessInterpreter(BaseInterpreter):
|
|
|
63
65
|
"shell": "bash",
|
|
64
66
|
"bash": "bash",
|
|
65
67
|
"sh": "bash",
|
|
68
|
+
"r": "r",
|
|
69
|
+
"R": "r",
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
def __init__(
|
|
@@ -98,7 +102,7 @@ class SubprocessInterpreter(BaseInterpreter):
|
|
|
98
102
|
if not file.is_file():
|
|
99
103
|
raise RuntimeError(f"{file} is not a file.")
|
|
100
104
|
code_type = self._check_code_type(code_type)
|
|
101
|
-
if code_type == "python":
|
|
105
|
+
if self._CODE_TYPE_MAPPING[code_type] == "python":
|
|
102
106
|
# For Python code, use ast to analyze and modify the code
|
|
103
107
|
import ast
|
|
104
108
|
|
|
@@ -113,23 +117,41 @@ class SubprocessInterpreter(BaseInterpreter):
|
|
|
113
117
|
# Get the last node
|
|
114
118
|
if tree.body:
|
|
115
119
|
last_node = tree.body[-1]
|
|
116
|
-
#
|
|
120
|
+
# Handle expressions that would normally not produce output
|
|
121
|
+
# For example: In a REPL, typing '1 + 2' should show '3'
|
|
122
|
+
|
|
117
123
|
if isinstance(last_node, ast.Expr):
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
124
|
+
# Only wrap in print(repr()) if it's not already a
|
|
125
|
+
# print call
|
|
126
|
+
if not (
|
|
127
|
+
isinstance(last_node.value, ast.Call)
|
|
128
|
+
and isinstance(last_node.value.func, ast.Name)
|
|
129
|
+
and last_node.value.func.id == 'print'
|
|
130
|
+
):
|
|
131
|
+
# Transform the AST to wrap the expression in print
|
|
132
|
+
# (repr())
|
|
133
|
+
# Example transformation:
|
|
134
|
+
# Before: x + y
|
|
135
|
+
# After: print(repr(x + y))
|
|
136
|
+
tree.body[-1] = ast.Expr(
|
|
137
|
+
value=ast.Call(
|
|
138
|
+
# Create print() function call
|
|
139
|
+
func=ast.Name(id='print', ctx=ast.Load()),
|
|
140
|
+
args=[
|
|
141
|
+
ast.Call(
|
|
142
|
+
# Create repr() function call
|
|
143
|
+
func=ast.Name(
|
|
144
|
+
id='repr', ctx=ast.Load()
|
|
145
|
+
),
|
|
146
|
+
# Pass the original expression as
|
|
147
|
+
# argument to repr()
|
|
148
|
+
args=[last_node.value],
|
|
149
|
+
keywords=[],
|
|
150
|
+
)
|
|
151
|
+
],
|
|
152
|
+
keywords=[],
|
|
153
|
+
)
|
|
131
154
|
)
|
|
132
|
-
)
|
|
133
155
|
# Fix missing source locations
|
|
134
156
|
ast.fix_missing_locations(tree)
|
|
135
157
|
# Convert back to source
|
|
@@ -159,7 +181,10 @@ class SubprocessInterpreter(BaseInterpreter):
|
|
|
159
181
|
return_code = proc.returncode
|
|
160
182
|
|
|
161
183
|
# Clean up temporary file if it was created
|
|
162
|
-
if
|
|
184
|
+
if (
|
|
185
|
+
self._CODE_TYPE_MAPPING[code_type] == "python"
|
|
186
|
+
and 'temp_file' in locals()
|
|
187
|
+
):
|
|
163
188
|
temp_file.unlink()
|
|
164
189
|
|
|
165
190
|
if self.print_stdout and stdout:
|
|
@@ -17,6 +17,7 @@ from .base_io import File, create_file, create_file_from_raw_bytes
|
|
|
17
17
|
from .chunkr_reader import ChunkrReader
|
|
18
18
|
from .firecrawl_reader import Firecrawl
|
|
19
19
|
from .jina_url_reader import JinaURLReader
|
|
20
|
+
from .mineru_extractor import MinerU
|
|
20
21
|
from .panda_reader import PandaReader
|
|
21
22
|
from .unstructured_io import UnstructuredIO
|
|
22
23
|
|
|
@@ -30,4 +31,5 @@ __all__ = [
|
|
|
30
31
|
'Apify',
|
|
31
32
|
'ChunkrReader',
|
|
32
33
|
'PandaReader',
|
|
34
|
+
'MinerU',
|
|
33
35
|
]
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
# you may not use this file except in compliance with the License.
|
|
4
|
+
# You may obtain a copy of the License at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
# See the License for the specific language governing permissions and
|
|
12
|
+
# limitations under the License.
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
import time
|
|
17
|
+
from typing import Dict, List, Optional, Union
|
|
18
|
+
|
|
19
|
+
import requests
|
|
20
|
+
|
|
21
|
+
from camel.utils import api_keys_required
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class MinerU:
|
|
25
|
+
r"""Document extraction service supporting OCR, formula recognition
|
|
26
|
+
and tables.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
api_key (str, optional): Authentication key for MinerU API service.
|
|
30
|
+
If not provided, will use MINERU_API_KEY environment variable.
|
|
31
|
+
(default: :obj:`None`)
|
|
32
|
+
api_url (str, optional): Base URL endpoint for the MinerU API service.
|
|
33
|
+
(default: :obj:`"https://mineru.net/api/v4"`)
|
|
34
|
+
|
|
35
|
+
Note:
|
|
36
|
+
- Single file size limit: 200MB
|
|
37
|
+
- Page limit per file: 600 pages
|
|
38
|
+
- Daily high-priority parsing quota: 2000 pages
|
|
39
|
+
- Some URLs (GitHub, AWS) may timeout due to network restrictions
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
@api_keys_required(
|
|
43
|
+
[
|
|
44
|
+
("api_key", "MINERU_API_KEY"),
|
|
45
|
+
]
|
|
46
|
+
)
|
|
47
|
+
def __init__(
|
|
48
|
+
self,
|
|
49
|
+
api_key: Optional[str] = None,
|
|
50
|
+
api_url: Optional[str] = "https://mineru.net/api/v4",
|
|
51
|
+
is_ocr: bool = False,
|
|
52
|
+
enable_formula: bool = False,
|
|
53
|
+
enable_table: bool = True,
|
|
54
|
+
layout_model: str = "doclayout_yolo",
|
|
55
|
+
language: str = "en",
|
|
56
|
+
) -> None:
|
|
57
|
+
r"""Initialize MinerU extractor.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
api_key (str, optional): Authentication key for MinerU API service.
|
|
61
|
+
If not provided, will use MINERU_API_KEY environment variable.
|
|
62
|
+
api_url (str, optional): Base URL endpoint for MinerU API service.
|
|
63
|
+
(default: "https://mineru.net/api/v4")
|
|
64
|
+
is_ocr (bool, optional): Enable optical character recognition.
|
|
65
|
+
(default: :obj:`False`)
|
|
66
|
+
enable_formula (bool, optional): Enable formula recognition.
|
|
67
|
+
(default: :obj:`False`)
|
|
68
|
+
enable_table (bool, optional): Enable table detection, extraction.
|
|
69
|
+
(default: :obj:`True`)
|
|
70
|
+
layout_model (str, optional): Model for document layout detection.
|
|
71
|
+
Options are 'doclayout_yolo' or 'layoutlmv3'.
|
|
72
|
+
(default: :obj:`"doclayout_yolo"`)
|
|
73
|
+
language (str, optional): Primary language of the document.
|
|
74
|
+
(default: :obj:`"en"`)
|
|
75
|
+
"""
|
|
76
|
+
self._api_key = api_key or os.environ.get("MINERU_API_KEY")
|
|
77
|
+
self._api_url = api_url
|
|
78
|
+
self._headers = {
|
|
79
|
+
"Authorization": f"Bearer {self._api_key}",
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
"Accept": "*/*",
|
|
82
|
+
}
|
|
83
|
+
self.is_ocr = is_ocr
|
|
84
|
+
self.enable_formula = enable_formula
|
|
85
|
+
self.enable_table = enable_table
|
|
86
|
+
self.layout_model = layout_model
|
|
87
|
+
self.language = language
|
|
88
|
+
|
|
89
|
+
def extract_url(self, url: str) -> Dict:
|
|
90
|
+
r"""Extract content from a URL document.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
url (str): Document URL to extract content from.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Dict: Task identifier for tracking extraction progress.
|
|
97
|
+
"""
|
|
98
|
+
endpoint = f"{self._api_url}/extract/task"
|
|
99
|
+
payload = {"url": url}
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
response = requests.post(
|
|
103
|
+
endpoint,
|
|
104
|
+
headers=self._headers,
|
|
105
|
+
json=payload,
|
|
106
|
+
)
|
|
107
|
+
response.raise_for_status()
|
|
108
|
+
return response.json()["data"]
|
|
109
|
+
except Exception as e:
|
|
110
|
+
raise RuntimeError(f"Failed to extract URL: {e}")
|
|
111
|
+
|
|
112
|
+
def batch_extract_urls(
|
|
113
|
+
self,
|
|
114
|
+
files: List[Dict[str, Union[str, bool]]],
|
|
115
|
+
) -> str:
|
|
116
|
+
r"""Extract content from multiple document URLs in batch.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
files (List[Dict[str, Union[str, bool]]]): List of document
|
|
120
|
+
configurations. Each document requires 'url' and optionally
|
|
121
|
+
'is_ocr' and 'data_id' parameters.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
str: Batch identifier for tracking extraction progress.
|
|
125
|
+
"""
|
|
126
|
+
endpoint = f"{self._api_url}/extract/task/batch"
|
|
127
|
+
payload = {"files": files}
|
|
128
|
+
|
|
129
|
+
try:
|
|
130
|
+
response = requests.post(
|
|
131
|
+
endpoint,
|
|
132
|
+
headers=self._headers,
|
|
133
|
+
json=payload,
|
|
134
|
+
)
|
|
135
|
+
response.raise_for_status()
|
|
136
|
+
return response.json()["data"]["batch_id"]
|
|
137
|
+
except Exception as e:
|
|
138
|
+
raise RuntimeError(f"Failed to batch extract URLs: {e}")
|
|
139
|
+
|
|
140
|
+
def get_task_status(self, task_id: str) -> Dict:
|
|
141
|
+
r"""Retrieve status of a single extraction task.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
task_id (str): Unique identifier of the extraction task.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Dict: Current task status and results if completed.
|
|
148
|
+
"""
|
|
149
|
+
endpoint = f"{self._api_url}/extract/task/{task_id}"
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
response = requests.get(endpoint, headers=self._headers)
|
|
153
|
+
response.raise_for_status()
|
|
154
|
+
return response.json()["data"]
|
|
155
|
+
except Exception as e:
|
|
156
|
+
raise RuntimeError(f"Failed to get task status: {e}")
|
|
157
|
+
|
|
158
|
+
def get_batch_status(self, batch_id: str) -> Dict:
|
|
159
|
+
r"""Retrieve status of a batch extraction task.
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
batch_id (str): Unique identifier of the batch extraction task.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
Dict: Current status and results for all documents in the batch.
|
|
166
|
+
"""
|
|
167
|
+
endpoint = f"{self._api_url}/extract-results/batch/{batch_id}"
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
response = requests.get(endpoint, headers=self._headers)
|
|
171
|
+
response.raise_for_status()
|
|
172
|
+
return response.json()["data"]
|
|
173
|
+
except Exception as e:
|
|
174
|
+
raise RuntimeError(f"Failed to get batch status: {e}")
|
|
175
|
+
|
|
176
|
+
def wait_for_completion(
|
|
177
|
+
self,
|
|
178
|
+
task_id: str,
|
|
179
|
+
is_batch: bool = False,
|
|
180
|
+
timeout: float = 100,
|
|
181
|
+
check_interval: float = 5,
|
|
182
|
+
) -> Dict:
|
|
183
|
+
r"""Monitor task until completion or timeout.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
task_id (str): Unique identifier of the task or batch.
|
|
187
|
+
is_batch (bool, optional): Indicates if task is a batch operation.
|
|
188
|
+
(default: :obj:`False`)
|
|
189
|
+
timeout (float, optional): Maximum wait time in seconds.
|
|
190
|
+
(default: :obj:`100`)
|
|
191
|
+
check_interval (float, optional): Time between status checks in
|
|
192
|
+
seconds. (default: :obj:`5`)
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
Dict: Final task status and extraction results.
|
|
196
|
+
|
|
197
|
+
Raises:
|
|
198
|
+
TimeoutError: If task exceeds specified timeout duration.
|
|
199
|
+
RuntimeError: If task fails or encounters processing error.
|
|
200
|
+
"""
|
|
201
|
+
start_time = time.time()
|
|
202
|
+
while True:
|
|
203
|
+
if time.time() - start_time > timeout:
|
|
204
|
+
raise TimeoutError(
|
|
205
|
+
f"Task {task_id} timed out after {timeout}s"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
try:
|
|
209
|
+
status = (
|
|
210
|
+
self.get_batch_status(task_id)
|
|
211
|
+
if is_batch
|
|
212
|
+
else self.get_task_status(task_id)
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
if is_batch:
|
|
216
|
+
# Check batch status
|
|
217
|
+
all_done = True
|
|
218
|
+
failed_tasks = []
|
|
219
|
+
for result in status.get('extract_result', []):
|
|
220
|
+
if result.get('state') == 'failed':
|
|
221
|
+
failed_tasks.append(
|
|
222
|
+
f"{result.get('data_id')}:"
|
|
223
|
+
f" {result.get('err_msg')}"
|
|
224
|
+
)
|
|
225
|
+
elif result.get('state') != 'done':
|
|
226
|
+
all_done = False
|
|
227
|
+
break
|
|
228
|
+
|
|
229
|
+
if failed_tasks:
|
|
230
|
+
raise RuntimeError(
|
|
231
|
+
f"Batch tasks failed: {'; '.join(failed_tasks)}"
|
|
232
|
+
)
|
|
233
|
+
if all_done:
|
|
234
|
+
return status
|
|
235
|
+
else:
|
|
236
|
+
# Check single task status
|
|
237
|
+
state = status.get('state')
|
|
238
|
+
if state == 'failed':
|
|
239
|
+
raise RuntimeError(
|
|
240
|
+
f"Task failed: {status.get('err_msg')}"
|
|
241
|
+
)
|
|
242
|
+
elif state == 'done':
|
|
243
|
+
return status
|
|
244
|
+
|
|
245
|
+
except Exception as e:
|
|
246
|
+
if not isinstance(e, RuntimeError):
|
|
247
|
+
raise RuntimeError(f"Error checking status: {e}")
|
|
248
|
+
raise
|
|
249
|
+
|
|
250
|
+
time.sleep(check_interval)
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
13
|
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
+
import abc
|
|
15
|
+
import re
|
|
14
16
|
from abc import ABC, abstractmethod
|
|
15
17
|
from typing import Any, Dict, List, Optional, Union
|
|
16
18
|
|
|
@@ -27,7 +29,30 @@ from camel.types import (
|
|
|
27
29
|
from camel.utils import BaseTokenCounter
|
|
28
30
|
|
|
29
31
|
|
|
30
|
-
class
|
|
32
|
+
class ModelBackendMeta(abc.ABCMeta):
|
|
33
|
+
r"""Metaclass that automatically preprocesses messages in run method.
|
|
34
|
+
|
|
35
|
+
Automatically wraps the run method of any class inheriting from
|
|
36
|
+
BaseModelBackend to preprocess messages (remove <think> tags) before they
|
|
37
|
+
are sent to the model.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __new__(mcs, name, bases, namespace):
|
|
41
|
+
r"""Wraps run method with preprocessing if it exists in the class."""
|
|
42
|
+
if 'run' in namespace:
|
|
43
|
+
original_run = namespace['run']
|
|
44
|
+
|
|
45
|
+
def wrapped_run(
|
|
46
|
+
self, messages: List[OpenAIMessage], *args, **kwargs
|
|
47
|
+
):
|
|
48
|
+
messages = self.preprocess_messages(messages)
|
|
49
|
+
return original_run(self, messages, *args, **kwargs)
|
|
50
|
+
|
|
51
|
+
namespace['run'] = wrapped_run
|
|
52
|
+
return super().__new__(mcs, name, bases, namespace)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class BaseModelBackend(ABC, metaclass=ModelBackendMeta):
|
|
31
56
|
r"""Base class for different model backends.
|
|
32
57
|
It may be OpenAI API, a local LLM, a stub for unit tests, etc.
|
|
33
58
|
|
|
@@ -73,6 +98,34 @@ class BaseModelBackend(ABC):
|
|
|
73
98
|
"""
|
|
74
99
|
pass
|
|
75
100
|
|
|
101
|
+
def preprocess_messages(
|
|
102
|
+
self, messages: List[OpenAIMessage]
|
|
103
|
+
) -> List[OpenAIMessage]:
|
|
104
|
+
r"""Preprocess messages before sending to model API.
|
|
105
|
+
Removes thinking content and other model-specific preprocessing.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
messages (List[OpenAIMessage]): Original messages
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
List[OpenAIMessage]: Preprocessed messages
|
|
112
|
+
"""
|
|
113
|
+
# Remove thinking content from messages before sending to API
|
|
114
|
+
# This ensures only the final response is sent, excluding
|
|
115
|
+
# intermediate thought processes
|
|
116
|
+
return [
|
|
117
|
+
{ # type: ignore[misc]
|
|
118
|
+
**msg,
|
|
119
|
+
'content': re.sub(
|
|
120
|
+
r'<think>.*?</think>',
|
|
121
|
+
'',
|
|
122
|
+
msg['content'], # type: ignore[arg-type]
|
|
123
|
+
flags=re.DOTALL,
|
|
124
|
+
).strip(),
|
|
125
|
+
}
|
|
126
|
+
for msg in messages
|
|
127
|
+
]
|
|
128
|
+
|
|
76
129
|
@abstractmethod
|
|
77
130
|
def run(
|
|
78
131
|
self,
|
|
@@ -118,8 +118,6 @@ class DeepSeekModel(BaseModelBackend):
|
|
|
118
118
|
if self.model_type in [
|
|
119
119
|
ModelType.DEEPSEEK_REASONER,
|
|
120
120
|
]:
|
|
121
|
-
import re
|
|
122
|
-
|
|
123
121
|
logger.warning(
|
|
124
122
|
"You are using a DeepSeek Reasoner model, "
|
|
125
123
|
"which has certain limitations, reference: "
|
|
@@ -141,22 +139,6 @@ class DeepSeekModel(BaseModelBackend):
|
|
|
141
139
|
if key in self.model_config_dict:
|
|
142
140
|
del self.model_config_dict[key]
|
|
143
141
|
|
|
144
|
-
# Remove thinking content from messages before sending to API
|
|
145
|
-
# This ensures only the final response is sent, excluding
|
|
146
|
-
# intermediate thought processes
|
|
147
|
-
messages = [
|
|
148
|
-
{ # type: ignore[misc]
|
|
149
|
-
**msg,
|
|
150
|
-
'content': re.sub(
|
|
151
|
-
r'<think>.*?</think>',
|
|
152
|
-
'',
|
|
153
|
-
msg['content'], # type: ignore[arg-type]
|
|
154
|
-
flags=re.DOTALL,
|
|
155
|
-
).strip(),
|
|
156
|
-
}
|
|
157
|
-
for msg in messages
|
|
158
|
-
]
|
|
159
|
-
|
|
160
142
|
response = self._client.chat.completions.create(
|
|
161
143
|
messages=messages,
|
|
162
144
|
model=self.model_type,
|
|
@@ -45,8 +45,10 @@ from .human_toolkit import HumanToolkit
|
|
|
45
45
|
from .stripe_toolkit import StripeToolkit
|
|
46
46
|
from .video_toolkit import VideoDownloaderToolkit
|
|
47
47
|
from .dappier_toolkit import DappierToolkit
|
|
48
|
-
from .sympy_toolkit import SymPyToolkit
|
|
49
48
|
from .semantic_scholar_toolkit import SemanticScholarToolkit
|
|
49
|
+
from .sympy_toolkit import SymPyToolkit
|
|
50
|
+
from .mineru_toolkit import MinerUToolkit
|
|
51
|
+
|
|
50
52
|
|
|
51
53
|
__all__ = [
|
|
52
54
|
'BaseToolkit',
|
|
@@ -79,6 +81,7 @@ __all__ = [
|
|
|
79
81
|
'MeshyToolkit',
|
|
80
82
|
'OpenBBToolkit',
|
|
81
83
|
'DappierToolkit',
|
|
82
|
-
'SymPyToolkit',
|
|
83
84
|
'SemanticScholarToolkit',
|
|
85
|
+
'SymPyToolkit',
|
|
86
|
+
'MinerUToolkit',
|
|
84
87
|
]
|