Skip to main content

DEPRECATED: Package with CodeMie tools for AI Agents

Project description

Codemie Tools

⚠️ DEPRECATED

This package is no longer maintained and has been deprecated. All functionality has been migrated to the CodeMie backend.

Do not use this package for new projects. If you would like to contribute to this logic, please check the CodeMie backend.

Overview

Codemie Tools is a comprehensive toolkit designed to simplify and streamline various development tasks. This toolkit provides a set of tools for access management, notification, code quality, data management, version control, project management, research, PDF processing, and image text extraction.

Installation

To install Codemie Tools, use the following pip command:

pip install codemie-tools
poetry add codemie-tools

For local development, clone the repository and run:

make install
make build

Usage

Using get_toolkit Function

The get_toolkit function is used to get the toolkit instance with the provided configuration.

⚠️ IMPORTANT (v0.1.11.0+): All tool configuration classes that will be stored in the database and displayed in the UI MUST define the credential_type field. This is a mandatory requirement for proper integration with the settings management system. See examples below for the correct pattern.

Here is an example of how to use this function:

from codemie_tools.<toolkit_module> import <ToolkitClass>

# Note: When defining configuration models for database/UI storage,
# ensure they include the credential_type field (see Toolkit sections below)

config = {
    'email': {
        'url': 'smtp.example.com',
        'smtp_username': 'your_username',
        'smtp_password': 'your_password'
    },
    'keycloak': {
        'base_url': 'http://localhost:8080',
        'realm': 'example-realm',
        'client_id': 'example-client-id',
        'client_secret': 'example-client-secret',
        'username': 'admin',
        'password': 'password'
    },
    'sonar_creds': {
        'url': 'http://sonarqube.example.com',
        'sonar_token': 'your_sonar_token',
        'sonar_project_name': 'example_project'
    },
    'elastic': {
        'hosts': ['http://localhost:9200'],
        'username': 'elastic',
        'password': 'password'
    },
    'jira': {
        'url': 'http://jira.example.com',
        'token': 'your_jira_token'
    },
    'confluence': {
        'url': 'http://confluence.example.com',
        'token': 'your_confluence_token'
    },
    'research_config': {
        'google_search_api_key': 'your_google_search_api_key',
        'google_search_cde_id': 'your_google_search_cde_id'
    },
    'root_directory': '/path/to/root_directory',
    'user_id': 'your_user_id',
    'azure_dalle_config': {
        'api_key': 'your_azure_dalle_api_key'
    }
}

toolkit = <ToolkitClass>.get_toolkit(config)
tools = toolkit.get_tools()

Toolkits

Access Management Toolkit

from codemie_tools.access_management.toolkit import AccessManagementToolkit

config = {
    'keycloak': {
        'base_url': 'http://localhost:8080',
        'realm': 'example-realm',
        'client_id': 'example-client-id',
        'client_secret': 'example-client-secret'
    }
}

toolkit = AccessManagementToolkit.get_toolkit(config)

Notification Toolkit

from codemie_tools.notification.toolkit import NotificationToolkit

config = {
    'email': {
        'url': 'smtp.example.com',
        'smtp_username': 'your_username',
        'smtp_password': 'your_password'
    }
}

toolkit = NotificationToolkit.get_toolkit(config)

Code Toolkit

from codemie_tools.code.sonar.toolkit import SonarToolkit

config = {
    'url': 'http://sonarqube.example.com',
    'sonar_token': 'your_sonar_token',
    'sonar_project_name': 'example_project'
}

toolkit = SonarToolkit.get_toolkit(config)

Data Management Toolkit

from codemie_tools.data_management.toolkit import DataManagementToolkit

config = {
    'elastic': {
        'url': ['http://localhost:9200'],
        'api_key': 'elastic'
    }
}

toolkit = DataManagementToolkit.get_toolkit(config)

Version Control Toolkit

from codemie_tools.vcs.toolkit import VcsToolkit

config = {
    'base_url': 'http://gitlab.example.com',
    'access_token': 'your_gitlab_access_token'
}

toolkit = VcsToolkit.get_toolkit(config)

Project Management Toolkit

from codemie_tools.project_management.toolkit import ProjectManagementToolkit

config = {
    'jira': {
        'url': 'http://jira.example.com',
        'token': 'your_jira_token'
    },
    'confluence': {
        'url': 'http://confluence.example.com',
        'token': 'your_confluence_token'
    }
}

toolkit = ProjectManagementToolkit.get_toolkit(config)

Research Toolkit

from codemie_tools.research.toolkit import ResearchToolkit

config = {
    'google_search_api_key': 'your_google_search_api_key',
    'google_search_cde_id': 'your_google_search_cde_id'
}

toolkit = ResearchToolkit.get_toolkit(config)

File System Toolkit

from codemie_tools.data_management.file_system.toolkit import FileSystemToolkit

config = {
    'root_directory': '/path/to/root_directory',
    'user_id': 'your_user_id',
    'azure_dalle_config': {
        'api_key': 'your_azure_dalle_api_key',
        ...
    }
}

