mirror of
https://github.com/MIDORIBIN/langchain-gpt4free.git
synced 2024-12-24 11:34:39 +03:00
refactor: black format
This commit is contained in:
parent
2797d90380
commit
55dc46f9aa
@ -17,21 +17,25 @@ class G4FLLM(LLM):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _llm_type(self) -> str:
|
def _llm_type(self) -> str:
|
||||||
return 'custom'
|
return "custom"
|
||||||
|
|
||||||
def _call(self, prompt: str, stop: Optional[List[str]] = None,
|
|
||||||
run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any) -> str:
|
|
||||||
|
|
||||||
|
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()
|
create_kwargs = {} if self.create_kwargs is None else self.create_kwargs.copy()
|
||||||
if self.model is not None:
|
if self.model is not None:
|
||||||
create_kwargs['model'] = self.model
|
create_kwargs["model"] = self.model
|
||||||
if self.provider is not None:
|
if self.provider is not None:
|
||||||
create_kwargs['provider'] = self.provider
|
create_kwargs["provider"] = self.provider
|
||||||
if self.auth is not None:
|
if self.auth is not None:
|
||||||
create_kwargs['auth'] = self.auth
|
create_kwargs["auth"] = self.auth
|
||||||
|
|
||||||
text = g4f.ChatCompletion.create(
|
text = g4f.ChatCompletion.create(
|
||||||
messages=[{'role': 'user', 'content': prompt}],
|
messages=[{"role": "user", "content": prompt}],
|
||||||
**create_kwargs,
|
**create_kwargs,
|
||||||
)
|
)
|
||||||
if stop is not None:
|
if stop is not None:
|
||||||
@ -42,8 +46,8 @@ class G4FLLM(LLM):
|
|||||||
def _identifying_params(self) -> Mapping[str, Any]:
|
def _identifying_params(self) -> Mapping[str, Any]:
|
||||||
"""Get the identifying parameters."""
|
"""Get the identifying parameters."""
|
||||||
return {
|
return {
|
||||||
'model': self.model,
|
"model": self.model,
|
||||||
'provider': self.provider,
|
"provider": self.provider,
|
||||||
'auth': self.auth,
|
"auth": self.auth,
|
||||||
'create_kwargs': self.create_kwargs,
|
"create_kwargs": self.create_kwargs,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user