crewai-logging-patch


Namecrewai-logging-patch JSON
Version 0.5 PyPI version JSON
download
home_pagehttps://github.com/theCyberTech/CrewAI_Logger_Patch
SummaryNone
upload_time2024-05-26 04:18:30
maintainerNone
docs_urlNone
authortheCyberTech
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            1. Install via pip 
``` pip install crewai-logging-patch```
2. Add import into your main crewai file - This needs to be above any other crewai imports
``` from logger_patch import apply_monkey_patch```
3. Add the patch method to your code - This needs to be above any other crewai imports
```apply_monkey_patch()```
4. Add the following directly below your agent instances - You must use your agent names in place of <placeholder_name>
```<placeholder_name>._logger = crewai.utilities.Logger(verbose_level=<placeholder_name>.verbose)```
5. And the same below your crew instance, again you must use your crew name in place of <placeholder_name>
```<placeholder_name>._logger = crewai.utilities.Logger(verbose_level=<placeholder_name>.verbose)```
6. Ensure that verbose=True is set in your agent and crew instances
7. Below is an example crewfile with all of this implemented
```python
import os
from logger_patch import apply_monkey_patch

# Apply the monkey patch
apply_monkey_patch()

# Now use crewai and other imports as usual
from crewai import Agent, Crew, Task, Process
import crewai.utilities

# Setup LM Studio environment variables
os.environ['OPENAI_API_BASE'] = 'http://localhost:1234/v1'
os.environ['OPENAI_API_KEY'] = 'sk-111111111111111111111111111111111111111111111111'
os.environ['OPENAI_MODEL_NAME'] = 'Meta-Llama-3-8B-Instruct-imatrix'

# Create the agent
try:
    researcher = Agent(
        role='Researcher',
        goal='Research the topic',
        backstory='As an expert in the field of {topic}, you will research the topic and provide the necessary information',
        max_iter=3,
        max_rpm=100,
        verbose=True,
        allow_delegation=False,
    )

    # Manually set the logger to ensure it's the patched logger
    researcher._logger = crewai.utilities.Logger(verbose_level=researcher.verbose)

    # Create the task
    research_task = Task(
        description='Research the topic',
        agent=researcher,
        expected_output='5 paragraphs of information on the topic',
        output_file='research_result.txt',
    )


    # Create the crew
    crew = Crew(
        agents=[researcher],
        tasks=[research_task],
        process=Process.sequential,
        verbose=True,
        memory=False,
        cache=False,
        max_rpm=100,
    )

    # Manually set the logger for crew to ensure it's the patched logger
    crew._logger = crewai.utilities.Logger(verbose_level=crew.verbose)

    # Start the crew
    result = crew.kickoff(inputs={'topic': '70s, 80s and 90s Australian rock bands'})

except Exception as e:
    print(f"An error occurred: {e}")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/theCyberTech/CrewAI_Logger_Patch",
    "name": "crewai-logging-patch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "theCyberTech",
    "author_email": "the_t3ch@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/4d/c4/9657b2c7fcc74b00e2ec7fcf29cc80308035a697f4f5aa7025b7e3469b4e/crewai_logging_patch-0.5.tar.gz",
    "platform": null,
    "description": "1. Install via pip \n``` pip install crewai-logging-patch```\n2. Add import into your main crewai file - This needs to be above any other crewai imports\n``` from logger_patch import apply_monkey_patch```\n3. Add the patch method to your code - This needs to be above any other crewai imports\n```apply_monkey_patch()```\n4. Add the following directly below your agent instances - You must use your agent names in place of <placeholder_name>\n```<placeholder_name>._logger = crewai.utilities.Logger(verbose_level=<placeholder_name>.verbose)```\n5. And the same below your crew instance, again you must use your crew name in place of <placeholder_name>\n```<placeholder_name>._logger = crewai.utilities.Logger(verbose_level=<placeholder_name>.verbose)```\n6. Ensure that verbose=True is set in your agent and crew instances\n7. Below is an example crewfile with all of this implemented\n```python\nimport os\nfrom logger_patch import apply_monkey_patch\n\n# Apply the monkey patch\napply_monkey_patch()\n\n# Now use crewai and other imports as usual\nfrom crewai import Agent, Crew, Task, Process\nimport crewai.utilities\n\n# Setup LM Studio environment variables\nos.environ['OPENAI_API_BASE'] = 'http://localhost:1234/v1'\nos.environ['OPENAI_API_KEY'] = 'sk-111111111111111111111111111111111111111111111111'\nos.environ['OPENAI_MODEL_NAME'] = 'Meta-Llama-3-8B-Instruct-imatrix'\n\n# Create the agent\ntry:\n    researcher = Agent(\n        role='Researcher',\n        goal='Research the topic',\n        backstory='As an expert in the field of {topic}, you will research the topic and provide the necessary information',\n        max_iter=3,\n        max_rpm=100,\n        verbose=True,\n        allow_delegation=False,\n    )\n\n    # Manually set the logger to ensure it's the patched logger\n    researcher._logger = crewai.utilities.Logger(verbose_level=researcher.verbose)\n\n    # Create the task\n    research_task = Task(\n        description='Research the topic',\n        agent=researcher,\n        expected_output='5 paragraphs of information on the topic',\n        output_file='research_result.txt',\n    )\n\n\n    # Create the crew\n    crew = Crew(\n        agents=[researcher],\n        tasks=[research_task],\n        process=Process.sequential,\n        verbose=True,\n        memory=False,\n        cache=False,\n        max_rpm=100,\n    )\n\n    # Manually set the logger for crew to ensure it's the patched logger\n    crew._logger = crewai.utilities.Logger(verbose_level=crew.verbose)\n\n    # Start the crew\n    result = crew.kickoff(inputs={'topic': '70s, 80s and 90s Australian rock bands'})\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "0.5",
    "project_urls": {
        "Homepage": "https://github.com/theCyberTech/CrewAI_Logger_Patch"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d0649746cc0930efbb9c16673e6195e082800c3ebe0df209383f862135fa41e",
                "md5": "ec5f9325dba579f5029032230e371f8b",
                "sha256": "be9a37f478ea50613baeb224722008f8c19c6ab1241e6d4ca3ca6d0fbe224224"
            },
            "downloads": -1,
            "filename": "crewai_logging_patch-0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ec5f9325dba579f5029032230e371f8b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3808,
            "upload_time": "2024-05-26T04:18:29",
            "upload_time_iso_8601": "2024-05-26T04:18:29.108072Z",
            "url": "https://files.pythonhosted.org/packages/4d/06/49746cc0930efbb9c16673e6195e082800c3ebe0df209383f862135fa41e/crewai_logging_patch-0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4dc49657b2c7fcc74b00e2ec7fcf29cc80308035a697f4f5aa7025b7e3469b4e",
                "md5": "198f3ec5f2c3dd1a62bccccc5812d3cc",
                "sha256": "ebefaee304cf2f6c0d75636c81f4012bf5e6fe59dc44d4bc6d5f45f7b1cc33eb"
            },
            "downloads": -1,
            "filename": "crewai_logging_patch-0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "198f3ec5f2c3dd1a62bccccc5812d3cc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3268,
            "upload_time": "2024-05-26T04:18:30",
            "upload_time_iso_8601": "2024-05-26T04:18:30.578087Z",
            "url": "https://files.pythonhosted.org/packages/4d/c4/9657b2c7fcc74b00e2ec7fcf29cc80308035a697f4f5aa7025b7e3469b4e/crewai_logging_patch-0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-26 04:18:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "theCyberTech",
    "github_project": "CrewAI_Logger_Patch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "crewai-logging-patch"
}
        
Elapsed time: 0.22813s