-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Showing
4 changed files
with
174 additions
and
15 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
39 changes: 39 additions & 0 deletions
39
tests/test_tool_schema_parsing_files/nested_pydantic_as_arg_example.json
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"name": "create_task_plan", | ||
"description": "Creates a task plan for the current task.", | ||
"parameters": { | ||
"type": "object", | ||
"properties": { | ||
"steps": { | ||
"type": "object", | ||
"description": "List of steps to add to the task plan.", | ||
"properties": { | ||
"steps": { | ||
"type": "array", | ||
"description": "A list of steps to add to the task plan.", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "str", | ||
"description": "Name of the step." | ||
}, | ||
"key": { | ||
"type": "str", | ||
"description": "Unique identifier for the step." | ||
}, | ||
"description": { | ||
"type": "str", | ||
"description": "An exhaustic description of what this step is trying to achieve and accomplish." | ||
} | ||
}, | ||
"required": ["name", "key", "description"] | ||
} | ||
} | ||
}, | ||
"required": ["steps"] | ||
} | ||
}, | ||
"required": ["steps"] | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
tests/test_tool_schema_parsing_files/nested_pydantic_as_arg_example.py
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Step(BaseModel): | ||
name: str = Field( | ||
..., | ||
description="Name of the step.", | ||
) | ||
key: str = Field( | ||
..., | ||
description="Unique identifier for the step.", | ||
) | ||
description: str = Field( | ||
..., | ||
description="An exhaustic description of what this step is trying to achieve and accomplish.", | ||
) | ||
|
||
|
||
# NOTE: this example is pretty contrived - you probably don't want to have a nested pydantic model with | ||
# a single field that's the same as the variable name (in this case, `steps`) | ||
class Steps(BaseModel): | ||
steps: list[Step] = Field( | ||
..., | ||
description="A list of steps to add to the task plan.", | ||
) | ||
|
||
|
||
def create_task_plan(steps: Steps) -> str: | ||
""" | ||
Creates a task plan for the current task. | ||
It takes in a list of steps, and updates the task with the new steps provided. | ||
If there are any current steps, they will be overwritten. | ||
Each step in the list should have the following format: | ||
{ | ||
"name": <string> -- Name of the step. | ||
"key": <string> -- Unique identifier for the step. | ||
"description": <string> -- An exhaustic description of what this step is trying to achieve and accomplish. | ||
} | ||
Args: | ||
steps: List of steps to add to the task plan. | ||
Returns: | ||
str: A summary of the updated task plan after deletion | ||
""" | ||
DUMMY_MESSAGE = "Task plan created successfully." | ||
return DUMMY_MESSAGE |