mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-11 20:06:54 +08:00
fix: typos and improve naming conventions: (#8687)
This commit is contained in:
@@ -57,7 +57,7 @@ class AsyncCompletions(BaseAPI):
|
||||
if temperature <= 0:
|
||||
do_sample = False
|
||||
temperature = 0.01
|
||||
# logger.warning("temperature:取值范围是:(0.0, 1.0) 开区间,do_sample重写为:false(参数top_p temperture不生效)") # noqa: E501
|
||||
# logger.warning("temperature:取值范围是:(0.0, 1.0) 开区间,do_sample重写为:false(参数top_p temperature不生效)") # noqa: E501
|
||||
if temperature >= 1:
|
||||
temperature = 0.99
|
||||
# logger.warning("temperature:取值范围是:(0.0, 1.0) 开区间")
|
||||
|
||||
@@ -60,7 +60,7 @@ class Completions(BaseAPI):
|
||||
if temperature <= 0:
|
||||
do_sample = False
|
||||
temperature = 0.01
|
||||
# logger.warning("temperature:取值范围是:(0.0, 1.0) 开区间,do_sample重写为:false(参数top_p temperture不生效)") # noqa: E501
|
||||
# logger.warning("temperature:取值范围是:(0.0, 1.0) 开区间,do_sample重写为:false(参数top_p temperature不生效)") # noqa: E501
|
||||
if temperature >= 1:
|
||||
temperature = 0.99
|
||||
# logger.warning("temperature:取值范围是:(0.0, 1.0) 开区间")
|
||||
|
||||
@@ -630,8 +630,7 @@ def validate_type(*, type_: type[_T], value: object) -> _T:
|
||||
return cast(_T, _validate_non_model_type(type_=type_, value=value))
|
||||
|
||||
|
||||
# our use of subclasssing here causes weirdness for type checkers,
|
||||
# so we just pretend that we don't subclass
|
||||
# Subclassing here confuses type checkers, so we treat this class as non-inheriting.
|
||||
if TYPE_CHECKING:
|
||||
GenericModel = BaseModel
|
||||
else:
|
||||
|
||||
@@ -169,7 +169,7 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
|
||||
# Pydantic uses a custom `__iter__` method to support casting BaseModels
|
||||
# to dictionaries. e.g. dict(model).
|
||||
# As we want to support `for item in page`, this is inherently incompatible
|
||||
# with the default pydantic behaviour. It is not possible to support both
|
||||
# with the default pydantic behavior. It is not possible to support both
|
||||
# use cases at once. Fortunately, this is not a big deal as all other pydantic
|
||||
# methods should continue to work as expected as there is an alternative method
|
||||
# to cast a model to a dictionary, model.dict(), which is used internally
|
||||
@@ -356,16 +356,16 @@ class HttpClient:
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def _object_to_formfata(self, key: str, value: Data | Mapping[object, object]) -> list[tuple[str, str]]:
|
||||
def _object_to_formdata(self, key: str, value: Data | Mapping[object, object]) -> list[tuple[str, str]]:
|
||||
items = []
|
||||
|
||||
if isinstance(value, Mapping):
|
||||
for k, v in value.items():
|
||||
items.extend(self._object_to_formfata(f"{key}[{k}]", v))
|
||||
items.extend(self._object_to_formdata(f"{key}[{k}]", v))
|
||||
return items
|
||||
if isinstance(value, list | tuple):
|
||||
for v in value:
|
||||
items.extend(self._object_to_formfata(key + "[]", v))
|
||||
items.extend(self._object_to_formdata(key + "[]", v))
|
||||
return items
|
||||
|
||||
def _primitive_value_to_str(val) -> str:
|
||||
@@ -385,7 +385,7 @@ class HttpClient:
|
||||
return [(key, str_data)]
|
||||
|
||||
def _make_multipartform(self, data: Mapping[object, object]) -> dict[str, object]:
|
||||
items = flatten(list(starmap(self._object_to_formfata, data.items())))
|
||||
items = flatten(list(starmap(self._object_to_formdata, data.items())))
|
||||
|
||||
serialized: dict[str, object] = {}
|
||||
for key, value in items:
|
||||
@@ -620,7 +620,7 @@ class HttpClient:
|
||||
stream: bool,
|
||||
stream_cls: type[StreamResponse] | None,
|
||||
) -> ResponseT:
|
||||
# _legacy_response with raw_response_header to paser method
|
||||
# _legacy_response with raw_response_header to parser method
|
||||
if response.request.headers.get(RAW_RESPONSE_HEADER) == "true":
|
||||
return cast(
|
||||
ResponseT,
|
||||
|
||||
@@ -87,7 +87,7 @@ class LegacyAPIResponse(Generic[R]):
|
||||
|
||||
For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`.
|
||||
|
||||
You can customise the type that the response is parsed into through
|
||||
You can customize the type that the response is parsed into through
|
||||
the `to` argument, e.g.
|
||||
|
||||
```py
|
||||
|
||||
@@ -252,7 +252,7 @@ class APIResponse(BaseAPIResponse[R]):
|
||||
|
||||
For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`.
|
||||
|
||||
You can customise the type that the response is parsed into through
|
||||
You can customize the type that the response is parsed into through
|
||||
the `to` argument, e.g.
|
||||
|
||||
```py
|
||||
@@ -363,7 +363,7 @@ class StreamAlreadyConsumed(ZhipuAIError): # noqa: N818
|
||||
# ^ error
|
||||
```
|
||||
|
||||
If you want this behaviour you'll need to either manually accumulate the response
|
||||
If you want this behavior you'll need to either manually accumulate the response
|
||||
content or call `await response.read()` before iterating over the stream.
|
||||
"""
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from .document import DocumentData, DocumentFailedInfo, DocumentObject, DocumentSuccessinfo
|
||||
from .document import DocumentData, DocumentFailedInfo, DocumentObject, DocumentSuccessInfo
|
||||
|
||||
__all__ = [
|
||||
"DocumentData",
|
||||
"DocumentObject",
|
||||
"DocumentSuccessinfo",
|
||||
"DocumentSuccessInfo",
|
||||
"DocumentFailedInfo",
|
||||
]
|
||||
|
||||
@@ -2,10 +2,10 @@ from typing import Optional
|
||||
|
||||
from ....core import BaseModel
|
||||
|
||||
__all__ = ["DocumentData", "DocumentObject", "DocumentSuccessinfo", "DocumentFailedInfo"]
|
||||
__all__ = ["DocumentData", "DocumentObject", "DocumentSuccessInfo", "DocumentFailedInfo"]
|
||||
|
||||
|
||||
class DocumentSuccessinfo(BaseModel):
|
||||
class DocumentSuccessInfo(BaseModel):
|
||||
documentId: Optional[str] = None
|
||||
"""文件id"""
|
||||
filename: Optional[str] = None
|
||||
@@ -24,7 +24,7 @@ class DocumentFailedInfo(BaseModel):
|
||||
class DocumentObject(BaseModel):
|
||||
"""文档信息"""
|
||||
|
||||
successInfos: Optional[list[DocumentSuccessinfo]] = None
|
||||
successInfos: Optional[list[DocumentSuccessInfo]] = None
|
||||
"""上传成功的文件信息"""
|
||||
failedInfos: Optional[list[DocumentFailedInfo]] = None
|
||||
"""上传失败的文件信息"""
|
||||
|
||||
Reference in New Issue
Block a user