Skip to content

Commit

Permalink
add g4f support - Support for passing model class.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcjqyml authored and lss233 committed Sep 7, 2023
1 parent d9de8fa commit 145282e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion adapter/gpt4free/g4f_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def g4f_check_account(account: G4fModels):

try:
response = g4f.ChatCompletion.create(
model=account.model,
model=eval(account.model) if account.model.startswith("g4f.models.") else account.model,
provider=eval(account.provider),
messages=[vars(ChatMessage(ROLE_USER, "hello"))],
)
Expand Down
2 changes: 1 addition & 1 deletion adapter/gpt4free/gpt4free.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def on_reset(self):
async def ask(self, prompt: str) -> Generator[str, None, None]:
self.conversation_history.append(vars(ChatMessage(ROLE_USER, prompt)))
response = g4f.ChatCompletion.create(
model=self.model.model,
model=eval(self.model.model) if self.model.model.startswith("g4f.models.") else self.model.model,
provider=eval(self.model.provider),
messages=self.conversation_history,
)
Expand Down

0 comments on commit 145282e

Please sign in to comment.