-
Notifications
You must be signed in to change notification settings - Fork 888
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07adbac
commit f74000c
Showing
2 changed files
with
34 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,23 @@ | ||
from promptflow.core import ToolProvider, tool | ||
from promptflow.entities import InputSetting | ||
from promptflow.connections import AzureOpenAIConnection | ||
|
||
groups = [{ | ||
"name": "Tools", | ||
"description": "Configure interactive capabilities by selecting tools for the model to use and guiding its tool call decisions.", | ||
"inputs": ["tools", "tool_choice"], | ||
"ui_hints": {"display_style": "table"} | ||
}] | ||
input_settings = InputSetting( | ||
filter_by={ | ||
"input_name": "connection", | ||
"filter_attribute": "type", | ||
"values": { | ||
"AzureOpenAIConnection": { | ||
"enum": [ | ||
"chat", | ||
"completion" | ||
] | ||
}, | ||
"OpenAIConnection": { | ||
"enum": [ | ||
"chat", | ||
"completion" | ||
] | ||
}, | ||
"ServerlessConnection": { | ||
"enum": [ | ||
"chat" | ||
] | ||
} | ||
} | ||
} | ||
) | ||
|
||
|
||
@tool( | ||
name="python_tool", | ||
groups=groups, | ||
input_settings={ | ||
"input1": input_settings | ||
} | ||
) | ||
|
||
@tool(name="python_tool") | ||
def my_python_tool(input1: str) -> str: | ||
return 'hello ' + input1 | ||
# | ||
# | ||
# @tool | ||
# def my_python_tool_without_name(input1: str) -> str: | ||
# return 'hello ' + input1 | ||
# | ||
# | ||
# class PythonTool(ToolProvider): | ||
# | ||
# def __init__(self, connection: AzureOpenAIConnection): | ||
# super().__init__() | ||
# self.connection = connection | ||
# | ||
# @tool | ||
# def python_tool(self, input1: str) -> str: | ||
# return 'hello ' + input1 | ||
|
||
|
||
@tool | ||
def my_python_tool_without_name(input1: str) -> str: | ||
return 'hello ' + input1 | ||
|
||
|
||
class PythonTool(ToolProvider): | ||
|
||
def __init__(self, connection: AzureOpenAIConnection): | ||
super().__init__() | ||
self.connection = connection | ||
|
||
@tool | ||
def python_tool(self, input1: str) -> str: | ||
return 'hello ' + input1 |