mirror of
https://github.com/langgenius/dify.git
synced 2026-03-27 09:09:54 +08:00
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: WH-2099 <wh2099@pm.me>
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
from collections.abc import Generator, Mapping
|
|
from typing import Any, Protocol
|
|
|
|
import httpx
|
|
|
|
from dify_graph.file import File
|
|
|
|
|
|
class HttpClientProtocol(Protocol):
|
|
@property
|
|
def max_retries_exceeded_error(self) -> type[Exception]: ...
|
|
|
|
@property
|
|
def request_error(self) -> type[Exception]: ...
|
|
|
|
def get(self, url: str, max_retries: int = ..., **kwargs: Any) -> httpx.Response: ...
|
|
|
|
def head(self, url: str, max_retries: int = ..., **kwargs: Any) -> httpx.Response: ...
|
|
|
|
def post(self, url: str, max_retries: int = ..., **kwargs: Any) -> httpx.Response: ...
|
|
|
|
def put(self, url: str, max_retries: int = ..., **kwargs: Any) -> httpx.Response: ...
|
|
|
|
def delete(self, url: str, max_retries: int = ..., **kwargs: Any) -> httpx.Response: ...
|
|
|
|
def patch(self, url: str, max_retries: int = ..., **kwargs: Any) -> httpx.Response: ...
|
|
|
|
|
|
class FileManagerProtocol(Protocol):
|
|
def download(self, f: File, /) -> bytes: ...
|
|
|
|
|
|
class ToolFileManagerProtocol(Protocol):
|
|
def create_file_by_raw(
|
|
self,
|
|
*,
|
|
file_binary: bytes,
|
|
mimetype: str,
|
|
filename: str | None = None,
|
|
) -> Any: ...
|
|
|
|
def get_file_generator_by_tool_file_id(self, tool_file_id: str) -> tuple[Generator | None, File | None]: ...
|
|
|
|
|
|
class FileReferenceFactoryProtocol(Protocol):
|
|
def build_from_mapping(self, *, mapping: Mapping[str, Any]) -> File: ...
|