summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-23 11:33:38 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-23 11:33:38 +0100
commit51264fe20cda57eff47ac9a386edb3563eac4568 (patch)
tree29233c3c384ebc8cc493e68842aa0dcff499cd49 /docs
parentAdd missing file (diff)
downloadgpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.tar
gpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.tar.gz
gpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.tar.bz2
gpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.tar.lz
gpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.tar.xz
gpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.tar.zst
gpt4free-51264fe20cda57eff47ac9a386edb3563eac4568.zip
Diffstat (limited to 'docs')
-rw-r--r--docs/client.md33
1 files changed, 29 insertions, 4 deletions
diff --git a/docs/client.md b/docs/client.md
index 6cc08ac3..7d3cad11 100644
--- a/docs/client.md
+++ b/docs/client.md
@@ -37,12 +37,16 @@ client = Client(
)
```
-You also have the option to define a proxy in the client for all outgoing requests:
+## Configuration
+
+You can set an "api_key" for your provider in client.
+And you also have the option to define a proxy for all outgoing requests:
```python
from g4f.client import Client
client = Client(
+ api_key="...",
proxies="http://user:pass@host",
...
)
@@ -74,7 +78,7 @@ stream = client.chat.completions.create(
)
for chunk in stream:
if chunk.choices[0].delta.content:
- print(chunk.choices[0].delta.content, end="")
+ print(chunk.choices[0].delta.content or "", end="")
```
**Image Generation:**
@@ -109,7 +113,28 @@ image_url = response.data[0].url
Original / Variant:
-[![Original Image](/docs/cat.jpeg)](/docs/client.md)
-[![Variant Image](/docs/cat.webp)](/docs/client.md)
+[![Original Image](/docs/cat.jpeg)](/docs/client.md) [![Variant Image](/docs/cat.webp)](/docs/client.md)
+
+#### Advanced example using GeminiProVision
+
+```python
+from g4f.client import Client
+from g4f.Provider.GeminiPro import GeminiPro
+
+client = Client(
+ api_key="...",
+ provider=GeminiPro
+)
+response = client.chat.completions.create(
+ model="gemini-pro-vision",
+ messages=[{"role": "user", "content": "What are on this image?"}],
+ image=open("docs/cat.jpeg", "rb")
+)
+print(response.choices[0].message.content)
+```
+**Question:** What are on this image?
+```
+ A cat is sitting on a window sill looking at a bird outside the window.
+```
[Return to Home](/) \ No newline at end of file