forked from xtekky/gpt4free
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'xtekky:main' into main
- Loading branch information
Showing
30 changed files
with
608 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import requests | ||
|
||
url = "https://api.github.com/repos/xtekky/gpt4free/contributors" | ||
url = "https://api.github.com/repos/xtekky/gpt4free/contributors?per_page=100" | ||
|
||
for user in requests.get(url).json(): | ||
print(f'<a href="https://github.com/{user["login"]}" target="_blank"><img src="{user["avatar_url"]}&s=45" width="45" title="{user["login"]}"></a>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from __future__ import annotations | ||
|
||
import asyncio | ||
import unittest | ||
|
||
from g4f.client import AsyncClient, ImagesResponse | ||
from g4f.providers.retry_provider import IterListProvider | ||
from .mocks import ( | ||
YieldImageResponseProviderMock, | ||
MissingAuthProviderMock, | ||
AsyncRaiseExceptionProviderMock, | ||
YieldNoneProviderMock | ||
) | ||
|
||
DEFAULT_MESSAGES = [{'role': 'user', 'content': 'Hello'}] | ||
|
||
class TestIterListProvider(unittest.IsolatedAsyncioTestCase): | ||
|
||
async def test_skip_provider(self): | ||
client = AsyncClient(image_provider=IterListProvider([MissingAuthProviderMock, YieldImageResponseProviderMock], False)) | ||
response = await client.images.generate("Hello", "", response_format="orginal") | ||
self.assertIsInstance(response, ImagesResponse) | ||
self.assertEqual("Hello", response.data[0].url) | ||
|
||
async def test_only_one_result(self): | ||
client = AsyncClient(image_provider=IterListProvider([YieldImageResponseProviderMock, YieldImageResponseProviderMock], False)) | ||
response = await client.images.generate("Hello", "", response_format="orginal") | ||
self.assertIsInstance(response, ImagesResponse) | ||
self.assertEqual("Hello", response.data[0].url) | ||
|
||
async def test_skip_none(self): | ||
client = AsyncClient(image_provider=IterListProvider([YieldNoneProviderMock, YieldImageResponseProviderMock], False)) | ||
response = await client.images.generate("Hello", "", response_format="orginal") | ||
self.assertIsInstance(response, ImagesResponse) | ||
self.assertEqual("Hello", response.data[0].url) | ||
|
||
def test_raise_exception(self): | ||
async def run_exception(): | ||
client = AsyncClient(image_provider=IterListProvider([YieldNoneProviderMock, AsyncRaiseExceptionProviderMock], False)) | ||
await client.images.generate("Hello", "") | ||
self.assertRaises(RuntimeError, asyncio.run, run_exception()) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.