File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
pydantic_ai_slim/pydantic_ai Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,8 @@ def __post_init__(self) -> None:
179179 re .compile (self .grammar )
180180 except re .error as e :
181181 raise ValueError ('Regex is invalid' ) from e
182+ else :
183+ raise ValueError (f'Unsupported syntax { self .syntax } ' )
182184
183185
184186class GenerateToolJsonSchema (GenerateJsonSchema ):
Original file line number Diff line number Diff line change @@ -1496,6 +1496,11 @@ def test_function_text_format_lark_invalid():
14961496 FunctionTextFormat (syntax = 'lark' , grammar = 'invalid grammar [' )
14971497
14981498
1499+ def test_function_text_format_syntax_invalid ():
1500+ with pytest .raises (ValueError , match = 'Unsupported syntax antlr' ):
1501+ FunctionTextFormat (syntax = 'antlr' , grammar = "grammar T; a: 'a';" )
1502+
1503+
14991504def test_tool_definition_single_string_argument ():
15001505 schema = {
15011506 'type' : 'object' ,
You can’t perform that action at this time.
0 commit comments