From 4a3ee63205f5efcf633adc37defa2363e0dd0546 Mon Sep 17 00:00:00 2001 From: Nicolas Nahas <45595586+nicorne@users.noreply.github.com> Date: Thu, 8 Aug 2024 23:14:07 +0200 Subject: [PATCH] Examples in correct folder --- .../advanced_output_validation.py | 0 .../simple_structured_output.py | 10 +++------- 2 files changed, 3 insertions(+), 7 deletions(-) rename playground/{strcutured_output => tools}/advanced_output_validation.py (100%) rename playground/{strcutured_output => tools}/simple_structured_output.py (82%) diff --git a/playground/strcutured_output/advanced_output_validation.py b/playground/tools/advanced_output_validation.py similarity index 100% rename from playground/strcutured_output/advanced_output_validation.py rename to playground/tools/advanced_output_validation.py diff --git a/playground/strcutured_output/simple_structured_output.py b/playground/tools/simple_structured_output.py similarity index 82% rename from playground/strcutured_output/simple_structured_output.py rename to playground/tools/simple_structured_output.py index d509107b..a8cb8818 100644 --- a/playground/strcutured_output/simple_structured_output.py +++ b/playground/tools/simple_structured_output.py @@ -7,11 +7,7 @@ Structured output example Requirements: Add the folowing API key(s) in your .env file: - OPENAI_API_KEY (this example works best with Openai bc it uses openai function calling structure) - -Note: -If you are running playground examples in the project files directly (without swarms installed via PIP), -make sure to add the project root to your PYTHONPATH by running the following command in the project's root directory: - 'export PYTHONPATH=$(pwd):$PYTHONPATH' + """ ################ Adding project root to PYTHONPATH ################################ @@ -40,7 +36,7 @@ class PersonInfo(BaseModel): } """ name: str = Field(..., title="Name of the person") - agent: int = Field(..., title="Age of the person") + age: int = Field(..., title="Age of the person") is_student: bool = Field(..., title="Whether the person is a student") courses: list[str] = Field( ..., title="List of courses the person is taking" @@ -61,7 +57,7 @@ agent = Agent( ) # Define the task to generate a person's information -task = "Generate a person's information" +task = "Generate a person's information for Paul Graham 56 years old and is a student at Harvard University and is taking 3 courses: Math, Science, and History." # Run the agent to generate the person's information generated_data = agent.run(task)