toolkit = FileSystemToolkit.get_toolkit(config)

PDF Processing Toolkit

from codemie_tools.pdf.toolkit import PDFToolkit
from langchain_openai import ChatOpenAI

# Create a vision-capable LLM for OCR capabilities
chat_model = ChatOpenAI(model_name="gpt-4-vision-preview", max_tokens=1000)

# PDF processing without OCR
pdf_toolkit = PDFToolkit.get_toolkit(
    configs={"pdf_bytes": pdf_content_bytes}
)

# PDF processing with OCR capabilities for extracting text from images
pdf_toolkit_with_ocr = PDFToolkit.get_toolkit(
    configs={"pdf_bytes": pdf_content_bytes},
    chat_model=chat_model
)

# Get tools for extracting text, analyzing structure, and performing OCR
tools = pdf_toolkit_with_ocr.get_tools()

# Example usage:
pdf_tool = tools[0]

# Get total pages
total_pages = pdf_tool.execute(pages=[], query="Total_Pages")

# Extract text from pages 1-3
text_content = pdf_tool.execute(pages=[1, 2, 3], query="Text")

# Extract text with metadata
text_with_metadata = pdf_tool.execute(pages=[1], query="Text_with_Metadata")

# Extract text from images using OCR
image_text = pdf_tool.execute(pages=[1, 2], query="OCR_Images")

# Use the dedicated OCR tool for more control
ocr_tool = tools[1]  # Available if a chat_model was provided
specific_image_text = ocr_tool.execute(
    pages=[1],  # Process page 1
    image_indices=[0, 1]  # Only process the first two images on the page
)

Configuration Model Requirements (v0.1.11.0+)

⚠️ CRITICAL: All CodeMieToolConfig subclasses that will be stored in the database or displayed in the UI MUST define the credential_type field with the following attributes:

from pydantic import Field
from codemie_tools.base.models import CodeMieToolConfig, CredentialTypes

class MyToolConfig(CodeMieToolConfig):
    """Configuration for my tool."""

    # ✅ REQUIRED: Define credential_type field
    credential_type: CredentialTypes = Field(
        default=CredentialTypes.JIRA,  # Replace with appropriate type
        exclude=True,  # Exclude from serialization
        frozen=True    # Prevent modification
    )

    # ... rest of your configuration fields

Why credential_type is Required

  • Database Integration: Used by the backend to categorize and store configurations
  • UI Display: Enables proper organization and display of credential settings
  • Settings Management: Required for the settings management system to route configurations correctly
  • Type Safety: Ensures configuration compatibility with the expected credential type

Available CredentialTypes

Choose the appropriate type from codemie_tools.base.models.CredentialTypes:

  • JIRA, CONFLUENCE - Project management
  • GIT - Version control (GitLab, GitHub, etc.)
  • KUBERNETES, AWS, GCP, AZURE - Cloud platforms
  • EMAIL, TELEGRAM - Notifications
  • SONAR - Code quality
  • ELASTIC, SQL - Data storage
  • ZEPHYR_SCALE, ZEPHYR_SQUAD - Test management
  • SERVICENOW, REPORT_PORTAL - ITSM and reporting
  • And many more (see codemie_tools.base.models.CredentialTypes for full list)

Real-World Example

from pydantic import Field
from codemie_tools.base.models import CodeMieToolConfig, CredentialTypes, RequiredField

class JiraConfig(CodeMieToolConfig):
    """Jira configuration with credential_type."""

    credential_type: CredentialTypes = Field(
        default=CredentialTypes.JIRA,
        exclude=True,
        frozen=True
    )

    url: str = RequiredField(
        description="Jira instance URL",
        json_schema_extra={"placeholder": "https://jira.example.com"}
    )

    token: str = RequiredField(
        description="API token for authentication",
        json_schema_extra={"sensitive": True}
    )

For more details, see the Development Guide.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codemie_tools-0.1.14.0.tar.gz (246.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codemie_tools-0.1.14.0-py3-none-any.whl (353.6 kB view details)

Uploaded Python 3

File details

Details for the file codemie_tools-0.1.14.0.tar.gz.

File metadata

  • Download URL: codemie_tools-0.1.14.0.tar.gz
  • Upload date:
  • Size: 246.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for codemie_tools-0.1.14.0.tar.gz
Algorithm Hash digest
SHA256 2fead826ae60ed654efbfc932597f0bdc48374fec827a0b652879482ab000cb2
MD5 cf1a4c3e8a5998f8c5ba17c13c172fc5
BLAKE2b-256 8d14f18187d26ea04255a3bdae5ea10327a04c9c071ea9bda36ab9753e002c57

See more details on using hashes here.

File details

Details for the file codemie_tools-0.1.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for codemie_tools-0.1.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 00a8c90d40a111cf65a75eb10c5caca6840a3f93abe99444281efdfd8e5a8e12
MD5 89ec112b6f5acfc3e85fa053690a2d92
BLAKE2b-256 e9b3f68bfc9f76015c5bebcf9648194c55cef4f2c394491b28ec6d82d7b60de6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page