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

Add missing type annotations.

The missing type annotations will raise exceptions with pydantic 2.
This commit is contained in:
Eugene Yurtsev 2024-06-10 16:59:41 -04:00 committed by GitHub
parent 05d31a2f00
commit 5a7eac191a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

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

View File

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

View File

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