feat: Updated the Python demo tool to show all possible parameter types and variations
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
from typing import List, Literal, Optional
|
from typing import List, Literal, Optional
|
||||||
|
|
||||||
|
|
||||||
def run(
|
def run(
|
||||||
string: str,
|
string: str,
|
||||||
string_enum: Literal["foo", "bar"],
|
string_enum: Literal["foo", "bar"],
|
||||||
@@ -9,26 +10,38 @@ def run(
|
|||||||
number: float,
|
number: float,
|
||||||
array: List[str],
|
array: List[str],
|
||||||
string_optional: Optional[str] = None,
|
string_optional: Optional[str] = None,
|
||||||
|
integer_with_default: int = 42,
|
||||||
|
boolean_with_default: bool = True,
|
||||||
|
number_with_default: float = 3.14,
|
||||||
|
string_with_default: str = "hello",
|
||||||
array_optional: Optional[List[str]] = None,
|
array_optional: Optional[List[str]] = None,
|
||||||
):
|
):
|
||||||
"""Demonstrates how to create a tool using Python and how to use comments.
|
"""Demonstrates all supported Python parameter types and variations.
|
||||||
Args:
|
Args:
|
||||||
string: Define a required string property
|
string: A required string property
|
||||||
string_enum: Define a required string property with enum
|
string_enum: A required string property constrained to specific values
|
||||||
boolean: Define a required boolean property
|
boolean: A required boolean property
|
||||||
integer: Define a required integer property
|
integer: A required integer property
|
||||||
number: Define a required number property
|
number: A required number (float) property
|
||||||
array: Define a required string array property
|
array: A required string array property
|
||||||
string_optional: Define an optional string property
|
string_optional: An optional string property (Optional[str] with None default)
|
||||||
array_optional: Define an optional string array property
|
integer_with_default: An optional integer with a non-None default value
|
||||||
|
boolean_with_default: An optional boolean with a default value
|
||||||
|
number_with_default: An optional number with a default value
|
||||||
|
string_with_default: An optional string with a default value
|
||||||
|
array_optional: An optional string array property
|
||||||
"""
|
"""
|
||||||
output = f"""string: {string}
|
output = f"""string: {string}
|
||||||
string_enum: {string_enum}
|
string_enum: {string_enum}
|
||||||
string_optional: {string_optional}
|
|
||||||
boolean: {boolean}
|
boolean: {boolean}
|
||||||
integer: {integer}
|
integer: {integer}
|
||||||
number: {number}
|
number: {number}
|
||||||
array: {array}
|
array: {array}
|
||||||
|
string_optional: {string_optional}
|
||||||
|
integer_with_default: {integer_with_default}
|
||||||
|
boolean_with_default: {boolean_with_default}
|
||||||
|
number_with_default: {number_with_default}
|
||||||
|
string_with_default: {string_with_default}
|
||||||
array_optional: {array_optional}"""
|
array_optional: {array_optional}"""
|
||||||
|
|
||||||
for key, value in os.environ.items():
|
for key, value in os.environ.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user