Prompt Flow Built-in Tools
raw JSON → 1.6.1 verified Mon Apr 27 auth: no python
Built-in tools for Microsoft Prompt flow, providing ready-to-use tools like LLM (OpenAI, Azure OpenAI), Python, SerpAPI, and more. Currently at version 1.6.1, with the parent promptflow package at 1.17.1. Regular releases track the promptflow SDK.
pip install promptflow-tools Common errors
error ModuleNotFoundError: No module named 'promptflow_tools' ↓
cause Upgraded to promptflow-tools 1.0.0+ where the package structure changed; top-level 'promptflow_tools' no longer exists.
fix
Use 'from promptflow.tools.<tool_name> import <ToolClass>' instead.
error ImportError: cannot import name 'AzureOpenAI' from 'promptflow.tools.azure_openai' ↓
cause Class renamed from 'AzureOpenAI' to 'AzureOpenAITool' in version 1.0.0.
fix
Change import to 'from promptflow.tools.azure_openai import AzureOpenAITool'.
error AttributeError: 'AzureOpenAITool' object has no attribute 'run' ↓
cause Trying to call .run() directly; tools must be added to a flow and executed via the flow engine.
fix
Create a Flow, add the tool as a node, and run the flow: 'flow = Flow(); flow.add_node(tool, inputs=...); flow.run()'.
error KeyError: 'api_version' is required when using Azure OpenAI tool ↓
cause AzureOpenAITool requires api_version to be specified, but it was omitted. Unlike the older 'AzureOpenAI' class, the new tool enforces this parameter.
fix
Provide api_version as a string, e.g., '2023-12-01-preview'.
Warnings
breaking Import paths changed in promptflow-tools 1.0.0: all tools moved from 'promptflow.tools.<name>' to relative paths; top-level promptflow_tools is no longer importable. ↓
fix Use 'from promptflow.tools.azure_openai import AzureOpenAITool' (note the dot-separated path with 'promptflow.tools').
gotcha The tools classes have been renamed from generic names like 'OpenAI' to 'OpenAITool'. Using old class names will raise ImportError. ↓
fix Use the 'XxxTool' naming convention: e.g., 'AzureOpenAITool', 'OpenAITool', 'PythonTool'.
deprecated The 'promptflow-tools' package is being deprecated in favor of built-in tools in 'promptflow'. Future releases of promptflow (>=1.12.0) include tools directly, so separate installation may become unnecessary. ↓
fix For promptflow >=1.12.0, import from 'promptflow.tools' directly without installing promptflow-tools separately.
gotcha OpenAI and Azure OpenAI tools require the 'openai' and 'azure-ai-inference' packages respectively. Missing dependencies cause runtime errors on tool instantiation. ↓
fix Install optional dependencies: 'pip install openai' and/or 'pip install azure-ai-inference'.
Imports
- AzureOpenAITool wrong
from promptflow_tools.azure_openai import AzureOpenAIcorrectfrom promptflow.tools.azure_openai import AzureOpenAITool - OpenAITool wrong
from promptflow_tools.openai import OpenAIcorrectfrom promptflow.tools.openai import OpenAITool - PythonTool wrong
from promptflow.tools import PythonToolcorrectfrom promptflow.tools.python import PythonTool - SerpAPITool wrong
from promptflow_tools.serpapi import SerpAPIcorrectfrom promptflow.tools.serpapi import SerpAPITool
Quickstart
from promptflow.tools.azure_openai import AzureOpenAITool
from promptflow.core import Flow
# Use environment variables for credentials
azure_openai = AzureOpenAITool(
api_key=os.environ.get('AZURE_OPENAI_API_KEY', ''),
api_base=os.environ.get('AZURE_OPENAI_ENDPOINT', ''),
api_version='2023-12-01-preview'
)
# Create a simple flow
flow = Flow()
flow.add_node(azure_openai, inputs={'prompt': 'Hello'})
print(flow)