Ready-to-use plugins and tools for Semantic Kernel
Project description
Semantic Kernel Ready to Use Plugins
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
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semantic_kernel_plugins-0.1.1.tar.gz.
File metadata
- Download URL: semantic_kernel_plugins-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
821af41ff1ad59a0af5d523fc8029e4c047ca839b6203c0ed79b43c675f9b91d
|
|
| MD5 |
261e9255b9a4132d6acf2d01ca1f8022
|
|
| BLAKE2b-256 |
6d368c3fa450d4a29ea72304a21daef415e009192050faef0ac0029a1ed5a484
|
File details
Details for the file semantic_kernel_plugins-0.1.1-py3-none-any.whl.
File metadata
- Download URL: semantic_kernel_plugins-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90fec5122cef0e7a51cfd5f1f1674db46131675c364787e1101d055e47789e86
|
|
| MD5 |
5229f3f1d1a63fcc788099db1b10193d
|
|
| BLAKE2b-256 |
c91c9d8f5d5a9ade4be99fda3e632de1cd9d1cd9b88e4d6155828c8540eb1fc1
|