Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove newline filter in param descriptions for agents #169

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/aviary/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,7 @@ def from_function(
continue
d = next(
(
cls._get_param_desc(
p, include_type=types_in_param_descriptions
).replace("\n", " ")
cls._get_param_desc(p, include_type=types_in_param_descriptions)
for p in docstring.params
if p.arg_name == pname
),
Expand Down
42 changes: 41 additions & 1 deletion tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def many_edge_cases(
enum: StubEnum,
defaulted_str: str = "default",
defaulted_float: float = 1.0,
structured_arg: str = "structured",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Structured implies it's a BaseModel not a string, maybe rename to specified_str

) -> None:
"""
Check using docstrings as partial f-string templates like so: {summary_format}.
Expand All @@ -73,6 +74,22 @@ def many_edge_cases(
enum: I am an enum.
defaulted_str: I have a string default value.
defaulted_float: I have a float default value.
structured_arg: I am structured. There are lots of examples
included which cross several lines.
Query Syntax:
Basic Search:
Search with two words and a space:
>>> "word1 word2" # doctest: +SKIP

Modified Search:
Use operators to modify search behavior:
>>> 'EXPANSION[None]NAME"word phrase"' # doctest: +SKIP
>>> 'EXPANSION[Concept]"words"' # doctest: +SKIP

Operators:
EXPANSION[type]: Terms
- Term1: a description
- Term2: another description
"""


Expand Down Expand Up @@ -169,7 +186,7 @@ class TestTool:
},
"y": {
"description": (
"I am null. And despite that there is a"
"I am null.\nAnd despite that there is a"
mskarlin marked this conversation as resolved.
Show resolved Hide resolved
" multiline argument description."
),
"title": "Y",
Expand Down Expand Up @@ -226,6 +243,29 @@ class TestTool:
"title": "Defaulted Float",
"type": "number",
},
"structured_arg": {
"default": "structured",
"description": (
"I am structured. There are lots of examples\n"
"included which cross several lines.\n"
"Query Syntax:\n"
" Basic Search:\n"
" Search with two words and a space:\n"
' >>> "word1 word2" # doctest: +SKIP\n'
"\n"
" Modified Search:\n"
" Use operators to modify search behavior:\n"
" >>> 'EXPANSION[None]NAME\"word phrase\"' # doctest: +SKIP\n"
" >>> 'EXPANSION[Concept]\"words\"' # doctest: +SKIP\n"
"\n"
"Operators:\n"
" EXPANSION[type]: Terms\n"
" - Term1: a description\n"
" - Term2: another description"
),
"title": "Structured Arg",
"type": "string",
},
},
"required": [
"x",
Expand Down
Loading