Skip to main content

Ready-to-use plugins and tools for Semantic Kernel

Project description

Semantic Kernel Ready to Use Plugins

Python 3.10+ License MIT

A collection of tools and plugins for Semantic Kernel Framework that enhances AI applications with Python code execution, web search capabilities, and detailed logging.

🚀 Overview

Semantic Kernel Tools provides a set of powerful plugins for the Semantic Kernel Framework:

  • Python Code Generator: Generate and execute Python code safely based on natural language requests
  • Web Search Plugin: Integrate Tavily search API for web search capabilities
  • SK Logger: Enhanced logging with colorful output and detailed tracking

✨ Features

  • Python Code Generation and Execution: Generate robust Python code and execute it in a controlled environment
  • Web Search Integration: Search the web using Tavily API
  • Enhanced Logging: Track AI operations with detailed, colorful logs
  • Extensible Architecture: Easily customize or extend functionality

📋 Requirements

  • Python 3.10+
  • Semantic Kernel 1.0.0+

📥 Installation

pip install semantic-kernel-plugins

🚀 Quick Start

import asyncio
import logging
import os

from dotenv import load_dotenv
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.bedrock import BedrockChatCompletion
from semantic_kernel.connectors.ai.bedrock.bedrock_prompt_execution_settings import \
    BedrockChatPromptExecutionSettings
from semantic_kernel.connectors.ai.function_choice_behavior import \
    FunctionChoiceBehavior
from semantic_kernel.contents.chat_history import ChatHistory
from semantic_kernel.utils.logging import setup_logging

from semantic_kernel_plugins.plugins.python.python_code_generator import \
    PythonCodeGeneratorPlugin
from semantic_kernel_plugins.plugins.web.tavily_web_search import \
    TavilySearchPlugin

async def main():
    kernel = Kernel()

    chat_completion = BedrockChatCompletion(
        model_id=os.getenv("ANTHROPIC_MODEL_ID"),
    )
    kernel.add_service(chat_completion)

    setup_logging()
    logging.getLogger("kernel").setLevel(logging.INFO)

    ## Ready to use plugins - Tavily Web Search
    kernel.add_plugin(
        TavilySearchPlugin(os.getenv("TAVILY_API_KEY")),
        plugin_name="TavilyWebSearch",
    )

    ## Ready to use plugins - Python Code Generator
    execution_settings = BedrockChatPromptExecutionSettings(
        max_tokens=4096,
        temperature=0.5,
    )
    execution_settings.function_choice_behavior = FunctionChoiceBehavior.Auto()

    python_generator = PythonCodeGeneratorPlugin(
        chat_service=chat_completion, execution_settings=execution_settings
    )
    kernel.add_plugin(python_generator, plugin_name="PythonCodeGenerator")

    history = ChatHistory()

    userInput = "<Your Request>"

    history.add_user_message(userInput)
    result = await chat_completion.get_chat_message_content(
        chat_history=history,
        settings=execution_settings,
        kernel=kernel,
    )
    print("\033[1m\033[34mAssistant > \033[0m" + str(result))
    history.add_message(result)

if __name__ == "__main__":
    asyncio.run(main())

📄 License

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


Built with ❤️ for AI developers working with Semantic Kernel.

Project details


Download files

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

Source Distribution

semantic_kernel_plugins-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

semantic_kernel_plugins-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file semantic_kernel_plugins-0.1.0.tar.gz.

File metadata

  • Download URL: semantic_kernel_plugins-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for semantic_kernel_plugins-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5af0c6d5d6284b1655024886c8f467792bbf78a9d2455ae2baf74b98caa41051
MD5 b40602fbe3d4346df4ea45c7ba8f671d
BLAKE2b-256 bcd7f6bc2591bdd2966d14a50bc252d5e8970885c00d655a24bed93f26f714fe

See more details on using hashes here.

File details

Details for the file semantic_kernel_plugins-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for semantic_kernel_plugins-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09213d21db1181e094781c85fa15f0905f79959e5f630c1b6a05ee2691374b63
MD5 e0fa37467ef16b42daa5f7c68bda1d47
BLAKE2b-256 6fee81f1ddca6dbaa1435829467ac5ebe96fcfcc12695c7f5c905aa47472167f

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