0
0
mirror of https://github.com/MIDORIBIN/langchain-gpt4free.git synced 2024-12-23 19:22:58 +03:00

refactor: black format

This commit is contained in:
MIDORIBIN 2023-07-23 10:27:25 +09:00
parent 2797d90380
commit 55dc46f9aa

View File

@ -17,21 +17,25 @@ class G4FLLM(LLM):
@property
def _llm_type(self) -> str:
return 'custom'
def _call(self, prompt: str, stop: Optional[List[str]] = None,
run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any) -> str:
return "custom"
def _call(
self,
prompt: str,
stop: Optional[List[str]] = None,
run_manager: Optional[CallbackManagerForLLMRun] = None,
**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
create_kwargs["model"] = self.model
if self.provider is not None:
create_kwargs['provider'] = self.provider
create_kwargs["provider"] = self.provider
if self.auth is not None:
create_kwargs['auth'] = self.auth
create_kwargs["auth"] = self.auth
text = g4f.ChatCompletion.create(
messages=[{'role': 'user', 'content': prompt}],
messages=[{"role": "user", "content": prompt}],
**create_kwargs,
)
if stop is not None:
@ -42,8 +46,8 @@ class G4FLLM(LLM):
def _identifying_params(self) -> Mapping[str, Any]:
"""Get the identifying parameters."""
return {
'model': self.model,
'provider': self.provider,
'auth': self.auth,
'create_kwargs': self.create_kwargs,
"model": self.model,
"provider": self.provider,
"auth": self.auth,
"create_kwargs": self.create_kwargs,
}