mirror of
https://github.com/MIDORIBIN/langchain-gpt4free.git
synced 2024-12-23 19:22:58 +03:00
style: type strictness
This commit is contained in:
parent
138abc4a30
commit
9d0b4d013e
@ -14,7 +14,7 @@ class G4FLLM(LLM):
|
||||
# Provider.Provider
|
||||
provider: Optional[ModuleType] = None
|
||||
auth: Optional[Union[str, bool]] = None
|
||||
create_kwargs: Optional[dict] = None
|
||||
create_kwargs: Optional[dict[str, Any]] = None
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
@ -28,20 +28,19 @@ class G4FLLM(LLM):
|
||||
**kwargs: Any,
|
||||
) -> str:
|
||||
create_kwargs = {} if self.create_kwargs is None else self.create_kwargs.copy()
|
||||
if self.model is not None:
|
||||
create_kwargs["model"] = self.model
|
||||
if self.provider is not None:
|
||||
create_kwargs["provider"] = self.provider
|
||||
if self.auth is not None:
|
||||
create_kwargs["auth"] = self.auth
|
||||
|
||||
text = ChatCompletion.create(
|
||||
text = ChatCompletion.create( # type: ignore
|
||||
messages=[{"role": "user", "content": prompt}],
|
||||
**create_kwargs,
|
||||
)
|
||||
if stop is not None:
|
||||
text = enforce_stop_tokens(text, stop)
|
||||
return text
|
||||
if stop is not None and type(stop) is str:
|
||||
text = enforce_stop_tokens(text, stop) # type: ignore
|
||||
return text # type: ignore
|
||||
|
||||
@property
|
||||
def _identifying_params(self) -> Mapping[str, Any]:
|
||||
|
@ -1 +1,3 @@
|
||||
from .G4FLLM import G4FLLM
|
||||
|
||||
__all__ = ["G4FLLM"]
|
||||
|
4
pyrightconfig.json
Normal file
4
pyrightconfig.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"reportMissingTypeStubs": "information",
|
||||
"reportUnknownMemberType": "information"
|
||||
}
|
Loading…
Reference in New Issue
Block a user