core: fix UP006 noqas

This commit is contained in:
Erick Friis 2024-10-01 09:19:20 -07:00
parent e317d457cf
commit a917898db7
2 changed files with 6 additions and 9 deletions

View File

@ -1,9 +1,9 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
import builtins
import inspect import inspect
import json import json
import typing
import uuid import uuid
import warnings import warnings
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
@ -1103,20 +1103,18 @@ class BaseChatModel(BaseLanguageModel[BaseMessage], ABC):
def bind_tools( def bind_tools(
self, self,
tools: Sequence[ tools: Sequence[Union[builtins.dict[str, Any], type, Callable, BaseTool]],
Union[typing.Dict[str, Any], type, Callable, BaseTool] # noqa: UP006
],
**kwargs: Any, **kwargs: Any,
) -> Runnable[LanguageModelInput, BaseMessage]: ) -> Runnable[LanguageModelInput, BaseMessage]:
raise NotImplementedError() raise NotImplementedError()
def with_structured_output( def with_structured_output(
self, self,
schema: Union[typing.Dict, type], # noqa: UP006 schema: Union[builtins.dict, type],
*, *,
include_raw: bool = False, include_raw: bool = False,
**kwargs: Any, **kwargs: Any,
) -> Runnable[LanguageModelInput, Union[typing.Dict, BaseModel]]: # noqa: UP006 ) -> Runnable[LanguageModelInput, Union[builtins.dict, BaseModel]]:
"""Model wrapper that returns outputs formatted to match the given schema. """Model wrapper that returns outputs formatted to match the given schema.
Args: Args:

View File

@ -2,7 +2,6 @@ from __future__ import annotations
import contextlib import contextlib
import json import json
import typing
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from collections.abc import Mapping from collections.abc import Mapping
from functools import cached_property from functools import cached_property
@ -51,7 +50,7 @@ class BasePromptTemplate(
"""optional_variables: A list of the names of the variables for placeholder """optional_variables: A list of the names of the variables for placeholder
or MessagePlaceholder that are optional. These variables are auto inferred or MessagePlaceholder that are optional. These variables are auto inferred
from the prompt and user need not provide them.""" from the prompt and user need not provide them."""
input_types: typing.Dict[str, Any] = Field(default_factory=dict, exclude=True) # noqa: UP006 input_types: dict[str, Any] = Field(default_factory=dict, exclude=True)
"""A dictionary of the types of the variables the prompt template expects. """A dictionary of the types of the variables the prompt template expects.
If not provided, all variables are assumed to be strings.""" If not provided, all variables are assumed to be strings."""
output_parser: Optional[BaseOutputParser] = None output_parser: Optional[BaseOutputParser] = None
@ -61,7 +60,7 @@ class BasePromptTemplate(
Partial variables populate the template so that you don't need to Partial variables populate the template so that you don't need to
pass them in every time you call the prompt.""" pass them in every time you call the prompt."""
metadata: Optional[typing.Dict[str, Any]] = None # noqa: UP006 metadata: Optional[dict] = None
"""Metadata to be used for tracing.""" """Metadata to be used for tracing."""
tags: Optional[list[str]] = None tags: Optional[list[str]] = None
"""Tags to be used for tracing.""" """Tags to be used for tracing."""