core[patch]: Add missing type annotations (#22756)

Add missing type annotations.

The missing type annotations will raise exceptions with pydantic 2.
pull/21573/merge
Eugene Yurtsev 4 months ago committed by GitHub
parent 05d31a2f00
commit 5a7eac191a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -130,7 +130,7 @@ class CommaSeparatedListOutputParser(ListOutputParser):
class NumberedListOutputParser(ListOutputParser):
"""Parse a numbered list."""
pattern = r"\d+\.\s([^\n]+)"
pattern: str = r"\d+\.\s([^\n]+)"
def get_format_instructions(self) -> str:
return (
@ -154,7 +154,7 @@ class NumberedListOutputParser(ListOutputParser):
class MarkdownListOutputParser(ListOutputParser):
"""Parse a markdown list."""
pattern = r"^\s*[-*]\s([^\n]+)$"
pattern: str = r"^\s*[-*]\s([^\n]+)$"
def get_format_instructions(self) -> str:
return "Your response should be a markdown list, " "eg: `- foo\n- bar\n- baz`"

@ -64,7 +64,7 @@ class EvaluatorCallbackHandler(BaseTracer):
The LangSmith project name to be organize eval chain runs under.
"""
name = "evaluator_callback_handler"
name: str = "evaluator_callback_handler"
def __init__(
self,

@ -744,8 +744,8 @@ def test_validation_error_handling_non_validation_error(
"""Test that validation errors are handled correctly."""
class _RaiseNonValidationErrorTool(BaseTool):
name = "raise_non_validation_error_tool"
description = "A tool that raises a non-validation error"
name: str = "raise_non_validation_error_tool"
description: str = "A tool that raises a non-validation error"
def _parse_input(
self,
@ -806,8 +806,8 @@ async def test_async_validation_error_handling_non_validation_error(
"""Test that validation errors are handled correctly."""
class _RaiseNonValidationErrorTool(BaseTool):
name = "raise_non_validation_error_tool"
description = "A tool that raises a non-validation error"
name: str = "raise_non_validation_error_tool"
description: str = "A tool that raises a non-validation error"
def _parse_input(
self,

Loading…
Cancel
Save