0
0
mirror of https://github.com/MIDORIBIN/langchain-gpt4free.git synced 2024-12-24 19:44:39 +03:00

refactor: type

This commit is contained in:
MIDORIBIN 2023-08-20 11:18:13 +09:00
parent ca9c9aef05
commit 78fcb695ce

View File

@ -32,13 +32,16 @@ class G4FLLM(LLM):
if self.auth is not None: if self.auth is not None:
create_kwargs["auth"] = self.auth create_kwargs["auth"] = self.auth
text = ChatCompletion.create( # type: ignore text = ChatCompletion.create(
messages=[{"role": "user", "content": prompt}], messages=[{"role": "user", "content": prompt}],
**create_kwargs, **create_kwargs,
) )
if stop is not None and type(stop) is str:
text = enforce_stop_tokens(text, stop) # type: ignore # Generator -> str
return text # type: ignore text = text if type(text) is str else "".join(text)
if stop is not None:
text = enforce_stop_tokens(text, stop)
return text
@property @property
def _identifying_params(self) -> Mapping[str, Any]: def _identifying_params(self) -> Mapping[str, Any]: