mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-15 06:26:12 +00:00
core: Add ruff rules D (docstring) (#29406)
This ensures that the code is properly documented: https://docs.astral.sh/ruff/rules/#pydocstyle-d Related to #21983
This commit is contained in:
committed by
GitHub
parent
64df60e690
commit
88b4233fa1
@@ -3743,6 +3743,7 @@
|
||||
'ChatPromptValueConcrete': dict({
|
||||
'description': '''
|
||||
Chat prompt value which explicitly lists out the message types it accepts.
|
||||
|
||||
For use in external schemas.
|
||||
''',
|
||||
'properties': dict({
|
||||
@@ -5247,6 +5248,7 @@
|
||||
'ChatPromptValueConcrete': dict({
|
||||
'description': '''
|
||||
Chat prompt value which explicitly lists out the message types it accepts.
|
||||
|
||||
For use in external schemas.
|
||||
''',
|
||||
'properties': dict({
|
||||
@@ -8142,6 +8144,7 @@
|
||||
'ChatPromptValueConcrete': dict({
|
||||
'description': '''
|
||||
Chat prompt value which explicitly lists out the message types it accepts.
|
||||
|
||||
For use in external schemas.
|
||||
''',
|
||||
'properties': dict({
|
||||
@@ -10990,6 +10993,7 @@
|
||||
'ChatPromptValueConcrete': dict({
|
||||
'description': '''
|
||||
Chat prompt value which explicitly lists out the message types it accepts.
|
||||
|
||||
For use in external schemas.
|
||||
''',
|
||||
'properties': dict({
|
||||
@@ -12455,6 +12459,7 @@
|
||||
'ChatPromptValueConcrete': dict({
|
||||
'description': '''
|
||||
Chat prompt value which explicitly lists out the message types it accepts.
|
||||
|
||||
For use in external schemas.
|
||||
''',
|
||||
'properties': dict({
|
||||
|
@@ -137,7 +137,7 @@ def test_structured_args() -> None:
|
||||
|
||||
|
||||
def test_misannotated_base_tool_raises_error() -> None:
|
||||
"""Test that a BaseTool with the incorrect typehint raises an exception.""" ""
|
||||
"""Test that a BaseTool with the incorrect typehint raises an exception."""
|
||||
with pytest.raises(SchemaAnnotationError):
|
||||
|
||||
class _MisAnnotatedTool(BaseTool):
|
||||
@@ -156,7 +156,7 @@ def test_misannotated_base_tool_raises_error() -> None:
|
||||
|
||||
|
||||
def test_forward_ref_annotated_base_tool_accepted() -> None:
|
||||
"""Test that a using forward ref annotation syntax is accepted.""" ""
|
||||
"""Test that a using forward ref annotation syntax is accepted."""
|
||||
|
||||
class _ForwardRefAnnotatedTool(BaseTool):
|
||||
name: str = "structured_api"
|
||||
@@ -1309,7 +1309,8 @@ def test_docstring_parsing() -> None:
|
||||
|
||||
|
||||
def test_tool_invalid_docstrings() -> None:
|
||||
# Test invalid docstrings
|
||||
"""Test invalid docstrings"""
|
||||
|
||||
def foo3(bar: str, baz: int) -> str:
|
||||
"""The foo."""
|
||||
return bar
|
||||
@@ -1524,7 +1525,7 @@ def test_convert_from_runnable_other() -> None:
|
||||
|
||||
@tool("foo", parse_docstring=True)
|
||||
def injected_tool(x: int, y: Annotated[str, InjectedToolArg]) -> str:
|
||||
"""foo.
|
||||
"""Foo.
|
||||
|
||||
Args:
|
||||
x: abc
|
||||
@@ -1538,7 +1539,7 @@ class InjectedTool(BaseTool):
|
||||
description: str = "foo."
|
||||
|
||||
def _run(self, x: int, y: Annotated[str, InjectedToolArg]) -> Any:
|
||||
"""foo.
|
||||
"""Foo.
|
||||
|
||||
Args:
|
||||
x: abc
|
||||
@@ -1574,7 +1575,7 @@ def injected_tool_with_schema(x: int, y: str) -> str:
|
||||
def test_tool_injected_arg_without_schema(tool_: BaseTool) -> None:
|
||||
assert _schema(tool_.get_input_schema()) == {
|
||||
"title": "foo",
|
||||
"description": "foo.\n\nArgs:\n x: abc\n y: 123",
|
||||
"description": "Foo.\n\nArgs:\n x: abc\n y: 123",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": {"title": "X", "type": "integer"},
|
||||
@@ -1667,7 +1668,7 @@ def test_tool_injected_arg() -> None:
|
||||
tool_ = injected_tool
|
||||
assert _schema(tool_.get_input_schema()) == {
|
||||
"title": "foo",
|
||||
"description": "foo.",
|
||||
"description": "Foo.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"x": {"description": "abc", "title": "X", "type": "integer"},
|
||||
@@ -1677,7 +1678,7 @@ def test_tool_injected_arg() -> None:
|
||||
}
|
||||
assert _schema(tool_.tool_call_schema) == {
|
||||
"title": "foo",
|
||||
"description": "foo.",
|
||||
"description": "Foo.",
|
||||
"type": "object",
|
||||
"properties": {"x": {"description": "abc", "title": "X", "type": "integer"}},
|
||||
"required": ["x"],
|
||||
@@ -1699,7 +1700,7 @@ def test_tool_injected_arg() -> None:
|
||||
|
||||
assert convert_to_openai_function(tool_) == {
|
||||
"name": "foo",
|
||||
"description": "foo.",
|
||||
"description": "Foo.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {"x": {"type": "integer", "description": "abc"}},
|
||||
|
Reference in New Issue
Block a user