You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The AsyncClient API is the asynchronous counterpart to the standard G4F Client API. It offers the same functionality as the synchronous API, but with the added benefit of improved performance due to its asynchronous nature.
@@ -25,7 +26,7 @@ from g4f.Provider import BingCreateImages, OpenaiChat, Gemini
25
26
client = AsyncClient(
26
27
provider=OpenaiChat,
27
28
image_provider=Gemini,
28
-
...
29
+
# Add any other necessary parameters
29
30
)
30
31
```
31
32
@@ -43,7 +44,7 @@ from g4f.client import AsyncClient
43
44
client = AsyncClient(
44
45
api_key="your_api_key_here",
45
46
proxies="http://user:pass@host",
46
-
...
47
+
# Add any other necessary parameters
47
48
)
48
49
```
49
50
@@ -57,28 +58,44 @@ client = AsyncClient(
57
58
You can use the `ChatCompletions` endpoint to generate text completions. Here’s how you can do it:
58
59
59
60
```python
60
-
response =await client.chat.completions.create(
61
-
model="gpt-3.5-turbo",
62
-
messages=[{"role": "user", "content": "Say this is a test"}],
The following code snippet demonstrates how to use a vision model to analyze an image and generate a description based on the content of the image. This example shows how to fetch an image, send it to the model, and then process the response.
Bot: There is a waterfall in the middle of a jungle. There is a rainbow over...
164
182
```
165
183
184
+
### Example: Using a Vision Model
185
+
The following code snippet demonstrates how to use a vision model to analyze an image and generate a description based on the content of the image. This example shows how to fetch an image, send it to the model, and then process the response.
0 commit comments