From 732eae532c8e8632db95ab80e0dde5071e744386 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 10 Jul 2024 18:53:32 +0800 Subject: feat: adjust the way of returning data to LLM (#69) --- tools/demo_py.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'tools/demo_py.py') diff --git a/tools/demo_py.py b/tools/demo_py.py index d53cd0b..dd0bb1d 100644 --- a/tools/demo_py.py +++ b/tools/demo_py.py @@ -2,29 +2,37 @@ import os from typing import List, Literal, Optional def run( - boolean: bool, string: str, string_enum: Literal["foo", "bar"], + boolean: bool, integer: int, number: float, array: List[str], string_optional: Optional[str] = None, array_optional: Optional[List[str]] = None, -) -> None: +): """Demonstrate how to create a tool using Python and how to use comments. Args: - boolean: Define a required boolean property string: Define a required string property string_enum: Define a required string property with enum + boolean: Define a required boolean property integer: Define a required integer property number: Define a required number property array: Define a required string array property string_optional: Define a optional string property array_optional: Define a optional string array property """ - for key, value in locals().items(): - print(f"{key}: {value}") + output = f"""string: {string} +string_enum: {string_enum} +string_optional: {string_optional} +boolean: {boolean} +integer: {integer} +number: {number} +array: {array} +array_optional: {array_optional}""" for key, value in os.environ.items(): if key.startswith("LLM_"): - print(f"{key}: {value}") \ No newline at end of file + output = f"{output}\n{key}: {value}" + + return output -- cgit v1.2.3